diff options
Diffstat (limited to 'core/lib')
| -rw-r--r-- | core/lib/translate_msg.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/lib/translate_msg.sh b/core/lib/translate_msg.sh new file mode 100644 index 0000000..3a1e4a9 --- /dev/null +++ b/core/lib/translate_msg.sh @@ -0,0 +1,9 @@ +render_msg() { + local template="$1"; shift + for pair in "$@"; do + local key="${pair%%=*}" + local val="${pair#*=}" + template="${template//\{$key\}/$val}" + done + echo "$template" +} |
