iPhone/iOS:如何判断手机在运行时使用的本地化版本?
我在本地化应用程序时遇到了困难。它需要本地化为波斯语(伊朗波斯语)。不仅如此,当选择 fa_IR 作为本地化时,它还需要使用阳历。
该操作系统有一个波斯日历。我使用它没有问题,但我需要知道fa_IR本地化已被选择。雪上加霜的是,我无法在美国测试这个语言环境,因为 AT&T 似乎不允许将其作为本地化。我必须把它寄到伊朗,这是皇家PItA。
我在运行时找出本地化真是太痛苦了。有很多用于访问捆绑标志的东西,但我找不到任何用于获取运行时信息的东西。
我对 iOS 编程非常陌生,所以我仍然需要确定 RTFM 的 M 。我一直在用很多关键字搜索文档,但无济于事。
任何人都可以帮忙解决这个看似简单得荒谬的问题吗?
I'm having a difficult time localizing an app. It needs to be localized into Farsi (Iranian Persian). Not only that, it needs to use the Solar Calendar, when fa_IR is selected as a localization.
The OS has a Persian calendar. It's no problem for me to use it, but I need to know that the fa_IR localization has been selected. To add insult to injury, I can't test this locale in the US, as it seems that AT&T doesn't allow it as a localization. I have to send it to Iran, which is a royal PItA.
I'm having the devil of a time finding out the localization at runtime. There's a bunch of stuff for accessing the bundle flags, but I can't find anything for getting runtime info.
I'm pretty damn green at iOS programming, so I still need to determine which M to RTFM. I've been searching the docs with many keywords, to no avail.
Can anyone help with what seems to be an absurdly easy question?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NSLocale
将包含您需要的区域设置信息。请注意,基础类支持建议的设置,例如 24 小时时钟和区域设置信息。
NSLocale
will have the locale information you need. Do note that foundation classes support suggested settings such as 24 hour clock and locale information.上面的代码应该有助于查找当前的本地化。
NSLocale
返回en_US
,而NSBundle
返回sv
,这对于我的手机来说是正确的。The above code should be helpful in finding the current localization.
NSLocale
returnsen_US
, whileNSBundle
returnssv
, which is correct for my phone.