update-translations.sh 592 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. TEMPLATE=messages.pot
  3. xgettext -kT_js_decl -kT_sprintf -kT_ngettext:1,2 -k__ -L PHP -o $TEMPLATE *.php include/*.php
  4. xgettext --from-code utf-8 -k__ -L Java -j -o $TEMPLATE js/*.js
  5. update_lang() {
  6. if [ -f $1.po ]; then
  7. TMPFILE=/tmp/update-translations.$$
  8. msgmerge -o $TMPFILE $1.po $TEMPLATE
  9. mv $TMPFILE $1.po
  10. msgfmt --statistics $1.po
  11. msgfmt -o $1.mo $1.po
  12. else
  13. echo "Usage: $0 [-p|<basename>]"
  14. fi
  15. }
  16. LANGS=`find locale -name 'messages.po'`
  17. for lang in $LANGS; do
  18. echo Updating $lang...
  19. PO_BASENAME=`echo $lang | sed s/.po//`
  20. update_lang $PO_BASENAME
  21. done