forked from Wavyzz/dolibarr
Fix: Corrections et simplifications de la gestion du mode de langue 'auto'.
This commit is contained in:
@@ -81,7 +81,7 @@ print '</ul>';
|
|||||||
|
|
||||||
|
|
||||||
// \todo Faut-il inviter l'utilisateur <20> aller sur le site en fran<61>ais si sa langue n'est pas le fran<61>ais ?
|
// \todo Faut-il inviter l'utilisateur <20> aller sur le site en fran<61>ais si sa langue n'est pas le fran<61>ais ?
|
||||||
//if (eregi('^fr_',$conf->langage)
|
//if (eregi('^fr_',$langs->getDefaultLang())
|
||||||
//{
|
//{
|
||||||
print '<p>';
|
print '<p>';
|
||||||
print 'Vente / Support';
|
print 'Vente / Support';
|
||||||
|
|||||||
@@ -44,12 +44,21 @@ print "<tr $bc[0]><td width=\"240\">".$langs->trans("Version")."</td><td>".DOL_V
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
$var=true;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
|
print '<tr class="liste_titre"><td>'.$langs->trans("LanguageDolibarrParameter").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
|
||||||
print "<tr $bc[0]><td width=\"240\">".$langs->trans("Language")." (LC_ALL)</td><td>".setlocale(LC_ALL,0)."</td></tr>\n";
|
$var=!$var;
|
||||||
print "<tr $bc[1]><td width=\"240\">".$langs->trans("Language")." (LC_NUMERIC)</td><td>".setlocale(LC_NUMERIC,0)."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"240\">".$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE")."</td><td>".$_SERVER["HTTP_ACCEPT_LANGUAGE"]."</td></tr>\n";
|
||||||
print "<tr $bc[0]><td width=\"240\">".$langs->trans("Language")." (LC_TIME)</td><td>".setlocale(LC_TIME,0)."</td></tr>\n";
|
$var=!$var;
|
||||||
print "<tr $bc[1]><td width=\"240\">".$langs->trans("Language")." (LC_MONETARY)</td><td>".setlocale(LC_MONETARY,0)."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"240\">".$langs->trans("LanguageParameter","PHP LC_ALL")."</td><td>".setlocale(LC_ALL,0)."</td></tr>\n";
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var]."><td width=\"240\">".$langs->trans("LanguageParameter","PHP LC_NUMERIC")."</td><td>".setlocale(LC_NUMERIC,0)."</td></tr>\n";
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var]."><td width=\"240\">".$langs->trans("LanguageParameter","PHP LC_TIME")."</td><td>".setlocale(LC_TIME,0)."</td></tr>\n";
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var]."><td width=\"240\">".$langs->trans("LanguageParameter","PHP LC_MONETARY")."</td><td>".setlocale(LC_MONETARY,0)."</td></tr>\n";
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var]."><td width=\"240\">".$langs->trans("CurrentDolibarrLanguage")."</td><td>".$langs->getDefaultLang()."</td></tr>\n";
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@@ -17,17 +17,19 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
\file htdocs/compta/dons/formulaire/fsfe.fr.php
|
\file htdocs/compta/dons/formulaire/fsfe.fr.php
|
||||||
\ingroup don
|
\ingroup don
|
||||||
\brief Formulaire de don
|
\brief Formulaire de don
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../../../main.inc.php");
|
require("../../../master.inc.php");
|
||||||
|
require("../../../projetdon.class.php");
|
||||||
|
require("../../../don.class.php");
|
||||||
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||||
@@ -41,12 +43,6 @@ echo '
|
|||||||
';
|
';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require("../../../projetdon.class.php");
|
|
||||||
require("../../../don.class.php");
|
|
||||||
|
|
||||||
setlocale(LC_ALL,$conf->langage);
|
|
||||||
|
|
||||||
$don = new Don($db);
|
$don = new Don($db);
|
||||||
$don->id = $_GET["rowid"];
|
$don->id = $_GET["rowid"];
|
||||||
$don->fetch($_GET["rowid"]);
|
$don->fetch($_GET["rowid"]);
|
||||||
|
|||||||
@@ -33,9 +33,10 @@ $conffile = "../conf/conf.php";
|
|||||||
|
|
||||||
|
|
||||||
// Defini objet langs
|
// Defini objet langs
|
||||||
require_once("../translate.class.php");
|
require_once('../translate.class.php');
|
||||||
$langcode='auto';
|
$langs = new Translate('../langs');
|
||||||
$langs = new Translate("../langs", $langcode);
|
$langs->setDefaultLang('auto');
|
||||||
|
$langs->setPhpLang();
|
||||||
|
|
||||||
|
|
||||||
$tab[0]=' class="bg1"';
|
$tab[0]=' class="bg1"';
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ OtherSetup=Other setup
|
|||||||
Modules=Modules
|
Modules=Modules
|
||||||
ModulesCommon=Common modules
|
ModulesCommon=Common modules
|
||||||
ModulesSpecial=Special modules
|
ModulesSpecial=Special modules
|
||||||
|
ParameterInDolibarr=Parameter %s
|
||||||
|
LanguageParameter=Language parameter %s
|
||||||
|
LanguageBrowserParameter=Parameter %s
|
||||||
|
LanguageDolibarrParameter=Language Dolibarr parameter
|
||||||
|
CurrentDolibarrLanguage=Dolibarr current language
|
||||||
OSEnv=OS Environment
|
OSEnv=OS Environment
|
||||||
Box=Box
|
Box=Box
|
||||||
Boxes=Boxes
|
Boxes=Boxes
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ OtherSetup=Divers
|
|||||||
Modules=Modules
|
Modules=Modules
|
||||||
ModulesCommon=Modules standards
|
ModulesCommon=Modules standards
|
||||||
ModulesSpecial=Modules sp<73>ciaux
|
ModulesSpecial=Modules sp<73>ciaux
|
||||||
|
ParameterInDolibarr=Variable %s
|
||||||
|
LanguageParameter=Variable langue %s
|
||||||
|
LanguageBrowserParameter=Variable %s
|
||||||
|
LanguageDolibarrParameter=Param<61>tre de langue Dolibarr
|
||||||
|
CurrentDolibarrLanguage=Langue Dolibarr courante
|
||||||
OSEnv=Environnement OS
|
OSEnv=Environnement OS
|
||||||
Box=Bo<42>te
|
Box=Bo<42>te
|
||||||
Boxes=Bo<42>tes
|
Boxes=Bo<42>tes
|
||||||
|
|||||||
@@ -281,34 +281,6 @@ function dolibarr_get_const($db, $name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Positionne environnement PHP en fonction du langage
|
|
||||||
\param code_lang Code langue concern<72> (fr_FR, en_US, ...)
|
|
||||||
\return string Code langue valid<69>
|
|
||||||
*/
|
|
||||||
function dolibarr_set_php_lang($code_lang)
|
|
||||||
{
|
|
||||||
$code_lang_tiret=ereg_replace('_','-',$code_lang);
|
|
||||||
|
|
||||||
//dolibarr_syslog("dolibarr_set_php_lang: code_lang=$code_lang code_lang_tirer=$code_lang_tiret");
|
|
||||||
|
|
||||||
setlocale(LC_ALL, $code_lang); // Compenser pb de locale avec windows
|
|
||||||
setlocale(LC_ALL, $code_lang_tiret);
|
|
||||||
if (defined("MAIN_FORCE_SETLOCALE_LC_ALL") && MAIN_FORCE_SETLOCALE_LC_ALL) setlocale(LC_ALL, MAIN_FORCE_SETLOCALE_LC_ALL);
|
|
||||||
if (defined("MAIN_FORCE_SETLOCALE_LC_TIME") && MAIN_FORCE_SETLOCALE_LC_TIME) setlocale(LC_TIME, MAIN_FORCE_SETLOCALE_LC_TIME);
|
|
||||||
if (defined("MAIN_FORCE_SETLOCALE_LC_NUMERIC") && MAIN_FORCE_SETLOCALE_LC_NUMERIC) setlocale(LC_NUMERIC, MAIN_FORCE_SETLOCALE_LC_NUMERIC);
|
|
||||||
if (defined("MAIN_FORCE_SETLOCALE_LC_MONETARY") && MAIN_FORCE_SETLOCALE_LC_MONETARY) setlocale(LC_MONETARY, MAIN_FORCE_SETLOCALE_LC_MONETARY);
|
|
||||||
|
|
||||||
// On corrige $code_lang si il ne vaut pas le code long: fr -> fr_FR par exemple
|
|
||||||
if (strlen($code_lang) <= 3)
|
|
||||||
{
|
|
||||||
$code_lang = strtolower($code_lang)."_".strtoupper($code_lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $code_lang;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Insertion d'une constante dans la base de donn<6E>es.
|
\brief Insertion d'une constante dans la base de donn<6E>es.
|
||||||
\see dolibarr_del_const, dolibarr_get_const
|
\see dolibarr_del_const, dolibarr_get_const
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("master.inc.php");
|
require_once("master.inc.php");
|
||||||
|
|
||||||
|
|
||||||
// Verification du login.
|
// Verification du login.
|
||||||
@@ -135,12 +135,11 @@ if (isset($user->conf->PRODUIT_LIMIT_SIZE))
|
|||||||
}
|
}
|
||||||
if (isset($user->conf->MAIN_LANG_DEFAULT) && $user->conf->MAIN_LANG_DEFAULT)
|
if (isset($user->conf->MAIN_LANG_DEFAULT) && $user->conf->MAIN_LANG_DEFAULT)
|
||||||
{
|
{
|
||||||
if ($conf->langage != $user->conf->MAIN_LANG_DEFAULT)
|
if ($langs->getDefaultLang() != $user->conf->MAIN_LANG_DEFAULT)
|
||||||
{
|
{
|
||||||
// Si on a un langage perso diff<66>rent du langage global
|
// Si on a un langage perso diff<66>rent du langage courant global
|
||||||
$conf->langage=dolibarr_set_php_lang($user->conf->MAIN_LANG_DEFAULT);
|
$langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
|
||||||
|
$langs->setPhpLang($user->conf->MAIN_LANG_DEFAULT);
|
||||||
$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs", $conf->langage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -158,14 +158,14 @@ if (! $conf->global->MAIN_MENU_BARRELEFT) $conf->global->MAIN_MENU_BARRELEFT="de
|
|||||||
if (! $conf->global->MAIN_MENUFRONT_BARRELEFT) $conf->global->MAIN_MENUFRONT_BARRELEFT="default.php";
|
if (! $conf->global->MAIN_MENUFRONT_BARRELEFT) $conf->global->MAIN_MENUFRONT_BARRELEFT="default.php";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Positionne le langage global et localisation dans $conf->langage
|
* Charge l'objet de traduction et positionne langage courant global
|
||||||
* et charge l'objet de traduction
|
|
||||||
*/
|
*/
|
||||||
if (! $conf->global->MAIN_LANG_DEFAULT) $conf->global->MAIN_LANG_DEFAULT="fr_FR";
|
if (! $conf->global->MAIN_LANG_DEFAULT) $conf->global->MAIN_LANG_DEFAULT="fr_FR";
|
||||||
$conf->langage=dolibarr_set_php_lang($conf->global->MAIN_LANG_DEFAULT);
|
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/translate.class.php");
|
require_once(DOL_DOCUMENT_ROOT ."/translate.class.php");
|
||||||
$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs", $conf->langage);
|
$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||||
|
$langs->setDefaultLang($conf->global->MAIN_LANG_DEFAULT);
|
||||||
|
$langs->setPhpLang($conf->global->MAIN_LANG_DEFAULT);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -43,12 +43,10 @@ class Translate {
|
|||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
* \param dir Repertoire racine des fichiers de traduction
|
* \param dir Repertoire racine des fichiers de traduction
|
||||||
* \param defaultlang Langue par defaut <20> utiliser
|
|
||||||
*/
|
*/
|
||||||
function Translate($dir = "", $defaultlang = "")
|
function Translate($dir = "")
|
||||||
{
|
{
|
||||||
$this->dir=$dir;
|
$this->dir=$dir;
|
||||||
$this->setDefaultLang($defaultlang);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -68,14 +66,45 @@ class Translate {
|
|||||||
|
|
||||||
$langpart=split("_",$langlist[0]);
|
$langpart=split("_",$langlist[0]);
|
||||||
|
|
||||||
if (isset($langpart[1])) $defaultlang=$langpart[0]."_".strtoupper($langpart[1]);
|
if (isset($langpart[1])) $defaultlang=strtolower($langpart[0])."_".strtoupper($langpart[1]);
|
||||||
else $defaultlang=$langpart[0]."_".strtoupper($langpart[0]);
|
else $defaultlang=strtolower($langpart[0])."_".strtoupper($langpart[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->defaultlang=$defaultlang;
|
$this->defaultlang=$defaultlang;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Accesseur de this->defaultlang
|
||||||
|
* \return string Langue utilis<69>e
|
||||||
|
*/
|
||||||
|
function getDefaultLang()
|
||||||
|
{
|
||||||
|
return $this->defaultlang;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Positionne environnement PHP en fonction du langage
|
||||||
|
\remarks Le code langue long (fr_FR, en_US, ...) doit <20>tre positionn<6E>
|
||||||
|
\return int >0 si ok, <0 so ko
|
||||||
|
*/
|
||||||
|
function setPhpLang()
|
||||||
|
{
|
||||||
|
//dolibarr_syslog("Translate::set_php_lang: code_lang=$code_lang code_lang_tirer=$code_lang_tiret");
|
||||||
|
|
||||||
|
$code_lang_tiret=ereg_replace('_','-',$this->defaultlang);
|
||||||
|
setlocale(LC_ALL, $this->defaultlang); // Compenser pb de locale avec windows
|
||||||
|
setlocale(LC_ALL, $code_lang_tiret);
|
||||||
|
if (defined("MAIN_FORCE_SETLOCALE_LC_ALL") && MAIN_FORCE_SETLOCALE_LC_ALL) setlocale(LC_ALL, MAIN_FORCE_SETLOCALE_LC_ALL);
|
||||||
|
if (defined("MAIN_FORCE_SETLOCALE_LC_TIME") && MAIN_FORCE_SETLOCALE_LC_TIME) setlocale(LC_TIME, MAIN_FORCE_SETLOCALE_LC_TIME);
|
||||||
|
if (defined("MAIN_FORCE_SETLOCALE_LC_NUMERIC") && MAIN_FORCE_SETLOCALE_LC_NUMERIC) setlocale(LC_NUMERIC, MAIN_FORCE_SETLOCALE_LC_NUMERIC);
|
||||||
|
if (defined("MAIN_FORCE_SETLOCALE_LC_MONETARY") && MAIN_FORCE_SETLOCALE_LC_MONETARY) setlocale(LC_MONETARY, MAIN_FORCE_SETLOCALE_LC_MONETARY);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge en m<>moire le tableau de traduction pour un domaine particulier
|
* \brief Charge en m<>moire le tableau de traduction pour un domaine particulier
|
||||||
* Si le domaine est deja charg<72>, la fonction ne fait rien
|
* Si le domaine est deja charg<72>, la fonction ne fait rien
|
||||||
|
|||||||
Reference in New Issue
Block a user