From 870841d96f065ee3f919a09cd2ad6cbb7f02b626 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jun 2008 19:34:53 +0000 Subject: [PATCH] Fix: Translation --- htdocs/index.php | 4 ++-- htdocs/translate.class.php | 25 ++++++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 37a9bbebf27..d076a5e2fd4 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -571,11 +571,11 @@ if (sizeof($boxarray)) print '
'; print_fiche_titre($langs->trans("OtherInformationsBoxes")); print ''; - print '
'."\n"; + print '
'."\n"; // Affichage colonne gauche print "\n\n"; - print '
'."\n"; + print '
'."\n"; print '
'."\n"; $ii=0; diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index 75a1edf630a..adaebd53690 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -66,10 +66,10 @@ class Translate { /** - * \brief Renvoie la chaine traduite pour une cl� donn�e. - * Le tableau des traductions doit avoir �t� charg�. - * \param key Cl� de traduction - * \return string Chaine de traduction + * \brief Return string translated for a key + * Translation array must have been loaded before. + * \param key Key to translate + * \return string Translated string */ function getTransFromTab($key) { @@ -85,8 +85,8 @@ class Translate { /** * \brief Positionne la chaine traduite pour une cl� donn�e. - * \param key Cl� de traduction - * \param value Chaine de traduction + * \param key Key to translate + * \return string Translated string */ function setTransFromTab($key,$value) { @@ -96,7 +96,7 @@ class Translate { /** * \brief Accesseur de this->defaultlang - * \param srclang Langue � utiliser + * \param srclang Language to use */ function setDefaultLang($srclang='fr_FR') { @@ -494,10 +494,16 @@ class Translate { */ function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel) { - // If key empty + // If key empty if ($key == '') return ''; + + // Check in language array + if ($this->transnoentities($key) != $key) + { + return $this->transnoentities($key); // Found in language array + } - // Check in cache + // Check in cache if (! empty($this->cache_labels[$tablename][$key])) { return $this->cache_labels[$tablename][$key]; // Found in cache @@ -512,6 +518,7 @@ class Translate { { $obj = $db->fetch_object($resql); $this->cache_labels[$tablename][$key]=$obj->label; + $db->free($resql); return $this->cache_labels[$tablename][$key]; } else