]> git.plutz.net Git - shellwiki/blobdiff - handlers/10_translations.sh
Merge commit 'fb88510e7c955308c1321678f97a8f7d47b92efd'
[shellwiki] / handlers / 10_translations.sh
index da67f8947cb6f1b0bb99ac32762fbb1adb4f8c50..5067677ac4db48107ee0d433ca93d9970f475a56 100755 (executable)
@@ -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