From 64c9991efdf0da30b448b6fbbd1da375e45b22d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Nov 2009 21:43:29 +0000 Subject: [PATCH] Fix: Translation of currency works better now. --- htdocs/admin/facture.php | 154 +++++++++++++++++++---------------- htdocs/langs/en_US/dict.lang | 23 +++++- htdocs/langs/fr_FR/dict.lang | 22 ++++- htdocs/translate.class.php | 10 +-- 4 files changed, 123 insertions(+), 86 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 73bb1537c45..41e94d523ef 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -393,87 +393,97 @@ print "\n"; clearstatcache(); -$handle=opendir($dir); -$var=True; -while (($file = readdir($handle))!==false) +$var=true; +foreach ($conf->file->dol_document_root as $dirroot) { - if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') + $dir = $dirroot . "/includes/modules/facture/"; + + if (is_dir($dir)) { - $var = !$var; - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); - - print ''; - echo "$name"; - print "\n"; - - require_once($dir.$file); - $module = new $classname($db); - print $module->description; - print ''; - - // Active - if (in_array($name, $def)) + $handle=opendir($dir); + if ($handle) { - print "\n"; - if ($conf->global->FACTURE_ADDON_PDF != "$name") + while (($file = readdir($handle))!==false) { - print ''; - print img_tick($langs->trans("Disable")); - print ''; + if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') + { + $var = !$var; + $name = substr($file, 4, strlen($file) -16); + $classname = substr($file, 0, strlen($file) -12); + + print ''; + echo "$name"; + print "\n"; + + require_once($dir.$file); + $module = new $classname($db); + print $module->description; + print ''; + + // Active + if (in_array($name, $def)) + { + print "\n"; + if ($conf->global->FACTURE_ADDON_PDF != "$name") + { + print ''; + print img_tick($langs->trans("Disable")); + print ''; + } + else + { + print img_tick($langs->trans("Enabled")); + } + print ""; + } + else + { + print "\n"; + print ''.$langs->trans("Activate").''; + print ""; + } + + // Defaut + print ""; + if ($conf->global->FACTURE_ADDON_PDF == "$name") + { + print img_tick($langs->trans("Default")); + } + else + { + print ''.$langs->trans("Default").''; + } + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); + $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark,1,1); + + + print ''; + print $html->textwithpicto('',$htmltooltip,1,0); + print ''; + print ''; + print ''.img_object($langs->trans("Preview"),'bill').''; + print ''; + + print "\n"; + } } - else - { - print img_tick($langs->trans("Enabled")); - } - print ""; + closedir($handle); } - else - { - print "\n"; - print ''.$langs->trans("Activate").''; - print ""; - } - - // Defaut - print ""; - if ($conf->global->FACTURE_ADDON_PDF == "$name") - { - print img_tick($langs->trans("Default")); - } - else - { - print ''.$langs->trans("Default").''; - } - print ''; - - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur; - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); - $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); - $htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); - $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); - $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); - $htmltooltip.='
'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark,1,1); - - - print ''; - print $html->textwithpicto('',$htmltooltip,1,0); - print ''; - print ''; - print ''.img_object($langs->trans("Preview"),'bill').''; - print ''; - - print "\n"; } } -closedir($handle); - print ''; diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index 323633f7651..91c0803cee9 100755 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -255,18 +255,33 @@ CivilityMTRE=Master ##### Currencies ##### Currencyeuros=Euros -CurrencyAUD=AU Dollar -CurrencyCAD=CAN Dollar +CurrencyAUD=AU Dollars +CurrencySingAUD=AU Dollar +CurrencyCAD=CAN Dollars +CurrencySingCAD=CAN Dollar CurrencyCHF=Swiss Francs +CurrencySingCHF=Swiss Franc CurrencyEUR=Euros +CurrencySingEUR=Euro CurrencyFRF=French Francs +CurrencySingFRF=French Franc CurrencyGBP=GB Pounds +CurrencySingGBP=GB Pound CurrencyMAD=Dirham +CurrencySingMAD=Dirham CurrencyMGA=Ariary -CurrencyMUR=Mauritius rupee -CurrencyNOK=Norwegian krone +CurrencySingMGA=Ariary +CurrencyMUR=Mauritius rupees +CurrencySingMUR=Mauritius rupee +CurrencyNOK=Norwegian krones +CurrencySingNOK=Norwegian krone CurrencyTND=Tunisian dinars +CurrencySingTND=Tunisian dinar CurrencyUSD=US Dollars +CurrencySingUSD=US Dollar CurrencyXAF=CFA Francs BEAC +CurrencySingXAF=CFA Franc BEAC CurrencyXOF=CFA Francs BCEAO +CurrencySingXOF=CFA Franc BCEAO CurrencyXPF=CFP Francs +CurrencySingXPF=CFP Franc diff --git a/htdocs/langs/fr_FR/dict.lang b/htdocs/langs/fr_FR/dict.lang index 9f9c193e336..fb3dab6aced 100755 --- a/htdocs/langs/fr_FR/dict.lang +++ b/htdocs/langs/fr_FR/dict.lang @@ -256,20 +256,36 @@ CivilityMTRE=Maître ##### Currencies ##### Currencyeuros=Euros CurrencyAUD=Dollars Aus. +CurrencySingAUD=Dollar Aus. CurrencyCAD=Dollars Can. +CurrencySingCAD=Dollar Can. CurrencyCHF=Francs suisses +CurrencySingCHF=Franc suisse CurrencyEUR=Euros +CurrencySingEUR=Euro CurrencyFRF=Francs Français +CurrencySingFRF=Franc Français CurrencyGBP=Livres sterling +CurrencySingGBP=Livre sterling CurrencyMAD=Dirham +CurrencySingMAD=Dirham CurrencyMGA=Ariary +CurrencySingMGA=Ariary CurrencyMUR=Roupies mauritiennes +CurrencySingMUR=Roupie mauritienne CurrencyNOK=Couronnes norvégiennes +CurrencySingNOK=Couronne norvégienne CurrencySUR=Roubles -CurrencyTND=Dinar tunisiens -CurrencyTRL=Livre turques +CurrencySingSUR=Rouble +CurrencyTND=Dinars tunisiens +CurrencySingTND=Dinar tunisien +CurrencyTRL=Livres turques +CurrencySingTRL=Livre turque CurrencyUSD=Dollars US +CurrencySingUSD=Dollar US CurrencyXAF=Francs CFA BEAC +CurrencySingXAF=Franc CFA BEAC CurrencyXOF=Francs CFA BCEAO +CurrencySingXOF=Franc CFA BCEAO CurrencyXPF=Francs CFP - +CurrencySingXPF=Franc CFP diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index beb6fe30b7c..ecf3adea163 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -368,20 +368,16 @@ class Translate { { global $db; $newstr=$key; - if (preg_match('/CurrencyShort([A-Z]+)$/i',$key,$reg)) + if (preg_match('/CurrencySing([A-Z][A-Z][A-Z])$/i',$key,$reg)) { - global $db; - //$newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','labelshort'); - $newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','code'); + $newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','labelsing'); } - else if (preg_match('/Currency([A-Z]+)$/i',$key,$reg)) + else if (preg_match('/Currency([A-Z][A-Z][A-Z])$/i',$key,$reg)) { - global $db; $newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','label'); } else if (preg_match('/SendingMethod([0-9A-Z]+)$/i',$key,$reg)) { - global $db; $newstr=$this->getLabelFromKey($db,$reg[1],'expedition_methode','code','libelle'); } return $newstr;