Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solutions provided will actually return the current region of the device - not the currently selected language. These are often one and the same. However, if I am in North America and I set my language to Japanese, my region will still be English (United States). In order to retrieve the currently selected language, you can do:</p> <pre><code>NSString * language = [[NSLocale preferredLanguages] firstObject]; </code></pre> <p>This will return a two letter code for the currently selected language. "en" for English, "es" for Spanish, "de" for German, etc. For more examples, please see this Wikipedia entry (in particular, the 639-1 column):</p> <p><a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes" rel="noreferrer">List of ISO 639-1 codes</a></p> <p>Then it's a simple matter of converting the two letter codes to the string you would like to display. So if it's "en", display "English".</p> <p>Hope this helps someone that's looking to differentiate between region and currently selected language.</p> <p><strong>EDIT</strong></p> <p>Worth to quote the header information from NSLocale.h:</p> <pre><code>+ (NSArray *)preferredLanguages NS_AVAILABLE(10_5, 2_0); // note that this list does not indicate what language the app is actually running in; the [NSBundle mainBundle] object determines that at launch and knows that information </code></pre> <p>People interested in app language take a look at <a href="https://stackoverflow.com/a/10497352">@mindvision's answer</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload