Browse Source

made a tool which generates empty locales template

cymruu 5 years ago
parent
commit
ac23b8e624
1 changed files with 15 additions and 0 deletions
  1. 15
    0
      tools/gen_lang_template.sh

+ 15
- 0
tools/gen_lang_template.sh View File

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

Loading…
Cancel
Save