Getting current device language in iOS?

前端 未结 30 2739
星月不相逢
星月不相逢 2020-11-22 09:10

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

30条回答
  •  悲&欢浪女
    2020-11-22 09:20

    This will probably give you what you want:

    NSLocale *locale = [NSLocale currentLocale];
    
    NSString *language = [locale displayNameForKey:NSLocaleIdentifier 
                                             value:[locale localeIdentifier]];
    

    It will show the name of the language, in the language itself. For example:

    Français (France)
    English (United States)
    

提交回复
热议问题