androidprogramming-languagessystemsystem-setting

Is possible to set only default English language of application in android


I only want set only default English language of application in android.

After Supporting Different Languages, I also use values/strings.xml to store characters in that file.

If in English language mode of System Settings, I can show correct words.

If in Chinese language mode of System Settings, The English words was translated to Chinese.

I don't want it translate automatically.

People who know how to set only default English language,

Please help me.

Thanks,


Solution

  • I can get correct answer now via the codes in below :

    public static void setDefaultLanguage(Context context, String lang) {
        Locale locale = new Locale(lang);
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        config.locale = locale;
        context.getResources().updateConfiguration(config,
                context.getResources().getDisplayMetrics());
    }
    

    In that, what is lang value? You should get correct Language System to pass this value to lang parameter.

    Thanks,