makepot.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/sh
  2. package_name="SuperTux"
  3. package_version="$(git describe --tags --match "?[0-9]*.[0-9]*.[0-9]*")"
  4. xgettext --keyword='_' --keyword='__:1,2' -C -o data/locale/main.pot \
  5. $(find src -name "*.cpp" -or -name "*.hpp") \
  6. --add-comments=l10n \
  7. --package-name="${package_name}" --package-version="${package_version}" \
  8. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  9. find data/ -name "credits.stxt" -print0 | xargs -0 xgettext --keyword='_:1' \
  10. --language=Lisp --from-code=UTF-8 --sort-by-file \
  11. --output data/locale/credits.pot --add-comments=l10n \
  12. --package-name="${package_name}" --package-version="${package_version}" \
  13. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  14. find data/ -name "objects.stoi" -print0 | xargs -0 xgettext --keyword='_:1' \
  15. --language=Lisp --from-code=UTF-8 --sort-by-file \
  16. --output data/locale/objects.pot --add-comments=l10n \
  17. --package-name="${package_name}" --package-version="${package_version}" \
  18. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  19. find data/ -name "data.stcd" -print0 | xargs -0 xgettext --keyword='_:1' \
  20. --language=Lisp --from-code=UTF-8 --sort-by-file \
  21. --output data/locale/converters.pot --add-comments=l10n \
  22. --package-name="${package_name}" --package-version="${package_version}" \
  23. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  24. find data/ -name "*.strf" -print0 | xargs -0 xgettext --keyword='_:1' \
  25. --language=Lisp --from-code=UTF-8 --sort-by-file \
  26. --output data/locale/tilesets.pot --add-comments=l10n \
  27. --package-name="${package_name}" --package-version="${package_version}" \
  28. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  29. msgcat data/locale/main.pot data/locale/credits.pot data/locale/objects.pot data/locale/tilesets.pot data/locale/converters.pot > data/locale/messages.pot
  30. rm -f data/locale/main.pot data/locale/credits.pot data/locale/objects.pot data/locale/tilesets.pot data/locale/converters.pot
  31. # Prepare script files for inclusion in tinygettext
  32. for LEVELSET in $(ls data/levels); do
  33. SCRIPT_FILES=$(find data/levels/$LEVELSET -name "*.nut")
  34. for SCRIPT_FILE in $SCRIPT_FILES; do
  35. name=$(basename ${SCRIPT_FILE} | sed 's/.nut//g')
  36. python tools/extract_strings.py ${SCRIPT_FILE} data/levels/$LEVELSET/scripts_${name}.txt
  37. done
  38. done
  39. for LEVELSET in $(ls data/levels); do
  40. find "data/levels/${LEVELSET}" "(" -name "*.stl" -or -name "*.stl.in" -or -name "*.stwm" -or -name "*.txt" ")" -print0 | xargs -0 xgettext --keyword='_:1' \
  41. --language=Lisp --from-code=UTF-8 --sort-by-file \
  42. --output "data/levels/${LEVELSET}/messages.pot" --add-comments=l10n \
  43. --package-name="${package_name}" --package-version="${package_version}" \
  44. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  45. sed -n -e 's/\\r\\n/\\n/g' "data/levels/${LEVELSET}/messages.pot"
  46. rm -f data/levels/$LEVELSET/scripts_*.txt
  47. done