Fandom

Glest

MG/Translations maintenance

< MG

275pages on
this wiki
Add New Page
Talk0 Share

Those informations are/may be very outdated, please go to: new wiki

One-linersEdit

Here are some POSIX shell one-liners to help with maintenance of translation files.

Remove BOM off all filesEdit

sed -i '1 s/^\xef\xbb\xbf//' data/glest_game/data/lang/*.lng data/glest_game/data/lang/hint/*.lng data/glest_game/scenarios/*/*.lng data/glest_game/tutorials/*/*.lng

Extract all keys to a fileEdit

cat data/glest_game/data/lang/*.lng data/glest_game/data/lang/hint/*.lng data/glest_game/scenarios/*/*.lng data/glest_game/tutorials/*/*.lng | awk -F= '/^[^;#]/ {print $1}' | sort | uniq | grep -Ev '^\W*$' > /tmp/all_keys.txt

List unreferenced keysEdit

List keys which are not referenced anywhere in the source code and thus may be leftovers in the translation files.

while read key; do grep -Eq '(lang\.get\("'"$key"'"\)|hasString\("'$key'"\)|setDisplayText\('"'$key'"'\))' `find source/ -type f -name '*.cpp' -o -name '*.h'`; if [ "$?x" = '1x' ]; then echo "Key [$key] could not be found in the source code."; fi; done < /tmp/all_keys.txt

Beware of false positives:

  • Keys which end in numbers / counters are usually not found on the source code as is
  • ... (to be added)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.