I'd like to show the current language that the device UI is using. What code would I use?
I want this as an NSString
in fully spelled out format. (Not @"en_US")
EDIT: For those driving on by, there are a ton of useful comments here, as the answer has evolved with new iOS releases.
As of iOS 9, if you just want the language code without country code, you'll want this sort of helper function - since the language will contain the country code.
Simple Swift 3 function:
Even there's a better way to get current device language. Let's try it by below code -
Suggested by Abizern on here
If you want to get only language here is my suggested answer:
In my case i just wanted only Locale language not locale region.
Output: If your Locale language is Japanese and locale region is Japan then:
langplusreg = ja-JP
langonly = ja
i use this
ignore memory leak..
and result is
Two letters format. Apple uses the ISO standard ISO-3166.