use*_*579 65 localization xcode4
如何在XCode 4中定义本地化字符串?
我假设我可以使用"Localization"属性(文件检查器,右侧面板)向InfoPlist.strings添加语言.
...然后在每个本地化版本中键入"key"="value".
但我无法建立这个项目.我收到这个错误: -
复制.strings文件错误验证失败:无法读取数据,因为它已损坏.
将文本编码转换为UTF 16不能解决问题.也没有退出Xcode并再次启动它.
问题1:如何解决这些构建错误?
通过一些侥幸,我曾经设法让一个测试应用程序运行添加InfoPlist.strings(法语)和(英语).我没有在法语字符串文件中得到错误,但我使用了英语.所以我单独留下了英文版,只是在法文版中加了一个参数.但是,在模拟器中,设置为法语 - 未选取参数.它恢复为NSLocalizedString()中指定的默认值
Q2:即使修复了构建错误,我如何使其工作?
Tom*_*Tom 98
我有同样的问题找到本地化文件中的错误...
只需使用终端中的工具plutil转换文件,您将收到包含行号的正确错误消息.
plutil -lint Localizable.strings
响应
plutil [74058:707] CFPropertyListCreateFromXMLData():旧式plist解析器:在422行的字典中缺少分号.解析将被放弃.打破_CFPropertyListMissingSemicolon进行调试.Localizable.strings:第1行的"意外字符"
bri*_*ear 14
是的只是翻译了500翻译
请注意第二个字符串中的KISS是双引号,这是另一个双引号错误
"Before using KISS Remixer, you must agree to the terms and conditions of use." = "Vor der Nutzung des Remixers "KISS" müssen Sie die Allgemeinen Geschäftsbedingungen akzeptieren.";
Run Code Online (Sandbox Code Playgroud)
还行吧
"Before using KISS Remixer, you must agree to the terms and conditions of use." = "Vor der Nutzung des Remixers KISS müssen Sie die Allgemeinen Geschäftsbedingungen akzeptieren.";
Run Code Online (Sandbox Code Playgroud)
就是这样(用单引号替换INSIDE THE DOUBLE)
"Before using KISS Remixer, you must agree to the terms and conditions of use." = "Vor der Nutzung des Remixers 'KISS' müssen Sie die Allgemeinen Geschäftsbedingungen akzeptieren.";
Run Code Online (Sandbox Code Playgroud)
提示使用二进制搜索来查找违规行.
UTF-16 Little Endian将其更改为'UTF-16'10.清理构建/构建相同错误
文件中的某个地方是
/* popup message */
"Save mix" = "Enregistrer le mixage";
/* popup message */
"Save mix" = "Enregistrer le mixage"
Run Code Online (Sandbox Code Playgroud)
错误
/* popup message */
"Save mix" = "Enregistrer le "mix" age"
Run Code Online (Sandbox Code Playgroud)
对
/* popup message */
"Save mix" = "Enregistrer le mixage"
Run Code Online (Sandbox Code Playgroud)
还有权利
/* popup message */
"Save mix" = "Enregistrer le 'mix'age"
Run Code Online (Sandbox Code Playgroud)
检查文件编码.这通常是由扩展字符(如重音字符)和非UTF编码引起的.特别是在XCode 4中有一个错误,如果你将重音字符复制到Safari的字符串文件中,它将保存为Western Mac OS Roman.
令人遗憾的是,XCode的语法检查程序无法解决这个问题.
您还可以将文本复制到Text Wrangler(我从翻译器接收文件后执行的操作)以检查正确引用的字符串或运行正则表达式检查分号.Text Wrangler中的语法着色将显示错误引用(或错误转义)的字符串,其中XCode的字符串编辑器当前不会.
在我的情况下,plutil -lint Localizable.strings这没有帮助,因为Unexpected character " at line 1当真正的错误是a ”而不是"在线2340 时,它产生的错误消息是“ ” 。