Merge pull request #567 from cymruu/master

A tool which generates empty locales template
This commit is contained in:
Ben Dol 2014-12-26 23:54:42 -08:00
commit 6ab69b499d
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#!/bin/bash
#best use ./gen_lang_template >> ../data/locales/XX.lua
#it wont run if you type "sh gen_lang_template", type "./gen_lang_template.sh" instead
#based on gen_needed_translations.sh
echo '-- generated by ./tools/gen_lang_template.sh'
echo 'locale ={'
echo ' name="",'
echo ' languageName="",'
echo ' translation = {'
cat <(find -L ../ \( -name "*.lua" -o -name "*.otui" \) -exec grep -oE "tr\\('(\\\\'|[^'])*'" {} \;) \
<(find -L ../ \( -name "*.lua" -o -name "*.otui" \) -exec grep -oE "tr\\(\"(\\\\\"|[^\"])*\"" {} \;) \
| sort | uniq | sed "s/^tr(.\(.*\).$/ [\"\1\"] = \"\",/"
echo ' }'
echo '}'
echo 'modules.client_locales.installLocale(locale)'