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