Android 7.0 Nougat takes default strings when en_US device language

According to the documentation in Language and Locale , the Resource Resolution Strategy with Android 7.0 (API level 24) has been improved, which is easy to understand in the following table: The Resource Resolution Strategy has been improved

According to my requirements, I want my default langauge app to be en_US. So, I do not provide separate resources for en_US. I also have en_GB resources presented separately.

Now, according to the resolution strategy, if my device language is en_US, then the order in which it should look for resources is en_US β†’ en β†’ en_GB β†’ default, which means en for all locales, in my case en_GB will be received, since I have there is no resource "en" separately, but there is a child element "en_GB".

But when I select my device language en_US, it correctly selects the default language (en_US in my case), and not en_GB, which is exactly what I need if the device language is en_US. When any other language, such as en_IN or en_AU, is selected, it selects en_GB.

One way to solve this problem is that I provide the en_US lines in 'en' and en_GB separately, which will lead to my desired behavior. But I can’t understand why the default strings are collected when I select en_US as the device language.

Is it that en_US is the default language for android, and whenever en_US is selected as the device language, it selects the default strings if en_US is not provided separately?

+4
source share
1 answer

. Google Android N, en_GB, strings.xml, , Android N . :

N, ( , - ) , .

, en-CA , en-GB ( , ): en-rCA (Canadian English), b + en + 001 ( ), en (). , en-GB en-CA, , en-CA.

, , en_UK " ". "International English" en.

0

Source: https://habr.com/ru/post/1662510/


All Articles