xcode Localizable.strings 损坏?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10181291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Localizable.strings corrupted?
提问by Paulo Rodrigues
I'm trying to include the internationalization of my application, and only for testing purposes I added a simple line in the file Localizable.string.
我正在尝试包括我的应用程序的国际化,并且仅出于测试目的,我在文件 Localizable.string 中添加了一个简单的行。
This is my whole file:
这是我的整个文件:
"Test locale" = "Test locale"
“测试语言环境”=“测试语言环境”
And when I try run my application I get this error:
当我尝试运行我的应用程序时,我收到此错误:
Localizable.strings:0: error: validation failed: The data couldn't be read because it has been corrupted.
Localizable.strings:0: 错误: 验证失败: 无法读取数据,因为它已损坏。
I've tried changing the "Text Encoding" to UTF-16 but nothing resolved.
我试过将“文本编码”更改为 UTF-16,但没有解决。
Any ideia?
任何想法?
Thanks in advance.
提前致谢。
回答by pre
If this is your whole file, add a semicolon at the end. Change it to:
如果这是您的整个文件,请在末尾添加分号。将其更改为:
"Test locale" = "Test locale";
"测试语言环境" = "测试语言环境" ;
回答by lucianoenrico
To get more detailed informations you can use the Property List utility from the command line:
要获取更多详细信息,您可以从命令行使用属性列表实用程序:
plutil -lint <your_strings_file>.strings
the -lint
switch is for checking the syntax. If you have an error you'll get line number and more informations, and in general better directions on how to fix the issue.
该 -lint
开关用于检查语法。如果您有错误,您将获得行号和更多信息,以及关于如何解决问题的更好的指导。
回答by StuckOverFlow
You can verify your Localizable.strings file with this script:
您可以使用以下脚本验证 Localizable.strings 文件:
回答by Nicolas Miari
In my case, it was like this:
就我而言,它是这样的:
/* Comment for Very Long Sentence */
"Very Long Sentence Very Long Sentence Very Long Sentence Very Long Sentence " =;
"Very Long Sentence Very Long Sentence Very Long Sentence Very Long Sentence ";
(Notice the ' = ;' instead of ' =' at the end of the first line)
(注意第一行末尾的 ' = ;' 而不是 ' =')
Hope it helps someone...
希望它可以帮助某人...
回答by Shmidt
In my case it was brackets inside string — I needed to add slash before \".
就我而言,它是字符串内的括号——我需要在 \" 之前添加斜杠。
回答by Carles Estevadeordal
I've made a little script to check whole folders .strings files using plutil.
我制作了一个小脚本来使用 plutil 检查整个文件夹 .strings 文件。