Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localised Strings Xcode 4 ... Copy .strings file Error Validation failed

How do I define localised strings in Xcode 4?

I assumed I could just add languages to InfoPlist.strings using the "Localization" property (File inspector, right panel).

...and then type in the "key" = "value"s in each localised version.

But I can't build the project. I get this error:

Copy .strings file Error Validation failed: The data couldn't be read because it has been corrupted.

Converting the text encoding to UTF 16 doesn't fix the problem. Neither does quitting Xcode and starting it again.

Q1: How do I remedy these build errors?

By some fluke, I did once manage to get a test app to run adding a InfoPlist.strings (French) and (English). I didn't get the error on the French strings file, but I did with the English. So I left the English one alone, and just put a parameter in the French one. However, in the simulator, set to French - the parameter wasn't picked up. It reverted to the default specified in NSLocalizedString()

Q2: How do I get it working even if the build errors are remedied?

like image 676
user433579 Avatar asked Apr 12 '11 12:04

user433579


2 Answers

Could be as simple as a missing semi-colon at the end of the line.

like image 107
Tyler A. Avatar answered Oct 13 '22 07:10

Tyler A.


I had same the issue finding the errors within the localization file...

Just use the tool plutil in the terminal to convert the file and you will get a proper error message with the line number.

plutil -lint Localizable.strings

Response

plutil[74058:707] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 422. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug. Localizable.strings: Unexpected character " at line 1

like image 34
TomTom Avatar answered Oct 13 '22 08:10

TomTom