Localizable.strings corrupted?

2020-05-21 09:09发布

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.

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.

I've tried changing the "Text Encoding" to UTF-16 but nothing resolved.

Any ideia?

Thanks in advance.

6条回答
我命由我不由天
2楼-- · 2020-05-21 09:13

You can verify your Localizable.strings file with this script:

https://github.com/dcordero/Rubustrings

查看更多
放荡不羁爱自由
3楼-- · 2020-05-21 09:14

If this is your whole file, add a semicolon at the end. Change it to:

"Test locale" = "Test locale";

查看更多
够拽才男人
4楼-- · 2020-05-21 09:20

I've made a little script to check whole folders .strings files using plutil.

https://github.com/CarlesEstevadeordal/check_strings

查看更多
Root(大扎)
5楼-- · 2020-05-21 09:22

In my case it was brackets inside string — I needed to add slash before \".

查看更多
别忘想泡老子
6楼-- · 2020-05-21 09:29

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...

查看更多
唯我独甜
7楼-- · 2020-05-21 09:37

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.

查看更多
登录 后发表回答