From fe700356b24c6f2e0dfa73d61bbdff49da82123a Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Wed, 15 May 2013 15:40:07 -0400 Subject: [PATCH] Adding missing smarty plugin translate implementation --- .../includes/smarty_plugins/function.pmos.php | 28 +++++++++++++++++++ workflow/engine/templates/home/appList.html | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/gulliver/includes/smarty_plugins/function.pmos.php b/gulliver/includes/smarty_plugins/function.pmos.php index e69de29bb..04e3b34c2 100644 --- a/gulliver/includes/smarty_plugins/function.pmos.php +++ b/gulliver/includes/smarty_plugins/function.pmos.php @@ -0,0 +1,28 @@ +{translate label="ID_HOME_TITLE"} + * + * @params $params mixed array containg all parameters passed from smarty plugin call + * @author Erik Amaru Ortiz + */ + +function translate($params) +{ + if (array_key_exists('lang', $params)) { + $lang = $params['lang']; + } elseif (defined('SYS_LANG')) { + $lang = SYS_LANG; + } else { + $lang = 'en'; + } + + if (! array_key_exists('label', $params)) { + throw new Exception('Error: Param "label" is missing on "tranlate" smarty function, it should be called like: {translate label="SOME_LABEL_ID"}'); + } + + echo G::loadTranslation($params['label'], $lang); +} diff --git a/workflow/engine/templates/home/appList.html b/workflow/engine/templates/home/appList.html index 31b5655f1..4f7c8feec 100644 --- a/workflow/engine/templates/home/appList.html +++ b/workflow/engine/templates/home/appList.html @@ -177,7 +177,7 @@
-

{$title} ({$cases_count})

+

{$title} ({$cases_count}) {translate label="ID_USER"}

    {include file='home/applications.html'}