diff options
Diffstat (limited to 'build/i18n-init.sh')
-rwxr-xr-x | build/i18n-init.sh | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/build/i18n-init.sh b/build/i18n-init.sh index de8626163d..7f3161e6cd 100755 --- a/build/i18n-init.sh +++ b/build/i18n-init.sh @@ -3,8 +3,8 @@ PATTERN=$1 SCM= -echo $0 "initialises po/ i18n catalogues in empty language sub-folders." -echo $0 "is deprecated and may be removed in the future." +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" @@ -18,6 +18,18 @@ git=$( command -v git 2>/dev/null ) [ -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 @@ -26,3 +38,5 @@ for lang in $(cd po; echo ?? ??_??); do fi done done + +popd 2&>/dev/null|| exit
\ No newline at end of file |