Search code examples
localizationxcode4

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?


Solution

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