i18n-init.sh 553 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. PATTERN=$1
  3. SCM=
  4. [ -d .svn ] && SCM="svn"
  5. git=$( command -v git 2>/dev/null )
  6. [ "$git" ] && "$git" status >/dev/null && SCM="git"
  7. [ -z "$SCM" ] && {
  8. echo "Unsupported SCM tool" >&2
  9. exit 1
  10. }
  11. [ -z "$PATTERN" ] && PATTERN="*.pot"
  12. for lang in $(cd po; echo ?? ??_??); do
  13. for file in $(cd po/templates; echo $PATTERN); do
  14. if [ -f po/templates/$file -a ! -f "po/$lang/${file%.pot}.po" ]; then
  15. msginit --no-translator -l "$lang" -i "po/templates/$file" -o "po/$lang/${file%.pot}.po"
  16. $SCM add "po/$lang/${file%.pot}.po"
  17. fi
  18. done
  19. done