【问题标题】:How to fix "Strings inside 'values-ne/strings.xml' file not recognized by play store."如何修复“Play商店无法识别'values-ne/strings.xml'文件中的字符串。”
【发布时间】: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


    【解决方案1】:

    把它放在你的项目 gradle 文件中,在 android 块中。

    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = true
        }
        abi {
            enableSplit = true
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-10
      • 2015-03-09
      • 1970-01-01
      • 2013-07-18
      • 1970-01-01
      • 1970-01-01
      • 2012-01-09
      • 2020-10-12
      相关资源
      最近更新 更多