<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: localize
* Purpose: gets a localized string from an array which is
* global and builed like that:
* $langstrings = array(
* 'Back to the top' => 'Nach oben'
* ); and you include different string tables for each
* language
* -------------------------------------------------------------
*/
function smarty_function_localize($params, &$smarty) {
global $langstrings;
extract($params);
if(isset($langstrings[$word])) {
echo $langstrings[$word];
} else {
echo $word;
}
}
?>
Back to SmartyPlugins.