X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=handlers%2F10_translations.sh;h=5067677ac4db48107ee0d433ca93d9970f475a56;hb=116a9fbba5874eec7efb4f2253844e8158fffde9;hp=da67f8947cb6f1b0bb99ac32762fbb1adb4f8c50;hpb=d528b3d990539a7a9a5d11348ffdb3b269e3e569;p=shellwiki diff --git a/handlers/10_translations.sh b/handlers/10_translations.sh index da67f89..5067677 100755 --- a/handlers/10_translations.sh +++ b/handlers/10_translations.sh @@ -1,5 +1,7 @@ #!/bin/sh +_(){ printf %s\\n "$*"; } + # Set LANGUAGE_DEFAULT to enable Plugin [ ! "$LANGUAGE_DEFAULT" ] && return 1 @@ -28,7 +30,13 @@ case ${PATH_INFO} in PATH_INFO="${PATH_INFO%:?*/\[attachment\]}[attachment]" ;; */:?*/\[*\]) - :;; # Default handler, considered valid in most cases + LANGUAGE="${PATH_INFO#*/:}" + LANGUAGE="${LANGUAGE%%/*}" + ;; + */:?*/:?*) + # Accidental double language link, last one stays valid! + REDIRECT "${_BASE}${PATH_INFO%/:?*/:?*}/:${PATH_INFO##*/:}" + ;; */:?*/?*) :;; # Default attachment handler */:?*/) # Faulty URL build @@ -63,4 +71,6 @@ case ${PATH_INFO} in ;; esac +[ -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" + return 1