如何检查 iPhone 的语言设置?

Posted

技术标签:

【中文标题】如何检查 iPhone 的语言设置?【英文标题】:How to check the iPhone language settings? 【发布时间】:2012-06-05 14:10:27 【问题描述】:

我正在本地化我的应用程序 cocos2d,因此没有 nib 文件,我正在本地化一个标签,这很好,但想检查设备语言以为每种语言设置准确的字体和字体大小。简而言之,我想这样做:

If (device.language == en) 
Set font to "fontname" and "fontsize" to x;
 else 
set it to "another font name" and font size to y;

如何检查设备语言/设置是否设置为准确的语言?

【问题讨论】:

重复问题:***.com/questions/3910244/… 【参考方案1】:

你可以使用:

[[NSLocale preferredLanguages] objectAtIndex:0]

这将返回一个语言标签,如“en”或“ja”。

【讨论】:

非常感谢,正是我想要的 这不是真的,在 Apple 文档中有关于该方法的说明:// 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

以上是关于如何检查 iPhone 的语言设置?的主要内容,如果未能解决你的问题,请参考以下文章

iphone语言设置了韩文怎么改中文?

设置 iPhone 键盘语言

如何在 iPhone 上查看其他语言本地化?

ios最简单的多语言设置

如何将系统语言设置转移到钴

当用户在 iPhone App 的 UITextField 中输入值时,如何显示特定语言键盘?