简体   繁体   English

Xcode 6 - OS X本地化无法正常工作

[英]Xcode 6 – OS X Localization not working

I'm trying to localize Main.storyboard , localization doesn't work. 我正在尝试本地化Main.storyboard ,本地化不起作用。

I have files: 我有文件:

Main.storyboard |--Main.storyboard (Base) |--Main.strings (Russian) |--Main.strings (English)

In russian .strings file I wrote something like 在俄语.strings文件我写了类似的东西

/* Class = "NSButtonCell"; title = "rus-example"; ObjectID = "0XB-XT-cHW"; */
"0XB-XT-cHW.title" = "rus-example";

In Main.strings (English) (for the same button): Main.strings (English) (对于相同的按钮):

/* Class = "NSButtonCell"; title = "en-example"; ObjectID = "0XB-XT-cHW"; */
"0XB-XT-cHW.title" = "en-example";

When I run the app on English OS, I get the same result, when on Russian. 当我在英语操作系统上运行应用程序时,我得到的结果与俄语时相同。

I turned on "Show non-localized strings" feature in Xcode, it shows all strings as non-localized. 我在Xcode中启用了"Show non-localized strings"功能,它将所有字符串显示为非本地化。

How can I enable localization? 如何启用本地化?

A little late, but maybe someone else will come across this post: I had the same problem for my german localisation. 有点晚了,但也许有人会遇到这个帖子:我的德语本地化问题也有同样的问题。 Running 运行

plutil Main_iPhone.strings

did the trick for me. 为我做了诀窍。 It showed up the following output: 它显示以下输出:

Main_iPhone.strings: Unexpected character / at line 2

Even if this was a misleading error (the localisation file starts with a comment, that's ok), it pointed me in the right direction: there was something wrong with the localisation file itself. 即使这是一个误导性的错误(本地化文件以评论开头,也没关系),它指出了我正确的方向:本地化文件本身有问题。

Long story short: missing quotation mark or rather semicolon, but unfortunately you don't see this error within Xcode. 长话短说:缺少引号或者说是分号,但不幸的是你在Xcode中没有看到这个错误。

However, just run the plutil command on your localisation string files and check the output. 但是,只需在本地化字符串文件上运行plutil命令并检查输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM