Android determines whether the current language environment is Chinese

If you don't have much to say, please see the code:

PS: Android determines what language the current system uses

Judge country:

Chinese: getresources(). Getconfiguration(). Locale. Getcountry(). Equals ("CN")

Traditional Chinese: getresources(). Getconfiguration(). Locale. Getcountry(). Equals ("TW")

English (British): getresources(). Getconfiguration(). Locale. Getcountry(). Equals ("UK")

English (American): getresources(). Getconfiguration(). Locale. Getcountry(). Equals ("us")

If you don't know the abbreviation of the current country, you can directly

System.out(getResources().getConfiguration().locale.getCountry()); Just print it out

The following is to judge whether it is Chinese or traditional Chinese (Taiwan):

String format = Settings.System.getString(context4Year.getContentResolver(),Settings.System.DATE_FORMAT);

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of programming tips!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>