Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localizable.strings - The data couldn’t be read because it isn’t in the correct format

If I copy something from textedit or web and paste it to localizable file it shows this compilation error. If I type those in localizable file it does not show any error. I am assuring you that I using the correct format and ';' in the file.

"New" = "New"; "In Progress" = "In Progress"; "Waiting" = "Waiting"; "Closed" = "Closed"; 
like image 605
Rashad Avatar asked Oct 25 '17 04:10

Rashad


People also ask

How do you make a string file localizable?

To add Localizable. strings file, go to File->New->File , choose Strings File under Resource tab of iOS, name it Localizable. strings , and create the file. Now, you have a Localizable.

How does NSLocalizedString work?

NSLocalizedString is a Foundation macro that returns a localized version of a string. It has two arguments: key , which uniquely identifies the string to be localized, and comment , a string that is used to provide sufficient context for accurate translation.

How do you perform localization in iOS Swift?

Click on iOS->App/Single View App->Next. Name your project and select the language as Swift. Select a desired location and click on Create. To start with Localization, click on your Project Name -> go to Info Tab -> Under Localizations, click on the '+' button.


1 Answers

  • Use plutil from the Terminal:

you have to run it for each version of the localizable file. E.g

  1. cd into your project root
  2. cd eb.lproj - you can replace this with any localisation you are working with.
  3. plutil -lint Localizable.strings

When you run step 3, you will either be shown an error, telling you what is wrong with your file. Or you will be told the file is OK

Note that plutil output is bad, it seems it always says "Unexpected character at line 1" but above that output, it prints other stuff like missing semicolon on line 121, and that is the real error

like image 111
bat Avatar answered Oct 06 '22 05:10

bat