X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=build%2Fi18n-init.sh;h=b20fbc33474499a3c201994347b0fc983dbd8f85;hp=72199bb38bb1577a376a818cf9b4ece29c4e200b;hb=ec6a1d6d4d05f956f47b889161178f6a4abf90cc;hpb=7d73e79c49b7ae4af35f1d6d00d7d84c5343d3f0 diff --git a/build/i18n-init.sh b/build/i18n-init.sh index 72199bb38..b20fbc334 100755 --- a/build/i18n-init.sh +++ b/build/i18n-init.sh @@ -1,10 +1,24 @@ #!/bin/sh +PATTERN=$1 +SCM= + +[ -d .svn ] && SCM="svn" +git=$( which git 2>/dev/null ) +[ "$git" ] && "$git" status >/dev/null && SCM="git" + +[ -z "$SCM" ] && { + echo "Unsupported SCM tool" >&2 + exit 1 +} + +[ -z "$PATTERN" ] && PATTERN="*.pot" + for lang in $(cd po; echo ?? ??_??); do - for file in $(cd po/templates; echo *.pot); do - if [ ! -f "po/$lang/${file%.pot}.po" ]; then + for file in $(cd po/templates; echo $PATTERN); do + if [ -f po/templates/$file -a ! -f "po/$lang/${file%.pot}.po" ]; then msginit --no-translator -l "$lang" -i "po/templates/$file" -o "po/$lang/${file%.pot}.po" - svn add "po/$lang/${file%.pot}.po" + $SCM add "po/$lang/${file%.pot}.po" fi done done