Localizable.strings causing plist parsing error

2019-01-26 06:05发布

问题:

I have just localized the file Localizable.strings in my Xcode project in order to localise my application to a few different languages. However, having edited each of the files in the standard "key = value" format, I receive the following parsing error, which does not specify a file making it hard to track down what it is referring to.

CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 10. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.

I have looked through each of the *.strings files, specifically on line 10, and I found nothing of any interest or regards as to what is causing the issue. Please can you tell me where I am going wrong.

Here is a sample of a Localizable.strings file in my project. All other files follow the same format.

"Enter URL" = "Voer adres in"
"Headers" = "Koppen"
"Key" = "sleutel"
"Value" = "waarde"
"Parameters" = "Parameters"
"Tap to add a new line" = "Tik om een nieuwe lijn toe te voegen"
"Perform request" = "Verzoek Uitvoeren"
"Response" = "Antwoord"
"Received Headers" = "Ontvangen Koppen"
"Error" = "Fout"
"Loading" = "Verzoek aan het versturen"

I then use NSLocalizedString() to provide the translated string.

回答1:

As stated in the error message, you're missing semicolons at the end of each line.

"foo" = "bar";

Is the correct format



回答2:

This message can also be come due to use of :(colon) instead of ;(semicolon) at line end. Please be sure there is semicolon(;) at each end of line and also there is no colon(:) also.



回答3:

"Enter URL" = "Voer adres in";
"Headers" = "Koppen";
"Key" = "sleutel";
"Value" = "waarde";
"Parameters" = "Parameters";
"Tap to add a new line" = "Tik om een nieuwe lijn toe te voegen";
"Perform request" = "Verzoek Uitvoeren";
"Response" = "Antwoord";
"Received Headers" = "Ontvangen Koppen";
"Error" = "Fout";
"Loading" = "Verzoek aan het versturen";

this is the correct formula