I'd like to start seeing how comprehensive we've been in our iOS code at localizing strings. We're not ready to go to translators yet, but I'd like to start testing with pseudo localization. Automating this process in a Localizable.strings file should be easy enough, but I can't seem to find any tools that do it. Frankly, I'd be satisfied with a script that just changed all my strings to "NOT ENGLISH!" if such a thing exists.
I came across two solutions that haven't yet been mentioned here:
A free app called on the Mac App store that generates pseudolocalized .strings files based on your source code (drag-and-drop). It generates similar strings to those the OP provided in the question.
https://itunes.apple.com/us/app/pseudolocalizer/id503026674?mt=12
The online translation service Babble-on offers free pseudolocalized .strings files based on existing .strings files (other options available). They have the extra option of generating strings longer than the original English to test your GUI.
http://www.ibabbleon.com/pseudolocalization.html
You can achieve this with the Translate Toolkit.
First you need to convert the .strings file to PO using the prop2po converter:
$ prop2po Localizable.strings en.po
This will create a PO file with the strings of the Localizable.strings file as source strings (in this case I'm using English as a source).
Once you have the PO file, rewrite it using podebug in the desired rewrite format.
$ podebug --rewrite=unicode en.po en_rewritten.po
Finally convert it back to the .strings format (note that you need to pass the original Localizable.strings file as a template):
$ po2prop en_rewritten.po rewritten.strings -t Localizable.strings
The resulting file will look something like this:
"Account: %@" = "Ȧƈƈǿŭƞŧ: %@";
"Add command" = "Ȧḓḓ ƈǿḿḿȧƞḓ";
"Add connection." = "Ȧḓḓ ƈǿƞƞḗƈŧīǿƞ."
although Translate Toolkit can provide a solution I've looked for a simpler approach using bash script. create [changesDictionary.txt] file (see format at the end of this post) and run the following script with the language file as parameter:
# This script translate iOS strings file into pseudo languge for texting usage.
# the script create a sed change and replace file based on [changesDictionary.txt].
# the loop run across the input string file (ie. myFyle.strings)
# and replace the secong strings with the dictionary values.
# since the strings file is in BOM format (http://en.wikipedia.org/wiki/Byte_order_mark)
# the input is converted from UTF16 to UTF8.
sed -e 's/^"\(.*\)" = "\(.*\)"$/s\/\1\/\2\/g/' changesDictionary.txt > changesDictionary.sed
FILENAME=$1
while read -r; do
if [[ $REPLY = '/*'* ]] ; then
echo "$REPLY"
else
if [[ $REPLY = '' ]] ; then
echo "$REPLY"
else
if [[ $REPLY = '"'* ]] ; then
changes2=$(echo "$REPLY" | cut -d= -f2 | sed -f changesDictionary.sed)
changes1=$(echo "$REPLY" | cut -d= -f1 )
echo "$changes1=$changes2"
echo "$REPLY"
fi
fi
fi
done < <(iconv -f UTF-16 -t UTF-8 $FILENAME) | iconv -f UTF-8 -t UTF-16 >$FILENAME.new
The script look for a [changeDictionary.txt] file in the following format:
"a" = "á"
"b" = "β"
"c" = "ç"
"d" = "δ"
"e" = "è"
"f" = "ƒ"
"g" = "ϱ"
"h" = "λ"
"i" = "ï"
"j" = "J"
"k" = "ƙ"
"l" = "ℓ"
"m" = "₥"
"n" = "ñ"
"o" = "ô"
"p" = "ƥ"
"q" = "9"
"r" = "ř"
"s" = "ƨ"
"t" = "ƭ"
"u" = "ú"
"v" = "Ʋ"
"w" = "ω"
"x" = "ж"
"y" = "¥"
"z" = "ƺ"
"\ñ" = "\n"
"$δ" = "$d"
"$ï" = "$i"
you can use this example or create your own, please note tp the last 3 change string in the file. this is to restore end of lines and parameters to their regular state. I chose this approach to simplify the script (I think that the perfomance are not optimized).
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