New: If translation of currenci not availbale, go into database (with a cache)

This commit is contained in:
Laurent Destailleur 2008-03-15 12:17:15 +00:00
parent ed7772a673
commit 7193bef29d
3 changed files with 17 additions and 17 deletions

View File

@ -10,7 +10,7 @@ AppVerName=DoliWamp 2.4
OutputBaseFilename=DoliWamp 2.4 OutputBaseFilename=DoliWamp 2.4
; Define full path from wich all relative path are defined ; Define full path from wich all relative path are defined
; You must modify this to put here your dolibarr root directory ; You must modify this to put here your dolibarr root directory
SourceDir=C:\Work\Applis\WampServer\wamp\www\dolibarr_new\dolibarr SourceDir=E:\Mes Developpements\dolibarr
; ----- End of change ; ----- End of change
AppId=doliwamp AppId=doliwamp
AppPublisher=Laurent Destailleur - NLTechno AppPublisher=Laurent Destailleur - NLTechno
@ -54,14 +54,11 @@ Source: "build\exe\doliwamp\rundoliwamp.bat.install"; DestDir: "{app}\"; Flags:
Source: "build\exe\doliwamp\install_services.bat.install"; DestDir: "{app}\"; Flags: ignoreversion; Source: "build\exe\doliwamp\install_services.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
Source: "build\exe\doliwamp\uninstall_services.bat.install"; DestDir: "{app}\"; Flags: ignoreversion; Source: "build\exe\doliwamp\uninstall_services.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
Source: "build\exe\doliwamp\mysqlinitpassword.bat.install"; DestDir: "{app}\"; Flags: ignoreversion; Source: "build\exe\doliwamp\mysqlinitpassword.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
; PhpMyAdmin ; PhpMyAdmin, Apache, Php, Mysql
Source: "..\..\..\apps\phpmyadmin2.10.1\*.*"; DestDir: "{app}\apps\phpmyadmin2.10.1"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf" Source: "C:\Program Files\Wamp\apps\phpmyadmin2.10.1\*.*"; DestDir: "{app}\apps\phpmyadmin2.10.1"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log"
; Apache Source: "C:\Program Files\Wamp\bin\apache\apache2.2.6\*.*"; DestDir: "{app}\bin\apache\apache2.2.6"; Flags: ignoreversion recursesubdirs; Excludes: "httpd.conf,wampserver.conf,*.log,*_log"
Source: "..\..\..\bin\apache\apache2.2.6\*.*"; DestDir: "{app}\bin\apache\apache2.2.6"; Flags: ignoreversion recursesubdirs; Excludes: "httpd.conf,wampserver.conf" Source: "C:\Program Files\Wamp\bin\php\php5.2.5\*.*"; DestDir: "{app}\bin\php\php5.2.5"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,wampserver.conf,*.log,*_log"
; Php Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log"
Source: "..\..\..\bin\php\php5.2.5\*.*"; DestDir: "{app}\bin\php\php5.2.5"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,wampserver.conf"
; Mysql
Source: "..\..\..\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf"
; Mysql database ; Mysql database
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45\data\mysql"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db" Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45\data\mysql"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db"
; Dolibarr ; Dolibarr

View File

@ -1124,7 +1124,7 @@ class Form
if ($objp->fprice != '') if ($objp->fprice != '')
{ {
$opt.= price($objp->fprice); $opt.= price($objp->fprice);
$opt.= $langs->trans("Currency".$conf->monnaie)."/".$objp->quantity; $opt.= $langs->trans("CurrencyShort".$conf->monnaie)."/".$objp->quantity;
if ($objp->quantity == 1) if ($objp->quantity == 1)
{ {
$opt.= strtolower($langs->trans("Unit")); $opt.= strtolower($langs->trans("Unit"));
@ -1136,7 +1136,7 @@ class Form
if ($objp->quantity > 1) if ($objp->quantity > 1)
{ {
$opt.=" - "; $opt.=" - ";
$opt.= price($objp->unitprice).$langs->trans("Currency".$conf->monnaie)."/".strtolower($langs->trans("Unit")); $opt.= price($objp->unitprice).$langs->trans("CurrencyShort".$conf->monnaie)."/".strtolower($langs->trans("Unit"));
} }
if ($objp->duration) $opt .= " - ".$objp->duration; if ($objp->duration) $opt .= " - ".$objp->duration;
} }

View File

@ -271,10 +271,10 @@ class Translate {
/** /**
* \brief Retourne la version traduite du texte pass<EFBFBD> en param<EFBFBD>tre en la codant en HTML * \brief Retourne la version traduite du texte passe en parametre en la codant en HTML
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif * Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
* et si toujours pas trouv<EFBFBD>, il est retourn<EFBFBD> tel quel * et si toujours pas trouve, il est retourne tel quel
* Les param<EFBFBD>tres de cette m<EFBFBD>thode peuvent contenir de balises HTML. * Les parametres de cette methode peuvent contenir de balises HTML.
* \param key cl<EFBFBD> de chaine a traduire * \param key cl<EFBFBD> de chaine a traduire
* \param param1 chaine de param1 * \param param1 chaine de param1
* \param param2 chaine de param2 * \param param2 chaine de param2
@ -287,7 +287,7 @@ class Translate {
{ {
if ($this->getTransFromTab($key)) if ($this->getTransFromTab($key))
{ {
// Si la traduction est disponible // Translation is available
$str=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4); $str=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
if ($maxsize) $str=dolibarr_trunc($str,$maxsize); if ($maxsize) $str=dolibarr_trunc($str,$maxsize);
// On remplace les tags HTML par __xx__ pour eviter traduction par htmlentities // On remplace les tags HTML par __xx__ pour eviter traduction par htmlentities
@ -309,6 +309,10 @@ class Translate {
} }
else else
{ {
// Translation is not available
global $db;
if (ereg('CurrencyShort([A-Z]+)$',$key,$reg)) $key=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','code');
if (ereg('Currency([A-Z]+)$',$key,$reg)) $key=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','label');
return $this->convToOuptutCharset($key); return $this->convToOuptutCharset($key);
} }
} }
@ -467,8 +471,7 @@ class Translate {
$sql = "SELECT ".$fieldlabel." as label"; $sql = "SELECT ".$fieldlabel." as label";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".$key."'"; $sql.= " WHERE ".$fieldkey." = '".$key."'";
dolibarr_syslog('Translate::getLabelFromKey sql='.$sql,LOG_DEBUG);
dolibarr_syslog('Translate::getLabelFromKey ',LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {