i18n-init.sh 732 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. PATTERN=$1
  3. SCM=
  4. echo $0 "initialises po/ i18n catalogues in empty language sub-folders."
  5. echo $0 "is deprecated and may be removed in the future."
  6. echo "Hint: run i18n-add-language.sh instead."
  7. [ -d .svn ] && SCM="svn"
  8. git=$( command -v git 2>/dev/null )
  9. [ "$git" ] && "$git" status >/dev/null && SCM="git"
  10. [ -z "$SCM" ] && {
  11. echo "Unsupported SCM tool" >&2
  12. exit 1
  13. }
  14. [ -z "$PATTERN" ] && PATTERN="*.pot"
  15. for lang in $(cd po; echo ?? ??_??); do
  16. for file in $(cd po/templates; echo $PATTERN); do
  17. if [ -f po/templates/$file -a ! -f "po/$lang/${file%.pot}.po" ]; then
  18. msginit --no-translator -l "$lang" -i "po/templates/$file" -o "po/$lang/${file%.pot}.po"
  19. $SCM add "po/$lang/${file%.pot}.po"
  20. fi
  21. done
  22. done