xgettext.sh 522 B

12345678910111213141516171819202122232425262728
  1. #! /bin/bash
  2. me=$(basename "${BASH_SOURCE[0]}");
  3. if [[ $# -lt 1 ]]; then
  4. echo "Usage: $me FILE..." >&2;
  5. exit 1;
  6. fi
  7. mkdir -p locale;
  8. echo "Generating template..." >&2;
  9. xgettext --from-code=UTF-8 \
  10. --keyword=S \
  11. --keyword=NS:1,2 \
  12. --keyword=N_ \
  13. --add-comments='Translators:' \
  14. --add-location=file \
  15. -o locale/template.pot \
  16. "$@" \
  17. || exit;
  18. find locale -name '*.po' -type f | while read -r file; do
  19. echo "Updating $file..." >&2;
  20. msgmerge --update "$file" locale/template.pot;
  21. done
  22. echo "DONE!" >&2;