makepot.sh 1.5 KB

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. xgettext --keyword='_' -C -o translations/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 translations/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 translations/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 translations/tilesets.pot --add-comments=l10n
  6. msgcat translations/main.pot translations/objects.pot translations/tilesets.pot > translations/messages.pot
  7. rm -f translations/main.pot translations/objects.pot translations/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 ./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 translations/$LEVELSET.pot --add-comments=l10n
  19. sed -i -e 's/\\r\\n/\\n/g' translations/$LEVELSET.pot
  20. rm -f data/levels/$LEVELSET/scripts_*.txt 2> /dev/null
  21. done