From 6d81c0172b35957880e846bb32b1c7405a4eafa6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Jul 2008 18:09:22 +0000 Subject: [PATCH] Fix: Unused parameter --- htdocs/main.inc.php | 12 +++++++----- htdocs/master.inc.php | 4 ++-- htdocs/translate.class.php | 22 ++++++++++++---------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 93e325f7dff..0b5b3e95c3c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -408,7 +408,7 @@ if ($user->admin) * Overwrite configs global par configs perso * ------------------------------------------ */ -// Set liste_limite +// Set liste_limit if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) // Can be 0 { $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; @@ -417,20 +417,22 @@ if (isset($user->conf->PRODUIT_LIMIT_SIZE)) // Can be 0 { $conf->produit->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; } + +// If user has choosed its own language if (! empty($user->conf->MAIN_LANG_DEFAULT)) { + // If different than current language if ($langs->getDefaultLang() != $user->conf->MAIN_LANG_DEFAULT) { - // Si on a un langage perso different du langage courant global $langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT); - $langs->setPhpLang($user->conf->MAIN_LANG_DEFAULT); + $langs->setPhpLang(); } } -// Cas de forcage de la langue +// If language was forced on URL if (! empty($_GET["lang"])) { $langs->setDefaultLang($_GET["lang"]); - $langs->setPhpLang($_GET["lang"]); + $langs->setPhpLang(); } diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 3131f71e21a..18d8840e7d4 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -200,12 +200,12 @@ if (! defined('NOREQUIREDB')) } /* - * Chargement langage par défaut (must be after the setValues of $conf) + * Set default language (must be after the setValues of $conf) */ if (! defined('NOREQUIRETRAN')) { $langs->setDefaultLang($conf->global->MAIN_LANG_DEFAULT); - $langs->setPhpLang($conf->global->MAIN_LANG_DEFAULT); + $langs->setPhpLang(); } /* diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index 9a9513b6179..99ca71c3488 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -95,12 +95,14 @@ class Translate { /** - * \brief Accesseur de this->defaultlang + * \brief Set accessor for this->defaultlang * \param srclang Language to use */ function setDefaultLang($srclang='fr_FR') { - $this->origlang=$srclang; + //dolibarr_syslog("Translate::setDefaultLang ".$this->defaultlang,LOG_DEBUG); + + $this->origlang=$srclang; if ($srclang == 'auto') { @@ -121,8 +123,8 @@ class Translate { /** - * \brief Accesseur de this->defaultlang - * \return string Langue utilis�e + * \brief Get accessor for this->defaultlang + * \return string Language used */ function getDefaultLang() { @@ -132,12 +134,12 @@ class Translate { /** \brief Positionne environnement PHP en fonction du langage - \remarks Le code langue long (fr_FR, en_US, ...) doit �tre positionn� + \remarks Le code langue long (fr_FR, en_US, ...) doit avoir etre positionne par setDefaultLang \return int >0 si ok, <0 so ko */ function setPhpLang() { - //dolibarr_syslog("Translate::set_php_lang: ".$this->defaultlang,LOG_DEBUG); + //dolibarr_syslog("Translate::setPhpLang ".$this->defaultlang,LOG_DEBUG); $code_lang_tiret=ereg_replace('_','-',$this->defaultlang); setlocale(LC_ALL, $this->defaultlang); // Compenser pb de locale avec windows @@ -351,11 +353,11 @@ class Translate { /** - * \brief Retourne la version traduite du texte passe en parametre + * \brief Retourne la version traduite du texte pass� en param�tre * Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif - * et si toujours pas trouvee, il est retourne tel quel. - * Les parametres de cette methode ne doivent pas contenir de balises HTML. - * \param key cle de chaine a traduire + * et si toujours pas trouv�, il est retourn� tel quel. + * Les param�tres de cette m�thode ne doivent pas contenir de balises HTML. + * \param key cl� de chaine a traduire * \param param1 chaine de param1 * \param param2 chaine de param1 * \param param3 chaine de param1