Fix: Translation

This commit is contained in:
Laurent Destailleur 2008-06-30 19:34:53 +00:00
parent 4dc0787274
commit 870841d96f
2 changed files with 18 additions and 11 deletions

View File

@ -571,11 +571,11 @@ if (sizeof($boxarray))
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("OtherInformationsBoxes")); print_fiche_titre($langs->trans("OtherInformationsBoxes"));
print '<table width="100%" class="notopnoleftnoright">'; print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td>'."\n"; print '<tr><td class="notopnoleftnoright">'."\n";
// Affichage colonne gauche // Affichage colonne gauche
print "\n<!-- Box container -->\n"; print "\n<!-- Box container -->\n";
print '<table width="100%"><tr><td width="50%" valign="top">'."\n"; print '<table width="100%" style="border-collapse: collapse; border: 0px; margin: 0px; padding: 0px;"><tr><td width="50%" valign="top">'."\n";
print '<div id="left">'."\n"; print '<div id="left">'."\n";
$ii=0; $ii=0;

View File

@ -66,10 +66,10 @@ class Translate {
/** /**
* \brief Renvoie la chaine traduite pour une cl<EFBFBD> donn<EFBFBD>e. * \brief Return string translated for a key
* Le tableau des traductions doit avoir <EFBFBD>t<EFBFBD> charg<EFBFBD>. * Translation array must have been loaded before.
* \param key Cl<EFBFBD> de traduction * \param key Key to translate
* \return string Chaine de traduction * \return string Translated string
*/ */
function getTransFromTab($key) function getTransFromTab($key)
{ {
@ -85,8 +85,8 @@ class Translate {
/** /**
* \brief Positionne la chaine traduite pour une cl<EFBFBD> donn<EFBFBD>e. * \brief Positionne la chaine traduite pour une cl<EFBFBD> donn<EFBFBD>e.
* \param key Cl<EFBFBD> de traduction * \param key Key to translate
* \param value Chaine de traduction * \return string Translated string
*/ */
function setTransFromTab($key,$value) function setTransFromTab($key,$value)
{ {
@ -96,7 +96,7 @@ class Translate {
/** /**
* \brief Accesseur de this->defaultlang * \brief Accesseur de this->defaultlang
* \param srclang Langue <EFBFBD> utiliser * \param srclang Language to use
*/ */
function setDefaultLang($srclang='fr_FR') function setDefaultLang($srclang='fr_FR')
{ {
@ -494,10 +494,16 @@ class Translate {
*/ */
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel) function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel)
{ {
// If key empty // If key empty
if ($key == '') return ''; 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])) if (! empty($this->cache_labels[$tablename][$key]))
{ {
return $this->cache_labels[$tablename][$key]; // Found in cache return $this->cache_labels[$tablename][$key]; // Found in cache
@ -512,6 +518,7 @@ class Translate {
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$this->cache_labels[$tablename][$key]=$obj->label; $this->cache_labels[$tablename][$key]=$obj->label;
$db->free($resql);
return $this->cache_labels[$tablename][$key]; return $this->cache_labels[$tablename][$key];
} }
else else