My application supports 4 languages. The user select their language. But this is not working for Russian.
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());
}
I don't know what to do for Russian.
c.locale = Locale.????????;
Using this constructor you can set your locale to Russian like this:
Locale myLocale = new Locale("ru","RU");
Here is a list of supported locales by Java. You can see that "ru" is supported , but not tested.
The documentation also says some times its better to give base localization and internationalization so I edited from
Locale myLocale = new Locale("ru")
to
Locale myLocale = new Locale("ru","RU")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With