Skip to content

Instantly share code, notes, and snippets.

@teslacoil
Created May 10, 2013 21:27
Show Gist options
  • Save teslacoil/5557571 to your computer and use it in GitHub Desktop.
Save teslacoil/5557571 to your computer and use it in GitHub Desktop.
Populates res/values-XX directories from crowdin translations. Tries to do the appropriate escapes and greps/warns about messed up %1$s style formatting
#!/bin/sh
rm -rf iw
cp -R he iw
mv pt-BR pt-rBR
mv pt-PT pt-rPT
mv zh-CN zh-rCN
mv zh-TW zh-rTW
mv no nb
mv es-ES es
mv sv-SE sv
declare -a Lang=(
ar # Arabic
bg # Bulgarian
ca # Catalan
zh-rCN # Chinese CN
zh-rTW # Chinese CN
hr # Croatian
cs # Czech
da # Danish
nl # Dutch
fi # Finnish
fr # French
de # German
el # Greek
iw # Hebrew AOSP
hu # Hungarian
it # Italian
ja # Japanese
ko # Korean
nb # Norwegian
pl # Polish
pt-rPT # Portuguese
pt-rBR # Brazillian Portuguese
ro # Romanian
ru # Russian
sk # Slovak
es # Spanish
sv # Swedish
tr # Turkish
# he # Hebrew ?
)
for i in ${Lang[@]}; do
cp $i/{arrays.xml,strings.xml,aosp_strings.xml} ../res/values-$i/
perl -e "s/\&lt;b\&gt;/<b>/g; s/\&lt;\/b\&gt;/<\/b>/g;
s/\&lt;u\&gt;/<u>/g; s/\&lt;\/u\&gt;/<\/u>/g;
s/\&lt;i\&gt;/<i>/g; s/\&lt;\/i\&gt;/<\/i>/g;
s/([^\\\\])'/\$1\\\\'/g;
s/\& /\&amp; /g" \
-pi ../res/values-$i/*
done
grep -r '% ' *
grep -r '%1\$ ' *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment