开发Mac应用程序时是否可以在不同本地化之间切换?
我正在 Mac OS X 中开发一个应用程序。为了使该应用程序更易于访问,我使用不同的 XIB 和字符串文件对其进行了本地化。由于不同语言的字符串长度可能不同,为了确保我没有忘记字符串,我有以下问题:
在开发此应用程序时是否可以切换到不同的语言?我知道我可以设置整个系统的语言并注销并重新登录,但这对于快速检查来说有点麻烦。
是否可以设置一些 Info.plist
键?
I am developing an application in Mac OS X. To make the application more accessible I localized it using different XIB and strings file. As the strings in different languages can be different in length and to make sure I have not forgotten a string I have the following question:
Is it possible to switch to a different language when developing this application? I know I can set the language for the whole system and log out and back in but that is a bit cumbersome for a quick check.
Is there maybe some Info.plist
key one can set?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需注销。系统偏好设置中的语言设置适用于任何随后启动的应用程序,因此您所要做的就是更改语言,退出应用程序并重新打开它。
您还可以通过将
AppleLanguages
键添加到应用程序的默认值来永久更改给定应用程序将使用的语言。有关其值的示例,您可以在全局域中查找该键,这是系统偏好设置设置的(使用defaults read NSGlobalDomain AppleLanguages
)。这样,您甚至可以制作一个脚本来循环测试所有语言。There is no need to logout. The language setting in System Preferences applies to any subsequently launched applications, so all you have to do is change the language, quit your application and reopen it.
You can also permanently change the language that will be used by a given application by adding the
AppleLanguages
key to the application's defaults. For an example of its value, you can look for that key in the global domain, which is what System Preferences set (usedefaults read NSGlobalDomain AppleLanguages
). This way, you can even make a script that lets you test all languages in a loop.