blob: 7f3161e6cdca3fbda5bbca02b7a1fa1091c83aff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/sh
PATTERN=$1
SCM=
echo $(basename "$0") "initialises po/ i18n catalogues in empty language sub-folders."
echo $(basename "$0") "is deprecated and may be removed in the future."
echo "Hint: run i18n-add-language.sh instead."
[ -d .svn ] && SCM="svn"
git=$( command -v git 2>/dev/null )
[ "$git" ] && "$git" status >/dev/null && SCM="git"
[ -z "$SCM" ] && {
echo "Unsupported SCM tool" >&2
exit 1
}
[ -z "$PATTERN" ] && PATTERN="*.pot"
[ "${1#luci-}" ] && {
# user passed e.g. applications/luci-app-example - build template pot
path="${1%/}"
mkdir -p "$path/po/templates"
./build/i18n-scan.pl "$1" > "$1"/po/templates/"${path##*-}".pot && echo "Created $1/po/templates/${path##*-}.pot"
slashes="${path//[^\/]}/" # Keep only slashes
depth="${#slashes}" # Get the length of the remaining string (number of slashes)
prefix=$(printf '../%.0s' $(seq 1 "$depth"))
pushd "$path" 2&>/dev/null || exit
"$prefix"build/i18n-add-language.sh
}
for lang in $(cd po; echo ?? ??_??); do
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"
$SCM add "po/$lang/${file%.pot}.po"
fi
done
done
popd 2&>/dev/null|| exit
|