1

Which language does android treats default strings.xml as?

Specifically, when there are <plurals> tags inside default strings.xml, rules for which language will Android pick? Is there a way to specify that?

1
  • default is values/strings.xml and when you change system language , app will change language too Commented Sep 11, 2015 at 8:56

2 Answers 2

2

It doesn't treat default values folder as a language dependant. It's basically a fallback if it doesn't find a better match. You can read more here.

Android will pick plurals rules for language that is currently selected in the phone(e.g. if users has german language then android will pick german rules).

Sign up to request clarification or add additional context in comments.

7 Comments

So if my default values.xml is in english, but user has german language selected, it will pick rules for german plurals? How do I work around this? I can obviously add english language xml but it wouldn't matter because german phone will still pick default values.xml.
Add german specific values. You can read about workaround here but pay attention to config changes and activity recreation. This changes every localization-based files, etc.
Right but that means only solution is to add values for every single language in the world which I can't do at the moment. Is there no way to keep app english-only but have proper plurals for every locale?
What do you mean by proper plurals for every locale? Show some example.
Lets say my app's default values.xml contains strings for Slovenian language. That requires singular, plural and dual form. For people with locale set to Slovenian it will work great. But if someone that knows Slovenian, but has his phone set to English locale would use the app, it would never use dual form since English language does not have it. I could solve this specific case with additional English values.xml, but that would still leave out every other language that doesn't use dual. And adding every single one of them is not really feasible.
|
0

Use this to change the language by programmatically--

Locale locale = new Locale("en_US"); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; context.getApplicationContext().getResources().updateConfiguration(config, null); 

Write the countrycode of language in place of "en_US" whatever language you want...like for japanese--"ja_JP" For Arabic--"ar" or check this link for code of country--

http://code.google.com/apis/igoogle/docs/i18n.htmlenter code here

1 Comment

Does this also change other localization-based settings like date formats?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.