From 9cfcb4bb32e2fb8f5dbabd7faa06e47adf1c23af Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 4 Dec 2011 19:07:42 +0000 Subject: improved i18n --- h-source/Application/Models/GenericModel.php | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'h-source/Application/Models/GenericModel.php') diff --git a/h-source/Application/Models/GenericModel.php b/h-source/Application/Models/GenericModel.php index 002149b..64f24be 100644 --- a/h-source/Application/Models/GenericModel.php +++ b/h-source/Application/Models/GenericModel.php @@ -72,33 +72,25 @@ class GenericModel extends Model_Tree { { foreach ($this->_popupItemNames as $name => $field) { - $this->_popupFunctions[$name] = $this->getTranslationFunction($name); + $this->_popupFunctions[$name] = getTranslationFunction($name); } } + //get the HTML of the popup labels public function getPopupLabel($viewArgs) { $html = null; + $listArray = array('page','history_page'); + foreach ($viewArgs as $field => $value) { - $html .= "
$value
\n"; + if (!in_array($field,$listArray)) + { + $value = getTranslationFunction($field) !== 'gtext' ? gtext(call_user_func(getTranslationFunction($field),$value)) : gtext($value); + $html .= "
".$value."
\n"; + } } return $html; } - //get the translation function - public function getTranslationFunction($fieldName) - { - $fieldsFunc = array( - "vendor" => "betterVendor", - "interface" => "translate", - ); - - if (array_key_exists($fieldName,$fieldsFunc)) - { - return $fieldsFunc[$fieldName]; - } - - return "gtext"; - } } \ No newline at end of file -- cgit v1.2.3