I am looking for a way of extracting all localizable strings from .xib
files and have all of them saved in a single file.
Probably this involves ibtool
but I was not able to determine a way of merging all these in only one translation dictionary (could be .strings
, .plist
or something else).
Open terminal and cd to the root directory of the project (or directory where you store all XIB files) and type in this command:
find . -name \*.xib | xargs -t -I '{}' ibtool --generate-strings-file '{}'.txt '{}'
The magic is the find and xargs commands working together. -I option generates placeholder. -t is just for verbose output (you see what commands has been generated and executed). It generates txts files with the same name as xib files in the same directory. This command can be improved to concatenate output into one file but still is a good starting point.
Joining them together:
You can concatenate those freshly created files into one using similar terminal command:
find . -name \*.xib.txt | xargs -t -I '{}' cat '{}' > ./xib-strings-concatenated.txt
This command will put all strings into one file xib-strings-concatenated.txt in root directory.
You can delete generated partial files (if you want) using find and xargs again:
find . -name \*.xib.txt | xargs -t -I '{}' rm -f '{}'
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