Adding missing smarty plugin translate implementation
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* To implement pmos translation function on smarty templates
|
||||||
|
*
|
||||||
|
* example use:
|
||||||
|
*
|
||||||
|
* <h1>{translate label="ID_HOME_TITLE"}</h1>
|
||||||
|
*
|
||||||
|
* @params $params mixed array containg all parameters passed from smarty plugin call
|
||||||
|
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -177,7 +177,7 @@
|
|||||||
<body onload="resize()" onresize="resize()" >
|
<body onload="resize()" onresize="resize()" >
|
||||||
<center>
|
<center>
|
||||||
<div class="content-header" style="text-align:left">
|
<div class="content-header" style="text-align:left">
|
||||||
<h1 style="padding: 10px">{$title} ({$cases_count})</h1>
|
<h1 style="padding: 10px">{$title} ({$cases_count}) {translate label="ID_USER"}</h1>
|
||||||
<ul id="commentlist">
|
<ul id="commentlist">
|
||||||
{include file='home/applications.html'}
|
{include file='home/applications.html'}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user