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