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?
Could be as simple as a missing semi-colon at the end of the line.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With