开发者

Detect locales available on device

开发者 https://www.devze.com 2023-03-30 21:49 出处:网络
I am implementing overriding the locale of the device in my application allowing the selection of a different language via a preference.

I am implementing overriding the locale of the device in my application allowing the selection of a different language via a preference.

Now when presenting the list of available languages I am looking at using Locale.getAvailableLocales() to see which ones are installed on the device.

Will that work and e.g. only return a smaller set of locales if they are not fulled installed down to the needed fonts and so on?开发者_JS百科


As Android's Documentation states:

Most locale-sensitive classes offer their own getAvailableLocales method, which should be preferred over this general purpose method.

To me that means you should test against these methods to be on the safe side. So it seems that the answer is no. However, in terms of installed fonts, I believe that system provides a way to display almost any language. Some symbolic glyphs might be missing but I don't think it regards to regular characters (or maybe it does in regards to some obscure scripts but I don't think you would use them).

0

精彩评论

暂无评论...
验证码 换一张
取 消