ibtool
is the tool to extract strings from XIB files. Example command:
find . -name \*.xib | xargs -t -I '{}' ibtool --generate-strings-file '{}'.strings.txt '{}'
But output generated by ibtool is NOT READABLE for 'normal' (read: non-developers) human being.
Example:
/* Class = "IBUILabel"; text = "Regards:"; ObjectID = "201"; */
"201.text" = "Regards:";
There are few problems with it (from the perspective of translator);
I need XIB strings extracted in Localizable.strings
format (strings extracted from NSLocalizableString macros using genstrings
:
"key"="to translate";
It there a way to make ibtool output text this way?
I wrote my own script in bash, which does the following:
NSLocalizableString
macro). "text to translate"="text to translate";
It can be used directly by your translator.Only right side, text in quotes after = needs to be edited.Script is not perfect but it works quite well.
It has a bit too long to past it here (90 lines), so here is the direct GitHub link: