本文介绍了Android中俄语的本地化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序支持4种语言.用户选择他/她的语言.但是我不能说俄语.
my application supprts 4 language. user select him/her language. But i cant do taht for Russian.
if (dil.equals("eng")){
Configuration c = new Configuration(context.getResources().getConfiguration());
c.locale = Locale.ENGLISH;
context.getResources().updateConfiguration(c,context.getResources().getDisplayMetrics());
}
else if (dil.equals("ger")){
Configuration c = new Configuration(context.getResources().getConfiguration());
c.locale = Locale.GERMAN;
context.getResources().updateConfiguration(c,context.getResources().getDisplayMetrics());
}
else if (dil.equals("rus")){
Configuration c = new Configuration(context.getResources().getConfiguration());
c.locale = Locale.????????;
context.getResources().updateConfiguration(c,context.getResources().getDisplayMetrics());
}
else
{
Configuration c = new Configuration(context.getResources().getConfiguration());
c.locale = Locale.getDefault();
context.getResources().updateConfiguration(c,context.getResources().getDisplayMetrics());
}
我不知道俄语是董;
c.locale = Locale.????????;
推荐答案
使用此,您可以将语言环境设置为俄语:
Using this constructor you can set your locale to Russian like this:
Locale myLocale = new Locale("ru","RU");
以下是Java 支持的语言环境的列表.您可以看到支持"ru",但未对其进行测试.
Here is a list of supported locales by Java. You can see that "ru" is supported , but not tested.
文档还说在某些情况下提供基本的本地化和国际化效果更好,所以我从这里进行编辑
The documentation also says some times its better to give base localization and internationalization so I edited from
Locale myLocale = new Locale("ru")
到
Locale myLocale = new Locale("ru","RU")
这篇关于Android中俄语的本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!