Question

I'm using Locale to get the language code of my android device (Nexus S)

Locale.getDefault().getLanguage()

Everything is fine except I get "zh" which means Chinese. I expected to get "zh_cn" and "zh_tw", then I can distinguish beteen simplified and traditional Chinese.

Is there any other way to distinguish which Chinese is using on Android Device?

P.S. I'm using Unity3D, my goal is making a plugin help Unity3D to get the android language setting.

Was it helpful?

Solution

This works for me when I want to get the current locale of device.

Locale.getDefault().toString()

It returns name of the current locale. Like "zh_TW" or "zh_CN".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top