Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I validate Localizable.strings file in Xcode?

How can I check if there are any errors in the file and where I am getting these errors? In the other words, How can I debug Localizable.strings file in Xcode ?

like image 235
Barış Özçelik Avatar asked Dec 02 '16 08:12

Barış Özçelik


People also ask

How do I add localizable strings to Xcode?

Choose File → New → File ..., select Strings File under Resources, and click Next. Name it Localizable, then click on Create.

How do you localize a string in Swift?

string file, select it and on the File Inspector (right menu) select “Localize”. Select your the new language you added and click on “Finish”. If you select the file again you should see something similar to the first image below (be sure to select both the supported languages).

What does it mean to localize a string?

Last modified: 06 October 2021. Internationalization (i18n) refers to the process of extracting strings from source code and presenting them as properties with a set of values. Localization (l10n) is the process of translating values of these properties into target languages.


1 Answers

Unfortunately, Xcode dosesn't show line with error. If you or another developer was changing Localisable.strings recently, probably one of added / changed lines is missing semicolon at end (see answer under this question: Localizable.strings corrupted? ). If file is big and / or error is not easy to see probably lucianoenrico answer will be helpful. I will quote it now:

To get more detailed informations you can use the Property List utility from the command line:

plutil -lint <your_strings_file>.strings

the -lint switch is for checking the syntax. If you have an error you'll get line number and more informations, and in general better directions on how to fix the issue.

If it is a semicolon issue you can also open corrupted file, search for ";" and look for line without highlighted ";" at end. Also look for block comments without closing "*/" and unescaped or incorrect quotation marks (need \"). This last issue is visible because part of string changes color.

like image 139
Adam Tucholski Avatar answered Nov 01 '22 23:11

Adam Tucholski