且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用非英语语言将国家/地区代码转换为设备上的国家/地区名称

更新时间:2023-10-10 15:48:46

这是希伯来语,意思是像argntynhe或argntynhe左右。 (不幸的是我不会说任何希伯来语。只是将unicode转换为有意义的东西。)

It is Hebrew and means something like argntynhe or argntynhe or so. (Unfortunately I do not speak any Hebrew. Just converted the unicode to something meaningful.)

检查设备的语言设置或用于初始化你的语言环境标识符语言环境。

Check the language settings of your device or the locale identifier that you used to initialize your locale with.

试试这个。

NSLocale myLocale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
NSString *country = [myLocale displayNameForKey: NSLocaleIdentifier value: identifier];

我对常量@en_US并不乐观;我把它从头顶中取出来了。只需谷歌获取适当的价值。

I am just not positive about the constant @"en_US"; I took that out of the top of my head. Just google for an appropriate value.

更多文档:
https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/classes/NSLocale_Class/Reference/Reference.html