【问题标题】:How to check the iPhone language settings?如何检查 iPhone 的语言设置?
【发布时间】: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;
}

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

【问题讨论】:

标签: iphone ios cocos2d-iphone


【解决方案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
猜你喜欢
  • 2010-09-24
  • 1970-01-01
  • 2014-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多