Getting and Initializing Locales

- initWithLocaleIdentifier:

Initializes the receiver using a given locale identifier.

Example

NSLog(@"%@",[[NSLocale alloc]initWithLocaleIdentifier:@"en_US"]);
		

Output

2014-04-12 18:57:50.629 iOS-Tutorial[1344:a0b] <__NSCFLocale: 0x9852c00>
		

+ localeWithLocaleIdentifier:

Returns a locale initialized using the given locale identifier.

Example

NSLog(@"%@",[NSLocale localeWithLocaleIdentifier:@"en_US"]);
		

Output

2014-04-12 18:58:26.539 iOS-Tutorial[1359:a0b] <__NSCFLocale: 0xa06ca00>
		

+ systemLocale

Returns the “root”, canonical locale, that contains fixed “backstop” settings that provide values for otherwise undefined keys.

Example

NSLog(@"%@",[NSLocale systemLocale]);
		

Output

2014-04-12 18:58:53.312 iOS-Tutorial[1371:a0b] <__NSCFLocale: 0x8953d90>
		

+ currentLocale

Returns the logical locale for the current user.

Example

NSLog(@"%@",[NSLocale currentLocale]);
		

Output

2014-04-12 18:58:53.312 iOS-Tutorial[1371:a0b] <__NSCFLocale: 0x8953d90>
		

+ autoupdatingCurrentLocale

Returns the current logical locale for the current user.

Example

NSLog(@"%@",[NSLocale autoupdatingCurrentLocale]);
		

Output

2014-04-12 18:59:44.202 iOS-Tutorial[1397:a0b] Auto-updating Locale  [<__NSCFLocale: 0x895bab0>]
		

Getting Information About a Locale

- displayNameForKey:value:

Returns the display name for the given value.

Example

NSLocale *locale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
NSLog(@"%@",[locale displayNameForKey:NSLocaleIdentifier value:@"en_US"]);
		

Output

2014-04-12 19:02:17.306 iOS-Tutorial[1410:a0b] English (United States)
		

- localeIdentifier

Returns the identifier for the receiver.

Example

NSLocale *locale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
NSLog(@"%@",[locale localeIdentifier]);
		

Output

2014-04-12 19:02:43.746 iOS-Tutorial[1423:a0b] en_US
		

- objectForKey:

Returns the object corresponding to the specified key.

Example

NSLocale *locale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
NSLog(@"%@",[locale objectForKey:NSLocaleIdentifier]);
		

Output

2014-04-12 19:03:55.500 iOS-Tutorial[1444:a0b] en_US
		

Getting System Locale Information

+ availableLocaleIdentifiers

Returns an array of NSString objects, each of which identifies a locale available on the system.

Example

NSLog(@"%@",[NSLocale availableLocaleIdentifiers]);
		

Output

2014-04-12 18:51:30.333 iOS-Tutorial[1269:a0b] (
    "en_IE",
    "ro_MD",
    br,
    "en_GY",
    "es_GT",
    "shi_Tfng_MA",
    mr,
    bs,
    "en_AS",
    ksf,
    "bs_Cyrl",
    "en_PR",
    ms,
    "sr_Latn_ME",
    mt,
    ha,
    "nb_NO",
    "en_SE",
    "en_BZ",
    "pt_BR",
    "or_IN",
    "is_IS",
    "mn_Cyrl_MN",
    "ar_IQ",
    he,
    "it_SM",
    "en_AT",
    bas,
    ckb,
    my,
    "zh_Hans_CN",
    mer,
    "ks_Arab_IN",
    "en_JM",
    "dz_BT",
    "ms_Arab_BN",
    "cy_GB",
    sg,
    "it_CH",
    "teo_KE",
    "de_LU",
    "en_US",
    hi,
    "hu_HU",
    "uz_Latn_UZ",
    "af_NA",
    si,
    "fr_BI",
    "ga_IE",
    mfe,
    "en_CA",
    "ne_IN",
    "rwk_TZ",
    "en_AU",
    sk,
    teo,
    "en_PT",
    "en_NG",
    sl,
    "tk_Latn_TM",
    "tzm_Latn",
    "ee_GH",
    kde,
    sn,
    "dyo_SN",
    "en_SG",
    "mas_TZ",
    so,
    "nyn_UG",
    "br_FR",
    "fr_BJ",
    "es_IC",
    "pt_MZ",
    hr,
    "az_Latn",
    sq,
    sr,
    "sw_KE",
    ca,
    hu,
    "et_EE",
    "lag_TZ",
    "bn_IN",
    nb,
    sv,
    "th_TH",
    "ml_IN",
    "sr_Cyrl_RS",
    sw,
    nd,
    "ta_IN",
    "fr_MQ",
    hy,
    "en_TO",
    "es_AR",
    ne,
    "pt_AO",
    "ne_NP",
    "ar_BH",
    "en_SI",
    "bo_IN",
    "hi_IN",
    seh,
    "de_DE",
    "ko_KP",
    "fr_BL",
    "fr_MR",
    "ca_AD",
    "fa_IR",
    nl,
    "es_PR",
    "en_PW",
    "rn_BI",
    nn,
    "kk_Cyrl",
    "en_DK",
    "sl_SI",
    dua,
    kea,
    "ms_Arab_MY",
    "ig_NG",
    kln,
    yo,
    "fr_DZ",
    "sv_FI",
    "fr_SY",
    "ru_MD",
    "en_ZW",
    "brx_IN",
    "sw_UG",
    "fil_PH",
    cs,
    "pt_GW",
    "bn_BD",
    "de_AT",
    "fr_PF",
    luo,
    "sk_SK",
    "ar_001",
    "es_US",
    "en_SK",
    ta,
    "fr_HT",
    "mk_MK",
    "om_KE",
    "da_DK",
    "en_ME",
    "ko_KR",
    "ff_SN",
    id,
    "en_KY",
    "kde_TZ",
    "shi_Latn",
    cy,
    "en_ES",
    mgh,
    "en_TR",
    "sr_Cyrl_ME",
    te,
    "fr_GN",
    "fo_FO",
    "en_NL",
    ig,
    "it_IT",
    "uk_UA",
    tg,
    "en_DM",
    "bm_ML",
    vai,
    "en_SL",
    ii,
    "en_150",
    ses,
    th,
    ti,
    "en_IM",
    "ru_KZ",
    "fr_MU",
    "iu_Cans_CA",
    "cs_CZ",
    "ar_AE",
    "te_IN",
    tk,
    brx,
    haw,
    "tzm_Latn_MA",
    "so_DJ",
    "uz_Cyrl_UZ",
    "en_BA",
    to,
    "en_MG",
    "ewo_CM",
    "ar_MR",
    "nl_AW",
    "en_IN",
    mgo,
    "sn_ZW",
    "en_CH",
    "en_TT",
    tr,
    is,
    "fr_GP",
    luy,
    "es_NI",
    "pt_TL",
    it,
    "ms_Arab",
    da,
    "kln_KE",
    iu,
    "tk_Latn",
    "en_BB",
    "ar_DZ",
    "ar_SY",
    "ha_Latn",
    "en_MH",
    "mr_IN",
    "en_GB",
    de,
    "fr_GQ",
    "en_NO",
    "ky_KG",
    "pt_PT",
    "fr_RW",
    "nus_SD",
    asa,
    zh,
    "ha_Latn_GH",
    "bo_CN",
    "kam_KE",
    "dua_CM",
    "khq_ML",
    "ur_IN",
    "en_LC",
    "fr_TD",
    "ksb_TZ",
    "gu_IN",
    om,
    jmc,
    "ro_RO",
    "ja_JP",
    "ln_AO",
    "so_ET",
    "en_GD",
    "nl_NL",
    "es_ES",
    "en_VC",
    or,
    "yo_NG",
    "es_PY",
    "mua_CM",
    "fa_AF",
    "en_HK",
    ja,
    "luo_KE",
    twq,
    "en_BE",
    "es_UY",
    "dje_NE",
    "luy_KE",
    naq,
    "si_LK",
    zu,
    "zh_Hans_MO",
    "fr_KM",
    "zh_Hant_HK",
    dz,
    swc,
    "asa_TZ",
    "jgo_CM",
    "az_Cyrl",
    ewo,
    "gv_GB",
    "ti_ER",
    "be_BY",
    "en_IS",
    "en_CM",
    uk,
    "cgg_UG",
    nyn,
    "tr_CY",
    "de_CH",
    "fr_TG",
    "jmc_TZ",
    "ta_LK",
    "so_SO",
    "es_DO",
    "fr_LU",
    "shi_Latn_MA",
    "en_SS",
    "swc_CD",
    "kn_IN",
    "hy_AM",
    "en_IT",
    "en_GG",
    fil,
    "bas_CM",
    "en_TZ",
    "ar_TD",
    ur,
    "bez_TZ",
    "haw_US",
    "fr_VU",
    "tg_Cyrl",
    pa,
    "bs_Latn_BA",
    "ee_TG",
    "ti_ET",
    "sr_Latn_BA",
    "en_GH",
    ee,
    "en_VG",
    "sv_SE",
    "ki_KE",
    "zh_Hans",
    bem,
    uz,
    "ar_YE",
    "fr_NC",
    "seh_MZ",
    "ru_UA",
    "fr_SC",
    "ar_KM",
    "en_ZA",
    "en_GI",
    "mas_KE",
    "nn_NO",
    "ar_EG",
    el,
    "en_RO",
    pl,
    "nl_BE",
    en,
    "uz_Latn",
    eo,
    shi,
    kok,
    mas,
    "fr_FR",
    rof,
    "en_MP",
    "de_BE",
    "hr_BA",
    "ar_EH",
    "es_CL",
    "en_AD",
    es,
    "en_VI",
    ps,
    et,
    "nl_SR",
    "vai_Latn",
    pt,
    eu,
    ka,
    "fr_NE",
    "eu_ES",
    "mgh_MZ",
    "zu_ZA",
    "ar_SA",
    "chr_US",
    cgg,
    "sq_MK",
    lag,
    "az_Latn_AZ",
    "es_VE",
    "ks_Arab",
    "en_HR",
    "el_GR",
    "el_CY",
    "mfe_MU",
    ki,
    vi,
    "en_KE",
    rwk,
    bez,
    kk,
    kl,
    "zh_Hant",
    "fr_CA",
    km,
    "es_HN",
    "agq_CM",
    kn,
    "ii_CN",
    "mn_Cyrl",
    "en_BM",
    ko,
    "sv_AX",
    "ln_CD",
    "en_GM",
    "iu_Cans",
    "fr_MA",
    "es_CO",
    "en_AG",
    "guz_KE",
    ks,
    "es_PA",
    "twq_NE",
    "en_NZ",
    "fr_TN",
    fa,
    "en_US_POSIX",
    "dav_KE",
    "en_WS",
    "lt_LT",
    "en_SZ",
    "ar_SD",
    "rof_TZ",
    "uz_Arab_AF",
    "vi_VN",
    "en_MT",
    kw,
    "yav_CM",
    "ta_MY",
    "ru_KG",
    kab,
    ky,
    ff,
    "en_PG",
    "to_TO",
    "ar_LY",
    jgo,
    "en_HU",
    "af_ZA",
    "en_UG",
    "de_LI",
    fi,
    "es_SV",
    khq,
    gsw,
    "ksf_CM",
    "fr_DJ",
    "en_MU",
    "bs_Latn",
    "ln_CF",
    "ms_Latn",
    "kea_CV",
    "pl_PL",
    "pa_Arab",
    "fr_MC",
    "sr_Cyrl_BA",
    "sr_Latn",
    "en_RU",
    "en_PH",
    saq,
    "ar_PS",
    "fr_CD",
    "bem_ZM",
    "ru_RU",
    "uz_Cyrl",
    "pa_Guru",
    "vai_Vaii",
    "en_FI",
    fo,
    "so_KE",
    "ln_CG",
    "ar_OM",
    "pt_ST",
    "en_KI",
    "kl_GL",
    fr,
    "es_CR",
    "ses_ML",
    tzm,
    "mer_KE",
    xog,
    "xog_UG",
    "nl_SX",
    "en_FJ",
    "ms_Latn_BN",
    "en_MW",
    "ar_MA",
    "pt_MO",
    kam,
    "en_TC",
    af,
    "ar_TN",
    "am_ET",
    "es_PE",
    "sbp_TZ",
    "fr_CF",
    "vun_TZ",
    "fr_RE",
    "ar_JO",
    ebu,
    lg,
    "ha_Latn_NG",
    "lv_LV",
    ak,
    chr,
    "az_Cyrl_AZ",
    dav,
    "en_EE",
    "es_419",
    "ebu_KE",
    "en_CY",
    "fr_MF",
    "en_AL",
    am,
    "en_PK",
    "mgo_CM",
    "fr_CG",
    dje,
    "en_JE",
    "en_LR",
    dyo,
    ln,
    "ak_GH",
    "pa_Guru_IN",
    "ar_DJ",
    "en_BS",
    lo,
    "zh_Hant_TW",
    "lg_UG",
    "ar_KW",
    ar,
    "bs_Cyrl_BA",
    "es_EA",
    "fr_MG",
    "ca_ES",
    as,
    "he_IL",
    "es_CU",
    "en_CZ",
    "en_PL",
    "fr_GA",
    "mg_MG",
    "fr_CH",
    "en_LS",
    lt,
    "my_MM",
    "kk_Cyrl_KZ",
    ga,
    "en_FM",
    lu,
    "ps_AF",
    nmg,
    "es_BO",
    sbp,
    lv,
    vun,
    "fr_YT",
    "km_KH",
    "teo_UG",
    "fr_SN",
    "om_ET",
    "ar_ER",
    "gsw_CH",
    az,
    "es_PH",
    "fi_FI",
    "tr_TR",
    "fr_CI",
    "en_LT",
    "en_UM",
    "sr_Cyrl",
    "ur_PK",
    "hr_HR",
    "nl_CW",
    "en_KN",
    "ms_Latn_MY",
    "ar_IL",
    "en_ZM",
    "es_EC",
    "gl_ES",
    "en_GU",
    gl,
    "nmg_CM",
    "zh_Hant_MO",
    "en_NA",
    "ha_Latn_NE",
    "mt_MT",
    rm,
    "kw_GB",
    "zh_Hans_SG",
    rn,
    ro,
    "rm_CH",
    "saq_KE",
    "vai_Vaii_LR",
    "ka_GE",
    "es_GQ",
    "sr_Latn_RS",
    "en_VU",
    "zh_Hans_HK",
    "en_LV",
    agq,
    gu,
    "lo_LA",
    ru,
    "en_SB",
    gv,
    "en_BW",
    yav,
    "ta_SG",
    "fr_BE",
    "bg_BG",
    "es_MX",
    rw,
    be,
    "nd_ZW",
    "kab_DZ",
    mua,
    "pt_CV",
    bg,
    "tg_Cyrl_TJ",
    "ms_Latn_SG",
    mg,
    "sg_CF",
    "pa_Arab_PK",
    "sw_TZ",
    "en_SC",
    nus,
    "shi_Tfng",
    "ar_QA",
    "naq_NA",
    "fr_BF",
    "rw_RW",
    "as_IN",
    guz,
    ksb,
    "fr_ML",
    mk,
    "kok_IN",
    "sq_AL",
    ml,
    "fr_GF",
    bm,
    "lu_CD",
    "fr_CM",
    bn,
    "ar_LB",
    "id_ID",
    "uz_Arab",
    mn,
    bo,
    "en_FR",
    "en_DE",
    "vai_Latn_LR",
    "ar_SO",
    "ru_BY"
)
		

+ ISOCountryCodes

Returns an array of NSString objects that represents all known legal country codes.

Example

NSLog(@"%@",[NSLocale ISOCountryCodes]);
		

Output

2014-04-12 18:52:34.889 iOS-Tutorial[1290:a0b] (
    AD,
    AE,
    AF,
    AG,
    AI,
    AL,
    AM,
    AO,
    AQ,
    AR,
    AS,
    AT,
    AU,
    AW,
    AX,
    AZ,
    BA,
    BB,
    BD,
    BE,
    BF,
    BG,
    BH,
    BI,
    BJ,
    BL,
    BM,
    BN,
    BO,
    BQ,
    BR,
    BS,
    BT,
    BV,
    BW,
    BY,
    BZ,
    CA,
    CC,
    CD,
    CF,
    CG,
    CH,
    CI,
    CK,
    CL,
    CM,
    CN,
    CO,
    CR,
    CU,
    CV,
    CW,
    CX,
    CY,
    CZ,
    DE,
    DJ,
    DK,
    DM,
    DO,
    DZ,
    EC,
    EE,
    EG,
    EH,
    ER,
    ES,
    ET,
    FI,
    FJ,
    FK,
    FM,
    FO,
    FR,
    GA,
    GB,
    GD,
    GE,
    GF,
    GG,
    GH,
    GI,
    GL,
    GM,
    GN,
    GP,
    GQ,
    GR,
    GS,
    GT,
    GU,
    GW,
    GY,
    HK,
    HM,
    HN,
    HR,
    HT,
    HU,
    ID,
    IE,
    IL,
    IM,
    IN,
    IO,
    IQ,
    IR,
    IS,
    IT,
    JE,
    JM,
    JO,
    JP,
    KE,
    KG,
    KH,
    KI,
    KM,
    KN,
    KP,
    KR,
    KW,
    KY,
    KZ,
    LA,
    LB,
    LC,
    LI,
    LK,
    LR,
    LS,
    LT,
    LU,
    LV,
    LY,
    MA,
    MC,
    MD,
    ME,
    MF,
    MG,
    MH,
    MK,
    ML,
    MM,
    MN,
    MO,
    MP,
    MQ,
    MR,
    MS,
    MT,
    MU,
    MV,
    MW,
    MX,
    MY,
    MZ,
    NA,
    NC,
    NE,
    NF,
    NG,
    NI,
    NL,
    NO,
    NP,
    NR,
    NU,
    NZ,
    OM,
    PA,
    PE,
    PF,
    PG,
    PH,
    PK,
    PL,
    PM,
    PN,
    PR,
    PS,
    PT,
    PW,
    PY,
    QA,
    RE,
    RO,
    RS,
    RU,
    RW,
    SA,
    SB,
    SC,
    SD,
    SE,
    SG,
    SH,
    SI,
    SJ,
    SK,
    SL,
    SM,
    SN,
    SO,
    SR,
    SS,
    ST,
    SV,
    SX,
    SY,
    SZ,
    TC,
    TD,
    TF,
    TG,
    TH,
    TJ,
    TK,
    TL,
    TM,
    TN,
    TO,
    TR,
    TT,
    TV,
    TW,
    TZ,
    UA,
    UG,
    UM,
    US,
    UY,
    UZ,
    VA,
    VC,
    VE,
    VG,
    VI,
    VN,
    VU,
    WF,
    WS,
    YE,
    YT,
    ZA,
    ZM,
    ZW
)
		

+ ISOCurrencyCodes

Returns an array of NSString objects that represents all known legal ISO currency codes.

Example

NSLog(@"%@",[NSLocale ISOCurrencyCodes]);
		

Output

2014-04-12 18:53:04.461 iOS-Tutorial[1303:a0b] (
    ADP,
    AED,
    AFA,
    AFN,
    ALK,
    ALL,
    AMD,
    ANG,
    AOA,
    AOK,
    AON,
    AOR,
    ARA,
    ARL,
    ARM,
    ARP,
    ARS,
    ATS,
    AUD,
    AWG,
    AZM,
    AZN,
    BAD,
    BAM,
    BAN,
    BBD,
    BDT,
    BEC,
    BEF,
    BEL,
    BGL,
    BGM,
    BGN,
    BGO,
    BHD,
    BIF,
    BMD,
    BND,
    BOB,
    BOL,
    BOP,
    BOV,
    BRB,
    BRC,
    BRE,
    BRL,
    BRN,
    BRR,
    BRZ,
    BSD,
    BTN,
    BUK,
    BWP,
    BYB,
    BYR,
    BZD,
    CAD,
    CDF,
    CHE,
    CHF,
    CHW,
    CLE,
    CLF,
    CLP,
    CNX,
    CNY,
    COP,
    COU,
    CRC,
    CSD,
    CSK,
    CUC,
    CUP,
    CVE,
    CYP,
    CZK,
    DDM,
    DEM,
    DJF,
    DKK,
    DOP,
    DZD,
    ECS,
    ECV,
    EEK,
    EGP,
    EQE,
    ERN,
    ESA,
    ESB,
    ESP,
    ETB,
    EUR,
    FIM,
    FJD,
    FKP,
    FRF,
    GBP,
    GEK,
    GEL,
    GHC,
    GHS,
    GIP,
    GMD,
    GNF,
    GNS,
    GQE,
    GRD,
    GTQ,
    GWE,
    GWP,
    GYD,
    HKD,
    HNL,
    HRD,
    HRK,
    HTG,
    HUF,
    IDR,
    IEP,
    ILP,
    ILR,
    ILS,
    INR,
    IQD,
    IRR,
    ISJ,
    ISK,
    ITL,
    JMD,
    JOD,
    JPY,
    KES,
    KGS,
    KHR,
    KMF,
    KPW,
    KRH,
    KRO,
    KRW,
    KWD,
    KYD,
    KZT,
    LAK,
    LBP,
    LKR,
    LRD,
    LSL,
    LSM,
    LTL,
    LTT,
    LUC,
    LUF,
    LUL,
    LVL,
    LVR,
    LYD,
    MAD,
    MAF,
    MCF,
    MDC,
    MDL,
    MGA,
    MGF,
    MKD,
    MKN,
    MLF,
    MMK,
    MNT,
    MOP,
    MRO,
    MTL,
    MTP,
    MUR,
    MVP,
    MVR,
    MWK,
    MXN,
    MXP,
    MXV,
    MYR,
    MZE,
    MZM,
    MZN,
    NAD,
    NGN,
    NIC,
    NIO,
    NLG,
    NOK,
    NPR,
    NZD,
    OMR,
    PAB,
    PEI,
    PEN,
    PES,
    PGK,
    PHP,
    PKR,
    PLN,
    PLZ,
    PTE,
    PYG,
    QAR,
    RHD,
    ROL,
    RON,
    RSD,
    RUB,
    RUR,
    RWF,
    SAR,
    SBD,
    SCR,
    SDD,
    SDG,
    SDP,
    SEK,
    SGD,
    SHP,
    SIT,
    SKK,
    SLL,
    SOS,
    SRD,
    SRG,
    SSP,
    STD,
    SUR,
    SVC,
    SYP,
    SZL,
    THB,
    TJR,
    TJS,
    TMM,
    TMT,
    TND,
    TOP,
    TPE,
    TRL,
    TRY,
    TTD,
    TWD,
    TZS,
    UAH,
    UAK,
    UGS,
    UGX,
    USD,
    USN,
    USS,
    UYI,
    UYP,
    UYU,
    UZS,
    VEB,
    VEF,
    VND,
    VNN,
    VUV,
    WST,
    XAF,
    XAG,
    XAU,
    XBA,
    XBB,
    XBC,
    XBD,
    XCD,
    XDR,
    XEU,
    XFO,
    XFU,
    XOF,
    XPD,
    XPF,
    XPT,
    XRE,
    XSU,
    XTS,
    XUA,
    XXX,
    YDD,
    YER,
    YUD,
    YUM,
    YUN,
    YUR,
    ZAL,
    ZAR,
    ZMK,
    ZMW,
    ZRN,
    ZRZ,
    ZWL,
    ZWR,
    ZWD
)
		

+ ISOLanguageCodes

Returns an array of NSString objects that represents all known legal ISO language codes.

Example

NSLog(@"%@",[NSLocale ISOLanguageCodes]);
		

Output

2014-04-12 18:53:33.619 iOS-Tutorial[1315:a0b] (
    aa,
    ab,
    ace,
    ach,
    ada,
    ady,
    ae,
    af,
    afa,
    afh,
    agq,
    ain,
    ak,
    akk,
    ale,
    alg,
    alt,
    am,
    an,
    ang,
    anp,
    apa,
    ar,
    arc,
    arn,
    arp,
    art,
    arw,
    as,
    asa,
    ast,
    ath,
    aus,
    av,
    awa,
    ay,
    az,
    ba,
    bad,
    bai,
    bal,
    ban,
    bas,
    bat,
    bax,
    bbj,
    be,
    bej,
    bem,
    ber,
    bez,
    bfd,
    bg,
    bh,
    bho,
    bi,
    bik,
    bin,
    bkm,
    bla,
    bm,
    bn,
    bnt,
    bo,
    br,
    bra,
    brx,
    bs,
    bss,
    btk,
    bua,
    bug,
    bum,
    byn,
    byv,
    ca,
    cad,
    cai,
    car,
    cau,
    cay,
    cch,
    ce,
    ceb,
    cel,
    cgg,
    ch,
    chb,
    chg,
    chk,
    chm,
    chn,
    cho,
    chp,
    chr,
    chy,
    ckb,
    cmc,
    co,
    cop,
    cpe,
    cpf,
    cpp,
    cr,
    crh,
    crp,
    cs,
    csb,
    cu,
    cus,
    cv,
    cy,
    da,
    dak,
    dar,
    dav,
    day,
    de,
    del,
    den,
    dgr,
    din,
    dje,
    doi,
    dra,
    dsb,
    dua,
    dum,
    dv,
    dyo,
    dyu,
    dz,
    dzg,
    ebu,
    ee,
    efi,
    egy,
    eka,
    el,
    elx,
    en,
    enm,
    eo,
    es,
    et,
    eu,
    ewo,
    fa,
    fan,
    fat,
    ff,
    fi,
    fil,
    fiu,
    fj,
    fo,
    fon,
    fr,
    frm,
    fro,
    frr,
    frs,
    fur,
    fy,
    ga,
    gaa,
    gay,
    gba,
    gd,
    gem,
    gez,
    gil,
    gl,
    gmh,
    gn,
    goh,
    gon,
    gor,
    got,
    grb,
    grc,
    gsw,
    gu,
    guz,
    gv,
    gwi,
    ha,
    hai,
    haw,
    he,
    hi,
    hil,
    him,
    hit,
    hmn,
    ho,
    hr,
    hsb,
    ht,
    hu,
    hup,
    hy,
    hz,
    ia,
    iba,
    ibb,
    id,
    ie,
    ig,
    ii,
    ijo,
    ik,
    ilo,
    inc,
    ine,
    inh,
    io,
    ira,
    iro,
    is,
    it,
    iu,
    ja,
    jbo,
    jgo,
    jmc,
    jpr,
    jrb,
    jv,
    ka,
    kaa,
    kab,
    kac,
    kaj,
    kam,
    kar,
    kaw,
    kbd,
    kbl,
    kcg,
    kde,
    kea,
    kfo,
    kg,
    kha,
    khi,
    kho,
    khq,
    ki,
    kj,
    kk,
    kkj,
    kl,
    kln,
    km,
    kmb,
    kn,
    ko,
    kok,
    kos,
    kpe,
    kr,
    krc,
    krl,
    kro,
    kru,
    ks,
    ksb,
    ksf,
    ksh,
    ku,
    kum,
    kut,
    kv,
    kw,
    ky,
    la,
    lad,
    lag,
    lah,
    lam,
    lb,
    lez,
    lg,
    li,
    lkt,
    ln,
    lo,
    lol,
    loz,
    lt,
    lu,
    lua,
    lui,
    lun,
    luo,
    lus,
    luy,
    lv,
    mad,
    maf,
    mag,
    mai,
    mak,
    man,
    map,
    mas,
    mde,
    mdf,
    mdr,
    men,
    mer,
    mfe,
    mg,
    mga,
    mgh,
    mgo,
    mh,
    mi,
    mic,
    min,
    mis,
    mk,
    mkh,
    ml,
    mn,
    mnc,
    mni,
    mno,
    mo,
    moh,
    mos,
    mr,
    ms,
    mt,
    mua,
    mul,
    mun,
    mus,
    mwl,
    mwr,
    my,
    mye,
    myn,
    myv,
    na,
    nah,
    nai,
    nap,
    naq,
    nb,
    nd,
    nds,
    ne,
    new,
    ng,
    nia,
    nic,
    niu,
    nl,
    nmg,
    nn,
    nnh,
    no,
    nog,
    non,
    nqo,
    nr,
    nso,
    nub,
    nus,
    nv,
    nwc,
    ny,
    nym,
    nyn,
    nyo,
    nzi,
    oc,
    oj,
    om,
    or,
    os,
    osa,
    ota,
    oto,
    pa,
    paa,
    pag,
    pal,
    pam,
    pap,
    pau,
    peo,
    phi,
    phn,
    pi,
    pl,
    pon,
    pra,
    pro,
    ps,
    pt,
    qu,
    raj,
    rap,
    rar,
    rm,
    rn,
    ro,
    roa,
    rof,
    rom,
    ru,
    rup,
    rw,
    rwk,
    sa,
    sad,
    sah,
    sai,
    sal,
    sam,
    saq,
    sas,
    sat,
    sba,
    sbp,
    sc,
    scn,
    sco,
    sd,
    se,
    see,
    seh,
    sel,
    sem,
    ses,
    sg,
    sga,
    sgn,
    shi,
    shn,
    shu,
    si,
    sid,
    sio,
    sit,
    sk,
    sl,
    sla,
    sm,
    sma,
    smi,
    smj,
    smn,
    sms,
    sn,
    snk,
    so,
    sog,
    son,
    sq,
    sr,
    srn,
    srr,
    ss,
    ssa,
    ssy,
    st,
    su,
    suk,
    sus,
    sux,
    sv,
    sw,
    swb,
    swc,
    syc,
    syr,
    ta,
    tai,
    te,
    tem,
    teo,
    ter,
    tet,
    tg,
    th,
    ti,
    tig,
    tiv,
    tk,
    tkl,
    tl,
    tlh,
    tli,
    tmh,
    tn,
    to,
    tog,
    tpi,
    tr,
    trv,
    ts,
    tsi,
    tt,
    tum,
    tup,
    tut,
    tvl,
    tw,
    twq,
    ty,
    tyv,
    tzm,
    udm,
    ug,
    uga,
    uk,
    umb,
    und,
    ur,
    uz,
    vai,
    ve,
    vi,
    vo,
    vot,
    vun,
    wa,
    wae,
    wak,
    wal,
    war,
    was,
    wen,
    wo,
    xal,
    xh,
    xog,
    yao,
    yap,
    yav,
    ybb,
    yi,
    yo,
    ypk,
    yue,
    za,
    zap,
    zbl,
    zen,
    zh,
    znd,
    zu,
    zun,
    zxx,
    zza
)
		

+ commonISOCurrencyCodes

Returns an array of common ISO currency codes

Converting Between Identifiers

+ canonicalLocaleIdentifierFromString:

Returns the canonical identifier for a given locale identification string.

Example

NSLog(@"%@",[NSLocale commonISOCurrencyCodes]);
		

Output

2014-04-12 18:55:30.609 iOS-Tutorial[1329:a0b] (
    AED,
    AFN,
    ALL,
    AMD,
    ANG,
    AOA,
    ARS,
    AUD,
    AWG,
    AZN,
    BAM,
    BBD,
    BDT,
    BGN,
    BHD,
    BIF,
    BMD,
    BND,
    BOB,
    BRL,
    BSD,
    BTN,
    BWP,
    BYR,
    BZD,
    CAD,
    CDF,
    CHF,
    CLP,
    CNY,
    COP,
    CRC,
    CUC,
    CUP,
    CVE,
    CZK,
    DJF,
    DKK,
    DOP,
    DZD,
    EGP,
    ERN,
    ETB,
    EUR,
    FJD,
    FKP,
    GBP,
    GEL,
    GHS,
    GIP,
    GMD,
    GNF,
    GTQ,
    GWP,
    GYD,
    HKD,
    HNL,
    HRK,
    HTG,
    HUF,
    IDR,
    ILS,
    INR,
    IQD,
    IRR,
    ISK,
    JMD,
    JOD,
    JPY,
    KES,
    KGS,
    KHR,
    KMF,
    KPW,
    KRW,
    KWD,
    KYD,
    KZT,
    LAK,
    LBP,
    LKR,
    LRD,
    LSL,
    LTL,
    LVL,
    LYD,
    MAD,
    MDL,
    MGA,
    MKD,
    MMK,
    MNT,
    MOP,
    MRO,
    MUR,
    MVR,
    MWK,
    MXN,
    MYR,
    MZE,
    MZN,
    NAD,
    NGN,
    NIO,
    NOK,
    NPR,
    NZD,
    OMR,
    PAB,
    PEN,
    PGK,
    PHP,
    PKR,
    PLN,
    PYG,
    QAR,
    RON,
    RSD,
    RUB,
    RWF,
    SAR,
    SBD,
    SCR,
    SDG,
    SEK,
    SGD,
    SHP,
    SKK,
    SLL,
    SOS,
    SRD,
    SSP,
    STD,
    SVC,
    SYP,
    SZL,
    THB,
    TJS,
    TMT,
    TND,
    TOP,
    TRY,
    TTD,
    TWD,
    TZS,
    UAH,
    UGX,
    USD,
    UYU,
    UZS,
    VEF,
    VND,
    VUV,
    WST,
    XAF,
    XCD,
    XOF,
    XPF,
    YER,
    ZAR,
    ZMW
)
		

+ componentsFromLocaleIdentifier:

Returns a dictionary that is the result of parsing a locale ID.

Example

NSLog(@"%@",[NSLocale componentsFromLocaleIdentifier:@"en_US"]);
		

Output

2014-04-12 19:04:58.222 iOS-Tutorial[1459:a0b] {
    kCFLocaleCountryCodeKey = US;
    kCFLocaleLanguageCodeKey = en;
}
		

+ localeIdentifierFromComponents:

Returns a locale identifier from the components specified in a given dictionary.

Example

NSLog(@"%@",[NSLocale localeIdentifierFromComponents:@{@"kCFLocaleCountryCodeKey" : @"US",@"kCFLocaleLanguageCodeKey" :@"en"}]);
		

Output

2014-04-12 19:07:58.044 iOS-Tutorial[1496:a0b] en_US
		

+ canonicalLanguageIdentifierFromString:

Returns a canonical language identifier by mapping an arbitrary locale identification string to the canonical identifier.

Example

NSLog(@"%@",[NSLocale canonicalLanguageIdentifierFromString:@"en_US"]);
		

Output

2014-04-12 19:08:43.992 iOS-Tutorial[1508:a0b] en-US
		

+ localeIdentifierFromWindowsLocaleCode:

Returns a locale identifier from a Windows locale code.

Example

NSLog(@"%@",[NSLocale localeIdentifierFromWindowsLocaleCode:1033]);
		

Output

2014-04-12 19:11:46.200 iOS-Tutorial[1560:a0b] en_US
		

+ windowsLocaleCodeFromLocaleIdentifier:

Returns a Window locale code from the locale identifier.

Example

NSLog(@"%u",[NSLocale windowsLocaleCodeFromLocaleIdentifier:@"en_US"]);
		

Output

NSLog(@"%u",[NSLocale windowsLocaleCodeFromLocaleIdentifier:@"en_US"]);
		

Getting Preferred Languages

+ preferredLanguages

Returns the user's language preference order as an array of strings.

Example

NSLog(@"%@",[NSLocale preferredLanguages]);
		

Output

2014-04-12 19:12:18.463 iOS-Tutorial[1572:a0b] (
    en,
    fr,
    de,
    "zh-Hans",
    "zh-Hant",
    ja,
    nl,
    it,
    es,
    "es-MX",
    ko,
    pt,
    "pt-PT",
    da,
    fi,
    nb,
    sv,
    ru,
    pl,
    tr,
    uk,
    ar,
    hr,
    cs,
    el,
    he,
    ro,
    sk,
    th,
    id,
    ms,
    "en-GB",
    "en-AU",
    ca,
    hu,
    vi
)
		

Getting Line and Character Direction For a Language

+ characterDirectionForLanguage:

Returns the character direction for the specified ISO language code.

Example

NSLog(@"%d",[NSLocale characterDirectionForLanguage:@"fr"]);
		

Output

2014-04-12 19:13:46.319 iOS-Tutorial[1584:a0b] 1
		

+ lineDirectionForLanguage:

Returns the line direction for the specified ISO language code.

Example

NSLog(@"%d",[NSLocale lineDirectionForLanguage:@"fr"]);
		

Output

2014-04-12 19:14:56.484 iOS-Tutorial[1606:a0b] 3
		

Advertisements