makepot.sh 1.5 KB

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. xgettext --keyword='_' -C -o data/main.pot $(find src -name "*.cpp" -or -name "*.hpp") --add-comments=l10n
  3. find data/ -name "credits.stxt" -print0 | xargs -0 xgettext --keyword='_:1' --language=Lisp --from-code=UTF-8 --sort-by-file --output data/credits.pot --add-comments=l10n
  4. find data/ -name "objects.stoi" -print0 | xargs -0 xgettext --keyword='_:1' --language=Lisp --from-code=UTF-8 --sort-by-file --output data/objects.pot --add-comments=l10n
  5. find data/ -name "*.strf" -print0 | xargs -0 xgettext --keyword='_:1' --language=Lisp --from-code=UTF-8 --sort-by-file --output data/tilesets.pot --add-comments=l10n
  6. msgcat data/main.pot data/objects.pot data/tilesets.pot > data/locale/en.pot
  7. rm -f data/main.pot data/objects.pot data/tilesets.pot 2> /dev/null
  8. # Prepare script files for inclusion in tinygettext
  9. for LEVELSET in $(ls data/levels); do
  10. SCRIPT_FILES=$(find data/levels/$LEVELSET -name "*.nut")
  11. for SCRIPT_FILE in $SCRIPT_FILES; do
  12. name=$(basename ${SCRIPT_FILE})
  13. name=${name/.nut/}
  14. python tools/extract_strings.py ${SCRIPT_FILE} data/levels/$LEVELSET/scripts_${name}.txt
  15. done
  16. done
  17. for LEVELSET in $(ls data/levels); do
  18. find data/levels/$LEVELSET "(" -name "*.stl" -or -name "*.stwm" -or -name "*.txt" ")" -print0 | xargs -0 xgettext --keyword='_:1' --language=Lisp --sort-by-file --output data/levels/$LEVELSET/en.pot --add-comments=l10n
  19. sed -i -e 's/\\r\\n/\\n/g' data/levels/$LEVELSET/en.pot
  20. rm -f data/levels/$LEVELSET/scripts_*.txt 2> /dev/null
  21. done