makepot.sh 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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})
  36. name=${name/.nut/}
  37. python tools/extract_strings.py ${SCRIPT_FILE} data/levels/$LEVELSET/scripts_${name}.txt
  38. done
  39. done
  40. for LEVELSET in $(ls data/levels); do
  41. find "data/levels/${LEVELSET}" "(" -name "*.stl" -or -name "*.stl.in" -or -name "*.stwm" -or -name "*.txt" ")" -print0 | xargs -0 xgettext --keyword='_:1' \
  42. --language=Lisp --from-code=UTF-8 --sort-by-file \
  43. --output "data/levels/${LEVELSET}/messages.pot" --add-comments=l10n \
  44. --package-name="${package_name}" --package-version="${package_version}" \
  45. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  46. sed -n -e 's/\\r\\n/\\n/g' "data/levels/${LEVELSET}/messages.pot"
  47. rm -f data/levels/$LEVELSET/scripts_*.txt
  48. done