Paulo Rodrigues
Paulo Rodrigues

Reputation: 5303

Localizable.strings corrupted?

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.

Upvotes: 29

Views: 15430

Answers (7)

Chintan Shah
Chintan Shah

Reputation: 1764

There can be multiple reasons for this:

  1. Semicolon is missing at the end.
  2. Multiple semicolons at the end.
  3. " within the message which should be escaped by \".
  4. Extra character after semicolon.
  5. Invalid white space in the file.
  6. Other invalid characters in the file.
  7. Merge conflict characters in the file!

<<<<<<< HEAD, ======= and >>>>>>>.

Please note that plutil -lint Localizable.strings returned OK for point-2 & 7!

Upvotes: 0

Nicolas Miari
Nicolas Miari

Reputation: 16246

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)

Upvotes: 4

pre
pre

Reputation: 3506

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

"Test locale" = "Test locale";

Upvotes: 58

Carles Estevadeordal
Carles Estevadeordal

Reputation: 1229

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

https://github.com/CarlesEstevadeordal/check_strings

Upvotes: 0

lucianoenrico
lucianoenrico

Reputation: 1494

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.

Upvotes: 45

StuckOverFlow
StuckOverFlow

Reputation: 891

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

https://github.com/dcordero/Rubustrings

Upvotes: 7

Shmidt
Shmidt

Reputation: 16664

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

Upvotes: 1

Related Questions