Android – resource directory name of the language variant?
For example, when using custom locale in Android, the directory name is
res/drawable-en-rUS
res/values-fr-rCA
Where - R specifies the region (country) where the language is spoken
When are regional variants also specified? My client asked us to support English, Chinese and three (3) Japanese. (*)
I use the customized application class to set the locale. The code is as follows:
locale = new Locale(lang, country);
Locale.setDefault(locale);
config.locale = locale;
mContext.getResources().updateConfiguration(config,mContext.getResources().getDisplayMetrics());
And use the resource directory named as follows:
/res/drawable-en
/res/drawable-cx
/res/drawable-ja
/res/drawable-ja-rHI
/res/drawable-ja-rFU
Although this works; The bottom two entries are hackers. I'm using imaginary country names as regions when I actually need them
/res/drawable-ja-rJP-vHI
/res/drawable-ja-rJP-vFU
Specify variants in Japan
There is another locale () constructor, namely
Locale(String language,String country,String variant);
If I use it
locale = new Locale(“ja”,“JP”,“hi”);
How do I specify resource directories, including languages, regions, and variants?
The best resources I found at providing alternative application resources do not show how to do this
(*) they require these Japanese versions:
>Hiragana only > hiragana > kana above Kanji > normal Kanji Hiragana
resolvent:
The problem with this is that you cannot specify variants as resource folders. As far as I know, the only purpose of variant strings is to be able to display them to users. To be honest, I think your 'hacker' may be the best solution
Even if it may be other ways, the variant you use is not a regional variant anyway, but a different way to write the same thing. (personally, I'm a loyal fan of mixing, but I still only know about 300 Chinese characters, so it sometimes gets me into trouble... But it's enough to get around!)