makepot.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 "*.strf" -print0 | xargs -0 xgettext --keyword='_:1' \
  20. --language=Lisp --from-code=UTF-8 --sort-by-file \
  21. --output data/locale/tilesets.pot --add-comments=l10n \
  22. --package-name="${package_name}" --package-version="${package_version}" \
  23. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  24. msgcat data/locale/main.pot data/locale/credits.pot data/locale/objects.pot data/locale/tilesets.pot > data/locale/messages.pot
  25. rm -f data/locale/main.pot data/locale/credits.pot data/locale/objects.pot data/locale/tilesets.pot
  26. # Prepare script files for inclusion in tinygettext
  27. for LEVELSET in $(ls data/levels); do
  28. SCRIPT_FILES=$(find data/levels/$LEVELSET -name "*.nut")
  29. for SCRIPT_FILE in $SCRIPT_FILES; do
  30. name=$(basename ${SCRIPT_FILE})
  31. name=${name/.nut/}
  32. python tools/extract_strings.py ${SCRIPT_FILE} data/levels/$LEVELSET/scripts_${name}.txt
  33. done
  34. done
  35. for LEVELSET in $(ls data/levels); do
  36. find "data/levels/${LEVELSET}" "(" -name "*.stl" -or -name "*.stl.in" -or -name "*.stwm" -or -name "*.txt" ")" -print0 | xargs -0 xgettext --keyword='_:1' \
  37. --language=Lisp --from-code=UTF-8 --sort-by-file \
  38. --output "data/levels/${LEVELSET}/messages.pot" --add-comments=l10n \
  39. --package-name="${package_name}" --package-version="${package_version}" \
  40. --msgid-bugs-address=https://github.com/SuperTux/supertux/issues
  41. sed -i -e 's/\\r\\n/\\n/g' "data/levels/${LEVELSET}/messages.pot"
  42. rm -f data/levels/$LEVELSET/scripts_*.txt
  43. done