From cf2a359674c7db8a4b54039206a57a128117b617 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 21 Feb 2010 08:53:42 +0000 Subject: [PATCH] Fix: debug multilang --- htdocs/product.class.php | 9 +++++---- htdocs/translate.class.php | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/product.class.php b/htdocs/product.class.php index ec3a12d4855..03dea67de58 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -125,13 +125,13 @@ class Product extends CommonObject global $langs; $this->db = $DB; - $this->id = $id ; + $this->id = $id ; $this->status = 0; $this->stock_reel = 0; $this->seuil_stock_alerte = 0; - $this->canvas = ''; - if ($id>0) $this->fetch($id); + + if ($this->id > 0) $this->fetch($this->id); } /** @@ -285,7 +285,7 @@ class Product extends CommonObject if ($this->catid > 0) { require_once(DOL_DOCUMENT_ROOT ."/categories/categorie.class.php"); - $cat = new Categorie ($this->db, $this->catid); + $cat = new Categorie($this->db, $this->catid); $cat->add_type($this,"product"); } } @@ -629,6 +629,7 @@ class Product extends CommonObject { while ( $obj = $this->db->fetch_object($result) ) { + //print 'lang='.$obj->lang.' current='.$current_lang.'
'; if( $obj->lang == $current_lang ) // si on a les traduct. dans la langue courant on les charge en infos principales. { $this->libelle = $obj->label; diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index 103f9bde0f7..935c3bda268 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -86,7 +86,7 @@ class Translate { // We redefine $srclang $langpart=explode("_",$codetouse); - //print "Short before _ : ".$langpart[0].'/ Short after _ : '.$langpart[1]; + //print "Short before _ : ".$langpart[0].'/ Short after _ : '.$langpart[1].'
'; if (isset($langpart[1])) // If its a long code xx_YY { @@ -102,7 +102,7 @@ class Translate { } else { // If its a short code xx // Array to convert short lang code into long code. - $longforshort=array('ca'=>'ca_ES', 'nb'=>'nb_NO', 'no'=>'nb_NO'); + $longforshort=array('en'=>'en_US', 'ca'=>'ca_ES', 'nb'=>'nb_NO', 'no'=>'nb_NO'); if (isset($longforshort[strtolower($langpart[0])])) $srclang=$longforshort[strtolower($langpart[0])]; else $srclang=strtolower($langpart[0])."_".strtoupper($langpart[0]); }