When using custom locale in android, directory names, e.g.
res/drawable-en-rUS res/values-fr-rCA
where -r indicates the region (country) in which the language is spoken.
How about when the regional option is indicated? My client asked us to support English, Chinese, and three (3) variants of Japanese. (*)
I set the locale using a custom application class and code like this:
locale = new Locale(lang, country); Locale.setDefault(locale); config.locale = locale; mContext.getResources().updateConfiguration(config,mContext.getResources().getDisplayMetrics());
and use resource directories named like this:
/res/drawable-en /res/drawable-cx /res/drawable-ja /res/drawable-ja-rHI /res/drawable-ja-rFU
While this works; the bottom two entries are hacks. I use imaginary country names to be regions when I really need them to be something like
/res/drawable-ja-rJP-vHI /res/drawable-ja-rJP-vFU
to indicate an option in Japan.
There is also a Locale() constructor, namely
Locale(String language, String country, String variant);
If I use it like
locale = new Locale("ja", "JP", "hi");
How do I specify resource directories, including language, region, and variant?
The best resource I have found on Providing alternative application resources does not show how to do this.
(*) they requested these Japanese options:
- only hiragana
- hiragana with furigan over kanji
- normal with kanji + hiragana