]> git.plutz.net Git - shcgi/commitdiff
localization "l10n" function
authorpaul <paul@plutz.net>
Wed, 4 Nov 2015 15:44:40 +0000 (15:44 +0000)
committerpaul <paul@plutz.net>
Wed, 4 Nov 2015 15:44:40 +0000 (15:44 +0000)
svn path=/trunk/; revision=18

misc.sh

diff --git a/misc.sh b/misc.sh
index 9d92805e4c9451c9c7fe8094a8fc2f60e1e0071a..ee4eaaf511d12b773baa1707a26cae952d76bd05 100755 (executable)
--- a/misc.sh
+++ b/misc.sh
@@ -50,3 +50,8 @@ invalidate(){
   printf %s\\n "${value}" \
   | sed -rn "2q; /^(${regex})\$/{bd}; p;q; :d;a${default}"
 }
+
+declare -A item_name
+l10n(){
+  [ -n "$item_name[$1]" ] && printf %s "$item_name[$1]" || printf %s "$1"
+}