diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php
index cb45c12351e..a48543a00f6 100644
--- a/htdocs/core/boxes/box_project.php
+++ b/htdocs/core/boxes/box_project.php
@@ -34,12 +34,12 @@ class box_project extends ModeleBoxes
var $boximg="object_projectpub";
var $boxlabel;
//var $depends = array("projet");
-
+
/**
* @var DoliDB Database handler.
*/
public $db;
-
+
var $param;
var $info_box_head = array();
@@ -54,8 +54,9 @@ class box_project extends ModeleBoxes
function __construct($db,$param='')
{
global $user, $langs;
- $langs->load("boxes");
- $langs->load("projects");
+
+ // Load translation files required by the page
+ $langs->loadLangs(array('boxes', 'projects'));
$this->db = $db;
$this->boxlabel="Projects";
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 595f3e5e81a..b67bdde3ea0 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -271,9 +271,8 @@ class FormMail extends Form
if (! is_object($form)) $form=new Form($this->db);
- $langs->load("other");
- $langs->load("mails");
-
+ // Load translation files required by the page
+ $langs->loadLangs(array('other', 'mails'));
// Clear temp files. Must be done at beginning, before call of triggers
if (GETPOST('mode','alpha') == 'init' || (GETPOST('modelmailselected','alpha') && GETPOST('modelmailselected','alpha') != '-1'))
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index c0f4a3f75d2..5cad99b2a9f 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -126,9 +126,8 @@ class FormTicket
{
global $conf, $langs, $user, $hookmanager;
- $langs->load("other");
- $langs->load("mails");
- $langs->load("ticket");
+ // Load translation files required by the page
+ $langs->loadLangs(array('other', 'mails', 'ticket'));
$form = new Form($this->db);
$formcompany = new FormCompany($this->db);
diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php
index 4be484e1aa4..e8a7dfcb0ff 100644
--- a/htdocs/core/lib/categories.lib.php
+++ b/htdocs/core/lib/categories.lib.php
@@ -33,8 +33,8 @@ function categories_prepare_head($object,$type)
{
global $langs, $conf, $user;
- $langs->load("categories");
- $langs->load("products");
+ // Load translation files required by the page
+ $langs->loadLangs(array('categories', 'products'));
$h = 0;
$head = array();
@@ -48,7 +48,7 @@ function categories_prepare_head($object,$type)
$head[$h][1] = $langs->trans("Photos");
$head[$h][2] = 'photos';
$h++;
-
+
if (! empty($conf->global->MAIN_MULTILANGS))
{
$head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&type='.$type;
@@ -56,7 +56,7 @@ function categories_prepare_head($object,$type)
$head[$h][2] = 'translation';
$h++;
}
-
+
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
@@ -87,7 +87,7 @@ function categoriesadmin_prepare_head()
$head[$h][1] = $langs->trans("Setup");
$head[$h][2] = 'setup';
$h++;
-
+
$head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsCategories");
$head[$h][2] = 'attributes_categories';
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 783e6a0cb35..8a22337cea8 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -194,9 +194,10 @@ function dol_print_file($langs,$filename,$searchalt=0)
*/
function dol_print_object_info($object, $usetable=0)
{
- global $langs,$db;
- $langs->load("other");
- $langs->load("admin");
+ global $langs, $db;
+
+ // Load translation files required by the page
+ $langs->loadLangs(array('other', 'admin'));
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php
index 0f0cfc267d3..05ee9535225 100644
--- a/htdocs/core/lib/payments.lib.php
+++ b/htdocs/core/lib/payments.lib.php
@@ -62,7 +62,6 @@ function payment_prepare_head(Paiement $object)
*/
function payment_supplier_prepare_head(Paiement $object)
{
-
global $langs, $conf;
$h = 0;
@@ -127,8 +126,9 @@ function showOnlinePaymentUrl($type,$ref)
{
global $conf, $langs;
- $langs->load("payment");
- $langs->load("paybox");
+ // Load translation files required by the page
+ $langs->loadLangs(array('payment', 'paybox'));
+
$servicename='Online';
$out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'
';
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 731f8859eba..1c704392c6b 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -190,8 +190,9 @@ function product_prepare_head($object)
function productlot_prepare_head($object)
{
global $db, $langs, $conf, $user;
- $langs->load("products");
- $langs->load("productbatch");
+
+ // Load translation files required by the page
+ $langs->loadLangs(array("products","productbatch"));
$h = 0;
$head = array();
@@ -200,7 +201,7 @@ function productlot_prepare_head($object)
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
-
+
// Attachments
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php
index 71c287f7119..c01026b445d 100644
--- a/htdocs/core/lib/sendings.lib.php
+++ b/htdocs/core/lib/sendings.lib.php
@@ -36,8 +36,8 @@ function shipping_prepare_head($object)
{
global $db, $langs, $conf, $user;
- $langs->load("sendings");
- $langs->load("deliveries");
+ // Load translation files required by the page
+ $langs->loadLangs(array("sendings","deliveries"));
$h = 0;
$head = array();
@@ -121,8 +121,8 @@ function delivery_prepare_head($object)
{
global $langs, $conf, $user;
- $langs->load("sendings");
- $langs->load("deliveries");
+ // Load translation files required by the page
+ $langs->loadLangs(array("sendings","deliveries"));
$h = 0;
$head = array();
diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php
index b11d809caf2..2790c80c8e0 100644
--- a/htdocs/core/lib/signature.lib.php
+++ b/htdocs/core/lib/signature.lib.php
@@ -28,8 +28,9 @@ function showOnlineSignatureUrl($type,$ref)
{
global $conf, $langs;
- $langs->load("payment");
- $langs->load("paybox");
+ // Load translation files required by the page
+ $langs->loadLangs(array("payment","paybox"));
+
$servicename='Online';
$out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlineSignature",$servicename).'
';
diff --git a/htdocs/core/lib/supplier_proposal.lib.php b/htdocs/core/lib/supplier_proposal.lib.php
index 1756c92a32a..a0f52d6de15 100644
--- a/htdocs/core/lib/supplier_proposal.lib.php
+++ b/htdocs/core/lib/supplier_proposal.lib.php
@@ -32,8 +32,9 @@
function supplier_proposal_prepare_head($object)
{
global $db, $langs, $conf, $user;
- $langs->load("supplier_proposal");
- $langs->load("compta");
+
+ // Load translation files required by the page
+ $langs->loadLangs(array("supplier_proposal","compta"));
$h = 0;
$head = array();
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 039939aac55..12a7a24fe48 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -80,8 +80,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
- $langs->load("companies");
- $langs->load("suppliers");
+ // Load translation files required by the page
+ $langs->loadLangs(array("companies","suppliers"));
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
@@ -174,8 +174,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
- $langs->load("compta");
- $langs->load("banks");
+ // Load translation files required by the page
+ $langs->loadLangs(array("compta","banks"));
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
@@ -528,8 +528,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || $leftmenu=="setup")
{
- $langs->load("admin");
- $langs->load("help");
+ // Load translation files required by the page
+ $langs->loadLangs(array("admin","help"));
$warnpicto='';
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY))
@@ -1176,10 +1176,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
*/
if ($mainmenu == 'bank')
{
- $langs->load("withdrawals");
- $langs->load("banks");
- $langs->load("bills");
- $langs->load('categories');
+ // Load translation files required by the page
+ $langs->loadLangs(array("withdrawals","banks","bills","categories"));
// Bank-Caisse
if (! empty($conf->banque->enabled))
@@ -1402,8 +1400,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Leave/Holiday/Vacation module
if (! empty($conf->holiday->enabled))
{
- $langs->load("holiday");
- $langs->load("trips");
+ // Load translation files required by the page
+ $langs->loadLangs(array("holiday","trips"));
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
$newmenu->add("/holiday/card.php?action=request", $langs->trans("New"), 1,$user->rights->holiday->write);
@@ -1499,8 +1497,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
if (! empty($conf->adherent->enabled))
{
- $langs->load("members");
- $langs->load("compta");
+ // Load translation files required by the page
+ $langs->loadLangs(array("members","compta"));
$newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members",$langs->trans("Members"),0,$user->rights->adherent->lire, '', $mainmenu, 'members');
$newmenu->add("/adherents/card.php?leftmenu=members&action=create",$langs->trans("NewMember"),1,$user->rights->adherent->creer);
diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php
index 8fb183a2446..0099d0561d2 100644
--- a/htdocs/core/modules/action/rapport.pdf.php
+++ b/htdocs/core/modules/action/rapport.pdf.php
@@ -68,8 +68,9 @@ class CommActionRapport
function __construct($db, $month, $year)
{
global $conf,$langs;
- $langs->load("commercial");
- $langs->load("projects");
+
+ // Load translation files required by the page
+ $langs->loadLangs(array("commercial","projects"));
$this->db = $db;
$this->description = "";
diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php
index 9143d87ea73..c8c5c4ad32a 100644
--- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php
+++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php
@@ -47,10 +47,8 @@ class pdf_ban extends ModeleBankAccountDoc
{
global $conf,$langs,$mysoc;
- $langs->load("main");
- $langs->load("bank");
- $langs->load("withdrawals");
- $langs->load("companies");
+ // Load translation files required by the page
+ $langs->loadLangs(array("main","bank","withdrawals","companies"));
$this->db = $db;
$this->name = "ban";
diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
index 166c7f389d1..5866e57233b 100644
--- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
+++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@@ -53,8 +53,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
{
global $conf,$langs,$mysoc;
- $langs->load("main");
- $langs->load("companies");
+ // Load translation files required by the page
+ $langs->loadLangs(array("main","companies"));
$this->db = $db;
$this->name = "ODT templates";
@@ -98,8 +98,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
{
global $conf,$langs;
- $langs->load("companies");
- $langs->load("errors");
+ // Load translation files required by the page
+ $langs->loadLangs(array("errors","companies"));
$form = new Form($this->db);
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index b58a67a2cb0..f19cafc3dcf 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -52,8 +52,8 @@ class doc_generic_contract_odt extends ModelePDFContract
{
global $conf,$langs,$mysoc;
- $langs->load("main");
- $langs->load("companies");
+ // Load translation files required by the page
+ $langs->loadLangs(array("main","companies"));
$this->db = $db;
$this->name = "ODT templates";
diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
index 9971c3acd81..41a5f2e992c 100644
--- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
+++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
@@ -54,8 +54,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
{
global $conf,$langs,$mysoc;
- $langs->load("main");
- $langs->load("companies");
+ // Load translation files required by the page
+ $langs->loadLangs(array("main","companies"));
$this->db = $db;
$this->name = "ODT templates";
@@ -99,8 +99,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
{
global $conf,$langs;
- $langs->load("companies");
- $langs->load("errors");
+ // Load translation files required by the page
+ $langs->loadLangs(array("errors","companies"));
$form = new Form($this->db);
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index 45f404f276e..0ba38215c61 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -116,10 +116,9 @@ class mailing_contacts1 extends MailingTargets
function formFilter()
{
global $langs;
- $langs->load("companies");
- $langs->load("commercial");
- $langs->load("suppliers");
- $langs->load("categories");
+
+ // Load translation files required by the page
+ $langs->loadLangs(array("commercial","companies","suppliers","categories"));
$s='';
diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php
index ab0cca6e0d4..aa57e954f04 100644
--- a/htdocs/core/modules/mailings/fraise.modules.php
+++ b/htdocs/core/modules/mailings/fraise.modules.php
@@ -109,9 +109,9 @@ class mailing_fraise extends MailingTargets
function formFilter()
{
global $conf, $langs;
- $langs->load("members");
- $langs->load("categories");
- $langs->load("companies");
+
+ // Load translation files required by the page
+ $langs->loadLangs(array("members","companies","categories"));
$form=new Form($this->db);