【发布时间】:2018-12-24 08:13:46
【问题描述】:
在我运行 Play 商店时,我的双语应用程序运行良好。但是,在play store上传后,只支持英文,不支持其他语言。
我有两个字符串文件 values/strings.xml 和 values-ne/strings.xml。当我运行源代码时,该应用程序正在运行文件。但是一旦我将它上传到 play store 并从那里下载,values-ne/strings.xml 中的文件就不会被解析,我的应用程序只支持英语。
public static void setLocale(Context ctx, String languageToLoad) {
Resources resources = ctx.getResources();
Locale locale;
if(languageToLoad.equals(AppConstants.LOCALE_ENGLISH)) {
locale=new Locale(AppConstants.LOCALE_ENGLISH);
}else{
locale=new Locale(AppConstants.LOCALE_NEPALI);
}
Configuration configuration = resources.getConfiguration();
configuration.setLocale(locale);
ctx.getResources().updateConfiguration(configuration,
ctx.getResources().getDisplayMetrics());
}
点击“语言更改”选项后,所有字符串的语言都应更改。
【问题讨论】:
标签: android localization