Fix: debug multilang

This commit is contained in:
Regis Houssin 2010-02-21 08:53:42 +00:00
parent 7adef0ca3a
commit cf2a359674
2 changed files with 7 additions and 6 deletions

View File

@ -125,13 +125,13 @@ class Product extends CommonObject
global $langs; global $langs;
$this->db = $DB; $this->db = $DB;
$this->id = $id ; $this->id = $id ;
$this->status = 0; $this->status = 0;
$this->stock_reel = 0; $this->stock_reel = 0;
$this->seuil_stock_alerte = 0; $this->seuil_stock_alerte = 0;
$this->canvas = ''; $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) if ($this->catid > 0)
{ {
require_once(DOL_DOCUMENT_ROOT ."/categories/categorie.class.php"); 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"); $cat->add_type($this,"product");
} }
} }
@ -629,6 +629,7 @@ class Product extends CommonObject
{ {
while ( $obj = $this->db->fetch_object($result) ) while ( $obj = $this->db->fetch_object($result) )
{ {
//print 'lang='.$obj->lang.' current='.$current_lang.'<br>';
if( $obj->lang == $current_lang ) // si on a les traduct. dans la langue courant on les charge en infos principales. if( $obj->lang == $current_lang ) // si on a les traduct. dans la langue courant on les charge en infos principales.
{ {
$this->libelle = $obj->label; $this->libelle = $obj->label;

View File

@ -86,7 +86,7 @@ class Translate {
// We redefine $srclang // We redefine $srclang
$langpart=explode("_",$codetouse); $langpart=explode("_",$codetouse);
//print "Short before _ : ".$langpart[0].'/ Short after _ : '.$langpart[1]; //print "Short before _ : ".$langpart[0].'/ Short after _ : '.$langpart[1].'<br>';
if (isset($langpart[1])) // If its a long code xx_YY if (isset($langpart[1])) // If its a long code xx_YY
{ {
@ -102,7 +102,7 @@ class Translate {
} }
else { // If its a short code xx else { // If its a short code xx
// Array to convert short lang code into long code. // 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])]; if (isset($longforshort[strtolower($langpart[0])])) $srclang=$longforshort[strtolower($langpart[0])];
else $srclang=strtolower($langpart[0])."_".strtoupper($langpart[0]); else $srclang=strtolower($langpart[0])."_".strtoupper($langpart[0]);
} }