diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index eedcd5c507a..b08a34dfba8 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -35,7 +35,7 @@ $tabid[3] = "llx_c_regions"; $tabid[4] = "llx_c_pays"; $tabnom[1] = "Formes juridiques"; -$tabnom[2] = "Départements"; +$tabnom[2] = "Départements/Provinces/Cantons"; $tabnom[3] = "Régions"; $tabnom[4] = "Pays"; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 04a8b5e869c..aa75904241b 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -100,9 +100,15 @@ if ($_GET["action"] == 'edit') print ''; print ''; - print 'Langue par défaut à utiliser (fr, ...)'; + print 'Langue par défaut à utiliser (code langue)'; print ''; print ''; @@ -128,7 +134,7 @@ else $filelib=eregi_replace('\.php$','',MAIN_MENU_BARRETOP); print $filelib; print ''; - print 'Langue par défaut à utiliser (fr, en...)' . MAIN_LANG_DEFAULT . ''; + print 'Langue par défaut à utiliser (code langue)' . MAIN_LANG_DEFAULT . ''; print 'Afficher zone de recherche Contacts dans le menu gauche' . (MAIN_SEARCHFORM_CONTACT?"oui":"non") . ''; print 'Afficher zone de recherche Sociétés dans le menu gauche' . (MAIN_SEARCHFORM_SOCIETE?"oui":"non") . ''; print '
'; diff --git a/htdocs/langs/en b/htdocs/langs/en index a608bbc7f8f..9ef83c408b4 100644 --- a/htdocs/langs/en +++ b/htdocs/langs/en @@ -1,3 +1,21 @@ #do not change next line please ! -#{@"htmltagoption"=>"nothing","charset"=>"iso-8859-1","name"=>"English"} -User=User +charset="iso-8859-1" + +# Menus +Société=Company + +# Fiches sociétés +Adresse=Address +Téléphone=Phone + +# Utilisateurs +Auteur=Author +Utilisateur=User + +# Autre +Choisissez votre langue=Please choose your language +Ajouter=Add +Supprimer=Delete +Factures=Bills +Facture=Bill +Payé=Payed diff --git a/htdocs/langs/fr b/htdocs/langs/fr index 8a350fa9106..ba3a1021568 100644 --- a/htdocs/langs/fr +++ b/htdocs/langs/fr @@ -1,15 +1,5 @@ #do not change next line please ! -#{@"htmltagoption"=>"nothing","charset"=>"iso-8859-1","name"=>"Français","translator_0"=>"Éric SEIGNE "} -Please choose your language=Choisissez votre langue -Add=Ajouter -Commercial=Commercial -Company=Société -Date=Date -Delete=Supprimer -Bills=Factures -Bill=Facture -Propositions commerciales=Propositions commerciales -Espace compta=Espace comptabilité -Author=Auteur -User=Utilisateur -Payed=Payé \ No newline at end of file +charset="iso-8859-1" + +# Le fichier de langue pour le francais n'a pas besoin d'etre rempli pour l'instant +# Sa presence suffit diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9b26a14ff09..b100698f8c8 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -395,8 +395,7 @@ if (! defined(MAIN_LANG_DEFAULT)) define(MAIN_LANG_DEFAULT,"fr"); } $conf->langage=MAIN_LANG_DEFAULT; -$rtplang = new rtplang(DOL_DOCUMENT_ROOT ."/langs", $conf->langage, $conf->langage, $conf->langage); -$rtplang->debug=1; +$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs", $conf->langage, $conf->langage, $conf->langage); $lc=strtolower($conf->langage)."_".strtoupper($conf->langage); // lc vaut fr_FR par exemple setlocale(LC_TIME, $lc); @@ -415,12 +414,12 @@ $bc[1]="class=\"pair\""; function top_menu($head, $title="") { - global $user, $conf, $rtplang; + global $user, $conf, $langs; print ''; print "\n"; - print $rtplang->lang_header(); + print $langs->lang_header(); // print ""; print $head; diff --git a/htdocs/soc.php b/htdocs/soc.php index 091c146399a..0c8e2bd824c 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -86,7 +86,7 @@ if ($action == 'create') print ''; print ''; - print ''; + print ''; print ''; @@ -98,8 +98,8 @@ if ($action == 'create') print $form->select_pays($soc->pays_id); print ''; - print ''; - print ''; + print ''; + print ''; print ''; @@ -158,7 +158,7 @@ elseif ($action == 'edit') print '
Nom
Adresse
'.$langs->trans('Adresse').'
CP '; print 'Ville 
TéléphoneFax
'.$langs->trans('Téléphone').''.$langs->trans('Adresse').'
Webhttp://
'; print ''; - print ''; @@ -172,8 +172,8 @@ elseif ($action == 'edit') print $form->select_pays($soc->pays_id); print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; @@ -286,16 +286,16 @@ else dolibarr_fiche_head($head, 0); /* - * + * Fiche société en mode visu */ print '
Nom
Adresse
TéléphoneFax
'.$langs->trans('Téléphone').''.$langs->trans('Fax').'
Webhttp://
Siren
'; print ''; - print ""; + print ""; - print ''; - print ''; + print ''; + print ''; print ''; diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index 3f91b954feb..a1c5b078170 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -1,6 +1,7 @@ + * Copyright (C) 2001 Eric Seigne + * Copyright (C) 2004 Destailleur Laurent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * *************************************************************************** - * File : rtplang.class.php + * File : translate.class.php * Author : Eric SEIGNE * mailto:erics@rycks.com * http://www.rycks.com/ @@ -28,7 +29,7 @@ * ------------ * * - * + * * @version 1.0 * @author Eric Seigne * @project AbulEdu @@ -36,84 +37,123 @@ * * ************************************************************************* */ -if(isset($RTPLANG_CLASS)){ - return; -} -$RTPLANG_CLASS=1; +Class Translate { + var $tab_langs; + var $tab_translate; + var $file_lang; + /** Default language interface (isocode) */ + var $defaultiso; + /** Source language (isocode) */ + var $sourceiso; + /** This session language (isocode) */ + var $sessioniso; + /** Where are languages files ? */ + var $dir; + var $debug; - -Class rtplang { - - //------------------------------------------------- - /** Constructor */ - function rtplang($dir = "", $sourceiso = "", $defaultiso = "", $sessioniso = "") + //------------------------------------------------- + /** Constructor */ + function Translate($dir = "", $sourceiso = "", $defaultiso = "", $sessioniso = "") { - } - /** - * Return translated version of parameter string - * [fr] Retourne la version traduite du texte passé en paramètre - * Si il n'y a pas de correspondance pour ce texte, il est retourné - * "tel quel" précédé d'un "[vo] " et terminé par un - * - * @access public - * @return string translated version of parameter string, or original version of this string with "[vo] " before and "" after - * @param string $str original string to translate - * @param int $mark bolean, 1 or nothing: add [vo] if this translation does not exists, 0 don't add [vo] tags - */ - function translate($str, $mark){ + $this->tab_langs = array(); + $this->tab_translate = array(); + $this->file_lang = ""; + $this->debug = 0; + $this->dir = $dir; + $this->sessioniso = $sessioniso; + $this->sourceiso = $sourceiso; + $this->defaultiso = $defaultiso; + + if ($sessioniso == 'fr') { + // Français demandé, on ne fait rien + return; + } - $retour = $str; + //Si on a une langue par defaut + if(($this->defaultiso != "") && ($this->sessioniso == "")) + $this->file_lang = $this->dir . "/" . $this->defaultiso; + else if($this->sessioniso != "") + $this->file_lang = $this->dir . "/" . $this->sessioniso; - return $retour; - } - - /** - * Return the list of available languages - * [fr] Retourne la liste des langues disponibles - * - * @access public - * @return array: list of languages - */ - function get_available_languages() - { + /* initialize tabs */ + $i = 0; + if(is_dir($this->dir)) { + $filet = $this->dir . "/" . $sessioniso; + //print "Ouverture fichier $filet"; + if($fp = @fopen($filet,"rt")){ + $finded = 0; + while (($ligne = fgets($fp,4096)) && ($finded == 0)){ + if ($ligne[0] != "\n" && $ligne[0] != " " && $ligne[0] != "#") { + $tab=split('=',$ligne); + //print "Found a string for $tab[0] with value $tab[1]
"; + $this->tab_translate[$tab[0]]=$tab[1]; + } + } + fclose($fp); + } + + } } - - /** - * Send header and return a string of html start page - * [fr] Expédie le header correct et retourne le début de la page html - * - * @access public - * @return string - */ - function lang_header() - { - $charset = "iso-8859-1"; - - //header("Content-Type: text/html; charset=$charset"); - $texte .= " - -\n"; - - return $texte; + /* + * Return translated version of parameter string + * [fr] Retourne la version traduite du texte passé en paramètre + * Si il n'y a pas de correspondance pour ce texte, il est retourn + * "tel quel" précédé d'un "[vo] " et terminé par un + * + * @access public + * @return string translated version of parameter string, or original version of this string with "[vo] " before and "" after + * @param string $str original string to translate + * @param int $mark bolean, 1 or nothing: add [vo] if this translation does not exists, 0 don't add [vo] tags + */ + function trans($str) { + if ($this->tab_translate[$str]) { + // Si la traduction est disponible + + return $this->tab_translate[$str]; + } + return $str; } + + /** + * Return the list of available languages + * [fr] Retourne la liste des langues disponibles + * + * @access public + * @return array: list of languages + */ + function get_available_languages() + { + + } + + /** + * Send header and return a string of html start page + * [fr] Expédie le header correct et retourne le début de la page html + * + * @access public + * @return string + */ + function lang_header() + { + + $charset = "iso-8859-1"; + + //header("Content-Type: text/html; charset=$charset"); + $texte .= "\n\n"; + + return $texte; + } + + } -/* - * Return translated version of parameter string - * [fr] Retourne la version traduite du texte passé en paramètre - * Si il n'y a pas de correspondance pour ce texte, il est retourné - * "tel quel" précédé d'un "[vo] " et terminé par un - * - * @access public - * @return string translated version of parameter string, or original version of this string with "[vo] " before and "" after - * @param string $str original string to translate - * @param int $mark bolean, 1 or nothing: add [vo] if this translation does not exists, 0 don't add [vo] tags - */ -function translate($str, $mark = 1){ +// Pour compatibilité avec l'existant. Il existe quelques appels a une fonction +// tranlsate. On l'implémente donc ici mais il vaut mieux utiliser $langs->trans +function translate($str) { - return $str; + return $str; } ?>
Nom'.$soc->nom.'
Adresse".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
".$langs->trans('Adresse')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
Téléphone'.dolibarr_print_phone($soc->tel).'Fax'.dolibarr_print_phone($soc->fax).'
'.$langs->trans('Téléphone').''.dolibarr_print_phone($soc->tel).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax).'
Web'; if ($soc->url) { print 'http://'.$soc->url.''; } print '