From 31a7346214b1a33f4ef415f6154ef3a81d739e34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 May 2007 22:23:03 +0000 Subject: [PATCH] Ajoute methode convToOuptutCharset --- htdocs/translate.class.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index 118b94fba41..185c70cd6b2 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -256,15 +256,7 @@ class Translate { $newstr=ereg_replace('>','__gt__',$newstr); $newstr=ereg_replace('"','__quot__',$newstr); -/* - if ($key=='DatabaseConnection') { - print utf8_encode($newstr).'-'.$newstr; - print '-'.$this->charset_output; - print '-'.htmlentities($newstr,ENT_QUOTES,'UTF-8').'
'; - } -*/ - if ($this->charset_output=='UTF-8') $newstr=utf8_encode($newstr); - //if ($this->charset_output=='ISO-8859-1') $newstr=$newstr; + $newstr=$this->convToOuptutCharset($newstr); // Cryptage en html de la chaine // $newstr est une chaine stockee en memoire au format $this->charset_output @@ -276,7 +268,10 @@ class Translate { $newstr=ereg_replace('__quot__','"',$newstr); return $newstr; } - return $key; + else + { + return $this->convToOuptutCharset($key); + } } @@ -316,6 +311,19 @@ class Translate { } + /** + * \brief Convertit une chaine dans le charset de sortie + * \param str chaine a convertir + * \return string chaine traduite + */ + function convToOuptutCharset($str) + { + if ($this->charset_output=='UTF-8') $str=utf8_encode($str); + //if ($this->charset_output=='ISO-8859-1') $str=$str; + return $str; + } + + /** * \brief Retourne la liste des langues disponibles * \return array list of languages