/po/tools/update-po.sh

http://txt2tags.googlecode.com/ · Shell · 54 lines · 28 code · 10 blank · 16 comment · 5 complexity · 1e0b8d20e0df2a97393769d7a80414a2 MD5 · raw file

  1. #!/bin/bash
  2. # update-po.sh
  3. # 2004-05-30 Aurelio Jargas
  4. # 2010-06-18 renamed to update-po.sh, pot extraction moved to update-pot.sh
  5. #
  6. # You get the msgmerge/msgfmt commands from gettext package.
  7. # On the Mac, download gettext at http://rudix.org
  8. #
  9. # Tips:
  10. #
  11. # 1. To generate the .mo file:
  12. # msgfmt -o de.mo de.po
  13. #
  14. # 2. To install the mo file:
  15. # su -c "cp -v de.mo /usr/share/locale/de/LC_MESSAGES/"
  16. #
  17. cd $(dirname "$0")
  18. cd .. # Operate on the 'po' folder
  19. pot=txt2tags.pot
  20. becho(){ echo -e "\033[36;1m$*\033[m"; }
  21. for po in *.po; do
  22. clear
  23. becho "=============================================="
  24. becho "$po"
  25. becho "=============================================="
  26. becho
  27. becho "--------- Merging pot changes into $po"
  28. msgmerge --no-fuzzy-matching $po $pot > $po.new
  29. rm -f messages.mo
  30. becho "--------- Any difference?"
  31. diff -u $po $po.new
  32. becho "--------- Update $po? [Yn]"
  33. read YN
  34. if test "$YN" != n -a "$YN" != N
  35. then
  36. mv -v $po $po.old
  37. mv -v $po.new $po
  38. fi
  39. becho "--------- Stats for $po"
  40. msgfmt -c --statistics $po
  41. becho
  42. becho "$po done (Press Enter to continue)"
  43. read foo
  44. done