Android中的俄语本地化

前端之家收集整理的这篇文章主要介绍了Android中的俄语本地化前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的申请支持4种语言.用户选择他/她的语言.但我不能为俄罗斯做什么.
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.????????;

解决方法

使用此 constructor,您可以将您的语言环境设置为俄语,如下所示:
Locale myLocale = new Locale("ru","RU");

这是Java的supported locales列表.您可以看到支持“ru”,但未经过测试.

该文档还说有时候更好地提供基本本地化和国际化,所以我编辑了

Locale myLocale =  new Locale("ru")

Locale myLocale = new Locale("ru","RU")
原文链接:https://www.f2er.com/android/317222.html

猜你在找的Android相关文章