As you might know the iOS 8 requires NSLocationWhenInUseUsageDescription key for using user's location. I have added this key and some general information into my info plist.
如何在 plist 文件中使用翻译字符串?
- 更新 -
我已经有一个可本地化的字符串。我只是想知道我可以使用类似的东西吗
plist 字符串内的 NSLocalizedString(MYSTRING,nil) 。我知道我可以创建多个 info.plist 文件进行本地化,但我想知道可能有更简单的方法。
你应该使用InfoPlist.strings
文件(同时保留I
& P
资本)来本地化价值Info.plist
。要执行此操作,请转至File->New->File
, 选择Strings File
under Resource
tab of iOS
,命名它InfoPlist
,并创建。打开并插入Info.plist
您想要本地化的值,例如:
"NSLocationWhenInUseUsageDescription" = "Description of this";
现在您可以本地化InfoPlist.strings
带有翻译的文件。
选择本地化选项,或根据需要启用本地化,
您还应该能够在左侧编辑器中看到该文件。
NOTE:在模拟器上测试本地化时。您必须更改模拟器本身的语言,而不仅仅是 Xcode 目标中的语言。 (Credits to 约翰·韦伯 https://stackoverflow.com/users/1265051/john-webb)
Here https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html是官方文档Info.plist
键本地化。
Credits to Marco https://stackoverflow.com/users/295130/marco,感谢您在此答案中包含图片!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)