-1

I am writing an Android app which has a default language set to English. Apart from English, I have a Russian translation. I wonder what happened if a user of my app has localization set to Ukrainian. It is more likely that the Ukrainian speaker wants to read in Russian (if there is no Ukrainian translation). Does Android somehow handle such cases and show Russian content rather than English?

And if not, how can I specify localization groups for which the default language will be Russian and for rest English?

Thank you in advance

TheMentee
  • 31
  • 4

2 Answers2

0

well, there is no default option to switch to russian on ukrainian smartphone, will switch to english.

but you may manipulate Locale (so language), check out HERE or HERE

you can also introduce ukrainian translation "oficially", by creating strings.xml in proper folder and just copying whole russian translation into that. but then you will be maintaining two identical, but separated translations, maybe you can use some gradle script for copying russian translation file into ukrainian translation/resources folder during app building...

snachmsm
  • 17,866
  • 3
  • 32
  • 74
0

You can set a new default Locale for which you can then configure the language to be used by using the method below (provided also in this previous answer):

public static void setLocale(Activity activity, String languageCode) {
    Locale locale = new Locale(languageCode);
    Locale.setDefault(locale);
    Resources resources = activity.getResources();
    Configuration config = resources.getConfiguration();
    config.setLocale(locale);
    resources.updateConfiguration(config, resources.getDisplayMetrics());
}