mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Gestion multi-lingues
This commit is contained in:
parent
260c1d65b3
commit
4229deba6b
|
|
@ -1,21 +0,0 @@
|
|||
#do not change next line please !
|
||||
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
|
||||
10
htdocs/langs/en_US/main.lang
Normal file
10
htdocs/langs/en_US/main.lang
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Dolibarr language file - fr_FR - main
|
||||
charset="iso-8859-1"
|
||||
Add=Ajouter
|
||||
Delete=Supprimer
|
||||
Cancel=Annuler
|
||||
Modify=Modifier
|
||||
Edit=Editer
|
||||
ChooseLangage=Please choose your language
|
||||
User=User
|
||||
Group=Group
|
||||
21
htdocs/langs/en_US/soc.lang
Normal file
21
htdocs/langs/en_US/soc.lang
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Dolibarr language file - fr_FR - soc
|
||||
NewCompany=New company (prospect, customer, supplier)
|
||||
Company=Company
|
||||
Name=Name
|
||||
Surname=Surname
|
||||
Address=Addrese
|
||||
State=State
|
||||
Country=Country
|
||||
Phone=Phone
|
||||
Fax=Fax
|
||||
Zip=Zip Code
|
||||
Town=Town
|
||||
Web=Web
|
||||
ProfIdSiren=Professional ID
|
||||
ProfIdSiret=Professional ID
|
||||
ProfIdApe=APE
|
||||
TVAIntra=Intracommunautary VAT
|
||||
ProspectCustomer=Prospect / Customer
|
||||
Prospect=Prospect
|
||||
Customer=Customer
|
||||
Supplier=Supplier
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#do not change next line please !
|
||||
charset="iso-8859-1"
|
||||
|
||||
# Le fichier de langue pour le francais n'a pas besoin d'etre rempli pour l'instant
|
||||
# Sa presence suffit
|
||||
10
htdocs/langs/fr_FR/main.lang
Normal file
10
htdocs/langs/fr_FR/main.lang
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Dolibarr language file - fr_FR - main
|
||||
charset="iso-8859-1"
|
||||
Add=Ajouter
|
||||
Delete=Supprimer
|
||||
Cancel=Annuler
|
||||
Modify=Modifier
|
||||
Edit=Editer
|
||||
ChooseLangage=Please choose your language
|
||||
User=Utilisateur
|
||||
Group=Groupe
|
||||
21
htdocs/langs/fr_FR/soc.lang
Normal file
21
htdocs/langs/fr_FR/soc.lang
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Dolibarr language file - fr_FR - soc
|
||||
NewCompany=Nouvelle société (prospect, client, fournisseur)
|
||||
Company=Société
|
||||
Name=Nom
|
||||
Surname=Prénom
|
||||
Address=Adresse
|
||||
State=Département/Province/Canton
|
||||
Country=Pays
|
||||
Phone=Téléphone
|
||||
Fax=Fax
|
||||
Zip=Code postal
|
||||
Town=Ville
|
||||
Web=Web
|
||||
ProfIdSiren=SIREN
|
||||
ProfIdSiret=SIRET
|
||||
ProfIdApe=APE
|
||||
TVAIntra=Numéro de TVA Intracommunautaire
|
||||
ProspectCustomer=Prospect / Client
|
||||
Prospect=Prospect
|
||||
Customer=Client
|
||||
Supplier=Fournisseur
|
||||
|
|
@ -152,13 +152,15 @@ else
|
|||
require (DOL_DOCUMENT_ROOT ."/product.class.php");
|
||||
require (DOL_DOCUMENT_ROOT ."/menu.class.php");
|
||||
require (DOL_DOCUMENT_ROOT ."/societe.class.php");
|
||||
require (DOL_DOCUMENT_ROOT ."/translate.class.php");
|
||||
require (DOL_DOCUMENT_ROOT ."/boxes.php");
|
||||
require (DOL_DOCUMENT_ROOT ."/address.class.php");
|
||||
require (DOL_DOCUMENT_ROOT ."/notify.class.php");
|
||||
require (DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf152/fpdf.php");
|
||||
|
||||
|
||||
|
||||
define('FPDF_FONTPATH',DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdf152/font/');
|
||||
|
||||
/*
|
||||
* Definition de toutes les Constantes globales d'environement
|
||||
*
|
||||
|
|
@ -177,13 +179,32 @@ if ($result)
|
|||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Positionne le langage et localisation dans $conf->langage
|
||||
* et charge l'objet de traduction
|
||||
*/
|
||||
if (! defined(MAIN_LANG_DEFAULT))
|
||||
{
|
||||
define(MAIN_LANG_DEFAULT,"fr_FR");
|
||||
}
|
||||
$conf->langage=MAIN_LANG_DEFAULT;
|
||||
|
||||
// On corrige $conf->language si il ne vaut pas le code long: fr_FR par exemple
|
||||
if (strlen($conf->language) <= 3) {
|
||||
$conf->langage = strtolower($conf->langage)."_".strtoupper($conf->langage);
|
||||
}
|
||||
setlocale(LC_ALL, $conf->language);
|
||||
//setlocale(LC_TIME, $conf->language);
|
||||
|
||||
require (DOL_DOCUMENT_ROOT ."/translate.class.php");
|
||||
$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs", $conf->langage);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
//$db->close();
|
||||
|
||||
if (defined("MAIN_NOT_INSTALLED"))
|
||||
{
|
||||
Header("Location: install.php");
|
||||
|
|
@ -389,20 +410,6 @@ if (defined("MAIN_MAIL_NEW_SUBJECT"))
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Positionne le langage dans $conf->langage
|
||||
*/
|
||||
if (! defined(MAIN_LANG_DEFAULT))
|
||||
{
|
||||
define(MAIN_LANG_DEFAULT,"fr");
|
||||
}
|
||||
$conf->langage=MAIN_LANG_DEFAULT;
|
||||
$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);
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
$bc[0]="class=\"impair\"";
|
||||
|
|
@ -421,6 +428,7 @@ function top_menu($head, $title="", $target="")
|
|||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
||||
print "\n<html>";
|
||||
|
||||
$langs->load("main");
|
||||
print $langs->lang_header();
|
||||
print $head;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
require ("./main.inc.php");
|
||||
|
||||
function llxHeader($head = "") {
|
||||
global $user, $conf;
|
||||
global $user, $conf, $langs;
|
||||
$user->getrights('societe');
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@
|
|||
|
||||
require("pre.inc.php");
|
||||
|
||||
$langs->load("soc");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
|
|
@ -72,8 +76,9 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update')
|
|||
llxHeader();
|
||||
$form = new Form($db);
|
||||
|
||||
if ($_GET["action"] == 'create' && $user->rights->societe->creer)
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
if ($user->rights->societe->creer) {
|
||||
/*
|
||||
* Fiche societe en mode création
|
||||
*/
|
||||
|
|
@ -82,35 +87,35 @@ if ($_GET["action"] == 'create' && $user->rights->societe->creer)
|
|||
if ($_GET["type"]=='c') { $soc->client=1; }
|
||||
if ($_GET["type"]=='p') { $soc->client=2; }
|
||||
|
||||
print '<div class="titre">Nouvelle société (prospect, client, fournisseur)</div><br>';
|
||||
print '<div class="titre">'.$langs->trans("NewCompany").'</div><br>';
|
||||
print '<form action="soc.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="fournisseur" value="0">';
|
||||
|
||||
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
|
||||
print '<tr><td>Nom</td><td colspan="3"><input type="text" name="nom"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Adresse').'</td><td colspan="3"><textarea name="adresse" cols="30" rows="3" wrap="soft"></textarea></td></tr>';
|
||||
print '<tr><td>CP</td><td><input size="6" type="text" name="cp"> ';
|
||||
print 'Ville <input type="text" name="ville"></td>';
|
||||
print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" name="nom"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="30" rows="3" wrap="soft"></textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td><input size="6" type="text" name="cp"> ';
|
||||
print $langs->trans('Town').' <input type="text" name="ville"></td>';
|
||||
|
||||
print '<td>Département/Province/Canton</td><td>';
|
||||
print '<td>'.$langs->trans('State').'</td><td>';
|
||||
print $form->select_departement($soc->departement_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Pays</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
print $form->select_pays($soc->pays_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Téléphone').'</td><td><input type="text" name="tel"></td>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel"></td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax"></td></tr>';
|
||||
|
||||
print '<tr><td>Web</td><td colspan="3">http://<input size="40" type="text" name="url"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">http://<input size="40" type="text" name="url"></td></tr>';
|
||||
|
||||
print '<tr><td>Siren</td><td><input type="text" name="siren"></td>';
|
||||
print '<tr><td>'.$langs->trans('ProfIdSiren').'</td><td><input type="text" name="siren"></td>';
|
||||
|
||||
print '<td>Siret</td><td><input type="text" name="siret" size="15" maxlength="14" value="'.$soc->siret.'"></td></tr>';
|
||||
print '<td>'.$langs->trans('ProfIdSiret').'</td><td><input type="text" name="siret" size="15" maxlength="14" value="'.$soc->siret.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Ape</td><td><input type="text" name="ape" size="5" maxlength="4" value="'.$soc->ape.'"></td>';
|
||||
print '<tr><td>'.$langs->trans('Ape').'</td><td><input type="text" name="ape" size="5" maxlength="4" value="'.$soc->ape.'"></td>';
|
||||
print '<td>Capital</td><td><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.MAIN_MONNAIE.'</td></tr>';
|
||||
|
||||
print '<tr><td>Forme juridique</td><td colspan="3">';
|
||||
|
|
@ -121,26 +126,27 @@ if ($_GET["action"] == 'create' && $user->rights->societe->creer)
|
|||
print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2">Numéro de TVA Intracommunautaire</td><td colspan="2">';
|
||||
print '<tr><td colspan="2">'.$langs->trans('TVAIntra').'</td><td colspan="2">';
|
||||
|
||||
print '<input type="text" name="tva_intra_code" size="3" maxlength="2" value="'.$soc->tva_intra_code.'">';
|
||||
print '<input type="text" name="tva_intra_num" size="18" maxlength="18" value="'.$soc->tva_intra_num.'">';
|
||||
print '<br>Vous pouvez vérifier ce numéro sur le <a href="http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm" target="_blank">site</a> de la commission européenne';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Prospect / Client</td><td><select name="client">';
|
||||
print '<option value="2"'.($soc->client==2?' selected':'').'>Prospect</option>';
|
||||
print '<option value="1"'.($soc->client==1?' selected':'').'>Client</option>';
|
||||
print '<tr><td>'.$langs->trans('ProspectCustomer').'</td><td><select name="client">';
|
||||
print '<option value="2"'.($soc->client==2?' selected':'').'>'.$langs->trans('Prospect').'</option>';
|
||||
print '<option value="1"'.($soc->client==1?' selected':'').'>'.$langs->trans('Customer').'</option>';
|
||||
print '<option value="0"'.($soc->client==0?' selected':'').'>Ni client, ni prospect</option>';
|
||||
print '</select></td>';
|
||||
|
||||
print '<td>Fournisseur</td><td><select name="fournisseur">';
|
||||
print '<td>'.$langs->trans('Supplier').'</td><td><select name="fournisseur">';
|
||||
print_oui_non($soc->fournisseur);
|
||||
print '</select></td></tr>';
|
||||
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" value="Ajouter"></td></tr>';
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans('Add').'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
elseif ($_GET["action"] == 'edit')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,71 +16,40 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* ***************************************************************************
|
||||
* File : translate.class.php
|
||||
* Author : Eric SEIGNE
|
||||
* mailto:erics@rycks.com
|
||||
* http://www.rycks.com/
|
||||
* Date : 09/09/2001
|
||||
* Licence : GNU/GPL Version 2 ou plus
|
||||
* Modif : Rodolphe Quiedeville
|
||||
*
|
||||
* Description:
|
||||
* ------------
|
||||
*
|
||||
*
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Eric Seigne
|
||||
* @project AbulEdu
|
||||
* @copyright Eric Seigne 09/09/2001
|
||||
*
|
||||
* ************************************************************************* */
|
||||
|
||||
Class Translate {
|
||||
var $tab_langs;
|
||||
var $tab_loaded;
|
||||
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 $defaultlang;
|
||||
var $dir;
|
||||
var $debug;
|
||||
|
||||
//-------------------------------------------------
|
||||
/** Constructor */
|
||||
function Translate($dir = "", $sourceiso = "", $defaultiso = "", $sessioniso = "")
|
||||
{
|
||||
$this->tab_langs = array();
|
||||
function Translate($dir = "", $defaultlang = "") {
|
||||
$this->dir=$dir;
|
||||
$this->defaultlang=$defaultlang;
|
||||
|
||||
$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;
|
||||
function Load($domain = "main") {
|
||||
if ($this->tab_loaded[$domain]) { return; } # Ce fichier est deja chargé
|
||||
|
||||
$scandir = $this->dir."/".$this->defaultlang; # Repertoire de traduction
|
||||
$scandiralt = $this->dir."/fr_FR"; # Repertoire alternatif
|
||||
|
||||
$file_lang = $scandir . "/$domain.lang";
|
||||
if (! is_file($file_lang)) {
|
||||
$file_lang = $scandiralt . "/$domain.lang";
|
||||
}
|
||||
|
||||
//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;
|
||||
|
||||
|
||||
/* initialize tabs */
|
||||
$i = 0;
|
||||
if(is_dir($this->dir)) {
|
||||
$filet = $this->dir . "/" . $sessioniso;
|
||||
//print "Ouverture fichier $filet";
|
||||
if($fp = @fopen($filet,"rt")){
|
||||
if(is_file($file_lang)) {
|
||||
//print "Ouverture fichier $file_lang";
|
||||
if($fp = @fopen($file_lang,"rt")){
|
||||
$finded = 0;
|
||||
while (($ligne = fgets($fp,4096)) && ($finded == 0)){
|
||||
if ($ligne[0] != "\n" && $ligne[0] != " " && $ligne[0] != "#") {
|
||||
|
|
@ -90,6 +59,7 @@ Class Translate {
|
|||
}
|
||||
}
|
||||
fclose($fp);
|
||||
$this->tab_loaded[$domain]=1; # Marque ce fichier comme chargé
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -115,7 +85,7 @@ Class Translate {
|
|||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the list of available languages
|
||||
* [fr] Retourne la liste des langues disponibles
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user