makepot.sh 2.5 KB

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