简体   繁体   English

如何修复翻译不适用于TextView.setText()?

[英]How to fix Translation not working with TextView.setText()?

I'm localizing my application and currently facing a problem. 我正在本地化我的应用程序,当前遇到了问题。 I have a textview which shows when the application was last updated abd I have a string resource "Last Updated: " for that. 我有一个textview,它显示应用程序的最后更新时间,而我有一个字符串资源“ Last Updated:”。 I used 我用了

lastUpdate.setText(R.string.last_updated + dateString); 

My code works perfect in English language but in case of other languages the Textview acts strange and shows numbers in place of the text. 我的代码在英语中可以完美地工作,但是在其他语言的情况下,Textview表现得很奇怪,并显示数字来代替文本。

For example: When I set the language to Hindi the text Last Updated gets changed to 2131689604. How can this issue be overcome? 例如:当我将语言设置为印地语时,“ 上次更新 ”文本将更改为2131689604。如何解决此问题?

使用此获取字符串

 lastUpdate.setText(getResources().getString(R.string.last_updated) + dateString);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM