How to check the iPhone language settings?

心不动则不痛 提交于 2019-12-13 15:29:50

问题


I'm localizing my app which is cocos2d so there are no nib files, I'm localizing a label which is fine but want to check the device language to set an exact font and font size for each language. In short I want to do it as the following:

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

How to check that the device language/settings is set to an exact language?


回答1:


You can use:

[[NSLocale preferredLanguages] objectAtIndex:0]

This will return a language tag like “en” or “ja”.



来源:https://stackoverflow.com/questions/10898935/how-to-check-the-iphone-language-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!