From ca92001001bb928cd11ed31b2b7c57f74e7f58ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Feb 2005 21:25:39 +0000 Subject: [PATCH] =?UTF-8?q?Trad:=20La=20m=E9canique=20du=20programme=20d'i?= =?UTF-8?q?nstallation=20est=20=E9galement=20multilangue=20maintenant.=20R?= =?UTF-8?q?este=20=E0=20traduire=20les=20chaines.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/install/database.php | 12 +++-- htdocs/install/etape1.php | 6 ++- htdocs/install/etape2.php | 12 +++-- htdocs/install/etape4.php | 13 +++-- htdocs/install/etape5.php | 12 +++-- htdocs/install/fileconf.php | 11 +++-- htdocs/install/inc.php | 87 ++++++++++++++++++++++----------- htdocs/install/index.php | 81 ++++++++++++++---------------- htdocs/install/licence.php | 7 ++- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/install.lang | 3 ++ htdocs/langs/fr_FR/admin.lang | 1 + htdocs/langs/fr_FR/install.lang | 3 ++ htdocs/translate.class.php | 4 +- 14 files changed, 156 insertions(+), 97 deletions(-) create mode 100644 htdocs/langs/en_US/install.lang create mode 100644 htdocs/langs/fr_FR/install.lang diff --git a/htdocs/install/database.php b/htdocs/install/database.php index 4fe0651e1b3..6b8528ea861 100644 --- a/htdocs/install/database.php +++ b/htdocs/install/database.php @@ -20,14 +20,18 @@ * */ -$conf = "../conf/conf.php"; +include_once("./inc.php"); -if (is_readable($conf)) +$setuplang=$_POST["selectlang"]; +$langs->defaultlang=$setuplang; +$langs->load("install"); + + +if (is_readable($conffile)) { - include ($conf); + include_once($conffile); } -include("./inc.php"); pHeader(); diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 6f9a60d33b0..d1ad05514dc 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -31,12 +31,14 @@ include_once("./inc.php"); +$setuplang=$_POST["selectlang"]; +$langs->defaultlang=$setuplang; +$langs->load("install"); + pHeader("Fichier de configuration","etape2"); $etape = 1; -$conffile = "../conf/conf.php"; - // Répertoire des pages dolibarr $main_dir=isset($_POST["main_dir"])?$_POST["main_dir"]:''; diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index a82062f91f6..e7aa01d16e9 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -20,15 +20,19 @@ * $Source$ * */ -include("./inc.php"); +include_once("./inc.php"); + +$setuplang=$_POST["selectlang"]; +$langs->defaultlang=$setuplang; +$langs->load("install"); + pHeader("Création des objets de la base","etape4"); $etape = 2; -$conf = "../conf/conf.php"; -if (file_exists($conf)) +if (file_exists($conffile)) { - include($conf); + include_once($conffile); } if($dolibarr_main_db_type == "mysql") diff --git a/htdocs/install/etape4.php b/htdocs/install/etape4.php index 54b5db20914..e6834c801f0 100644 --- a/htdocs/install/etape4.php +++ b/htdocs/install/etape4.php @@ -21,12 +21,17 @@ * $Source$ * */ -include("./inc.php"); +include_once("./inc.php"); + +$setuplang=$_POST["selectlang"]; +$langs->defaultlang=$setuplang; +$langs->load("install"); + pHeader("Création du compte administrateur","etape5"); -$conf = "../conf/conf.php"; -if (file_exists($conf)) + +if (file_exists($conffile)) { - include($conf); + include_once($conffile); } if($dolibarr_main_db_type == "mysql") diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index f33f22c7be8..33c568e4bc6 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -28,13 +28,17 @@ \version $Revision$ */ -include("./inc.php"); +include_once("./inc.php"); + +$setuplang=$_POST["selectlang"]; +$langs->defaultlang=$setuplang; +$langs->load("install"); + $success=0; -$conf = "../conf/conf.php"; -if (file_exists($conf)) +if (file_exists($conffile)) { - include($conf); + include($conffile); } diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index c2cd86dc1cc..34732dfcf77 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -29,13 +29,16 @@ \version $Revision$ */ -include("./inc.php"); +include_once("./inc.php"); + +$setuplang=$_POST["selectlang"]; +$langs->defaultlang=$setuplang; +$langs->load("install"); + pHeader("Fichier de configuration","etape1"); -$conf = "../conf/conf.php"; - // Ici, le fichier conf.php existe et est forcément editable car le test a été fait précédemment. -include($conf); +include_once($conffile); print ''; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 892933f7bcd..6870ed37c18 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -22,44 +22,75 @@ * */ -$etapes=5; +/** \file htdocs/install/inc.php + \brief Fichier include du programme d'installation + \version $Revision$ +*/ + + $docurl = 'documentation'; +$conffile = "../conf/conf.php"; + + +// Récupère langues du navigateur et defini langcode +$langpref=$_SERVER['HTTP_ACCEPT_LANGUAGE']; +$langpref=eregi_replace(";[^,]*","",$langpref); +$langpref=eregi_replace("-","_",$langpref); +$langlist=split("[;,]",$langpref); +$langpart=split("_",$langlist[0]); +if ($langpart[1]) $langcode=$langpart[0]."_".strtoupper($langpart[1]); +else $langcode=$langpart[0]."_".strtoupper($langpart[0]); +// Defini objet langs +require_once("../translate.class.php"); +$langs = new Translate("../langs", $langcode); + + function pHeader($soutitre,$next) { + global $langs; + $langs->load("main"); + $langs->load("admin"); -print ' - - - - -Dolibarr Installation - - -
-Dolibarr Installation -
-'; - print ' -'; -print '
'.$soutitre.'
-
-'; + print ''; + print ''; + print ''; + print ''; + print ''.$langs->trans("DolibarrSetup").''; + print ''; + print ''; + + print '
'; + print ''.$langs->trans("DolibarrSetup").''; + print '
'; + + print ''; + print '
'; + if ($soutitre) { + print '
'.$soutitre.'
'; + } + print '
'; } -function pFooter($nonext=0) +function pFooter($nonext=0,$addlang=1) { -print '
'; -if ($nonext == 0) - { - print '
'; - } -print ' - - -'; + global $langs; + $langs->load("main"); + $langs->load("admin"); + + print '
'; + if (! $nonext) + { + print '
">
'; + } + if ($addlang) { + print ''; } + print ''; + print ''; + print ''; +} function dolibarr_syslog($message) diff --git a/htdocs/install/index.php b/htdocs/install/index.php index 0dc2524dd94..2cdb49bf994 100644 --- a/htdocs/install/index.php +++ b/htdocs/install/index.php @@ -27,60 +27,53 @@ \version $Revision$ */ -include("./inc.php"); -pHeader("Bienvenu dans Dolibarr", "licence"); // Etape suivante = license +include_once("./inc.php"); -print "Nous avons fait en sorte que l'installation soit le plus simple possible, vous n'avez qu'à suivre les étapes une à une."; - - -$conf = "../conf/conf.php"; - - -if (is_readable($conf)) +// Si fichier conf existe deja, on est pas sur une premiere install, +// on ne passe donc pas par la page de choix de langue +if (file_exists($conffile)) { - include ($conf); -} -else -{ - $fp = @fopen("$conf", "w"); - if($fp) - { - @fwrite($fp, '"); - fclose($fp); - } + header("Location: check.php"); } -if (!file_exists($conf)) -{ - print "

Le fichier de configuration conf.php n'existe pas !
"; - print "Vous devez créer un fichier htdocs/conf/conf.php et donner les droits d'écriture dans celui-ci au serveur Apache.

"; - print 'Corrigez le problème et rechargez la page'; +pHeader("", "check"); // Etape suivante = index2 - $err++; -} -else -{ - if (!is_writable("../conf/conf.php")) - { - print "

Le fichier de configuration conf.php existe.
"; - print "Le fichier conf.php n'est pas accessible en écriture, vérifiez les droits sur celui-ci, le serveur Apache doit avoir le droit d'écrire dans ce fichier le temps de la configuration (chmod 666 par exemple)
"; - - $err++; - } - else - { - print "

Le fichier de configuration conf.php existe.
"; - print "Le fichier conf.php est accessible en écriture

Vous pouvez continuer..."; +print '
'; + +// Propose la langue d'installation +$langs->load("admin"); +$langs_available=$langs->get_available_languages(".."); +$selected=$langs->defaultlang; + +print '

'; +print '
'; +print ''; +print '
'.$langs->trans("DefaultLanguage").' :  '; +print '
'; - } -} // Si pas d'erreur, on affiche le bouton pour passer à l'étape suivante -if ($err == 0) pFooter(); +if ($err == 0) pFooter(0,0); ?> diff --git a/htdocs/install/licence.php b/htdocs/install/licence.php index d4ed6847227..cc0a7d42653 100644 --- a/htdocs/install/licence.php +++ b/htdocs/install/licence.php @@ -20,7 +20,12 @@ * */ -include("./inc.php"); +include_once("./inc.php"); + +$setuplang=$_POST["selectlang"]; +$langs->defaultlang=$setuplang; +$langs->load("install"); + pHeader("Licence d'utilisation","fileconf"); print '
';
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 2f85ae32af2..7ffd3111af7 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1,5 +1,6 @@
 # Dolibarr language file - en_US - admin
 Version=Version
+DolibarrSetup=Dolibarr setup
 GlobalSetup=Global setup
 GUISetup=GUI setup
 DictionnarySetup=Dictionnary setup
diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang
new file mode 100644
index 00000000000..9b68ce9f0db
--- /dev/null
+++ b/htdocs/langs/en_US/install.lang
@@ -0,0 +1,3 @@
+# Dolibarr language file - en_US - install
+InstallEasy=We tried to make Dolibarr setup as easy as possible. Just follow instructions step by step.
+DolibarrWelcome=Welcome on Dolibarr
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index b1c4285b581..7f2776e88ec 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1,5 +1,6 @@
 # Dolibarr language file - fr_FR - admin
 Version=Version
+DolibarrSetup=Installation Dolibarr
 GlobalSetup=Général
 GUISetup=Interface
 DictionnarySetup=Dictionnaires
diff --git a/htdocs/langs/fr_FR/install.lang b/htdocs/langs/fr_FR/install.lang
new file mode 100644
index 00000000000..5aeef04760b
--- /dev/null
+++ b/htdocs/langs/fr_FR/install.lang
@@ -0,0 +1,3 @@
+# Dolibarr language file - fr_FR - install
+InstallEasy=Nous avons fait en sorte que l'installation soit le plus simple possible, vous n'avez qu'à suivre les étapes une à une.
+DolibarrWelcome=Bienvenu sur Dolibarr
\ No newline at end of file
diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php
index 17c280a83f9..a5a6975a1e6 100644
--- a/htdocs/translate.class.php
+++ b/htdocs/translate.class.php
@@ -147,10 +147,10 @@ class Translate {
      *  \return      array     list of languages
      */
 		
-    function get_available_languages()
+    function get_available_languages($langdir=DOL_DOCUMENT_ROOT)
     {
       // On parcour le répertoire langs pour détecter les langues disponibles
-      $handle=opendir(DOL_DOCUMENT_ROOT ."/langs");
+      $handle=opendir($langdir ."/langs");
       $langs_available=array();
       while ($file = trim(readdir($handle))){
     	if($file != "." && $file != ".." && $file != "CVS") {