From 4eb37abed96b3febea6be722eb33436262b291f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 25 Aug 2013 06:53:59 +0200 Subject: [PATCH] New: Translate the email to change password. --- ChangeLog | 1 + htdocs/langs/en_US/other.lang | 6 ++++++ htdocs/langs/en_US/users.lang | 3 ++- htdocs/langs/fr_FR/other.lang | 6 ++++++ htdocs/user/class/user.class.php | 35 ++++++++++++++++++-------------- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7905186faaa..ed5daa0f8fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,6 +55,7 @@ For users: For translators: - Qual: Normalized sort order of all languages files with english reference files. - New: Add language code files for South Africa. +- New: Translate the email to change password. For developers: - New: DolGraph can build graph with three lines. diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 4ea725ca84f..6f12f1ce4d1 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -174,6 +174,12 @@ StartUpload=Start upload CancelUpload=Cancel upload FileIsTooBig=Files is too big PleaseBePatient=Please be patient... +RequestToResetPasswordReceived=A request to change your Dolibarr password has been received +NewKeyIs=This is your new keys to login +NewKeyWillBe=Your new key to login to software will be +ClickHereToGoTo=Click here to go to %s +YouMustClickToChange=You must however first click on the following link to validate this password change +ForgetIfNothing=If you didn't request this change, just forget this email. Your credentials are kept safe. ##### Calendar common ##### AddCalendarEntry=Add entry in calendar %s diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 931eb13b05b..e8abd699b9c 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -116,4 +116,5 @@ NbOfUsers=Nb of users DontDowngradeSuperAdmin=Only a superadmin can downgrade a superadmin HierarchicalResponsible=Hierarchical responsible HierarchicView=Hierarchical view -UseTypeFieldToChange=Use field Type to change \ No newline at end of file +UseTypeFieldToChange=Use field Type to change + diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index a749069e99d..516eafc4f52 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -174,6 +174,12 @@ StartUpload=Transférer CancelUpload=Annuler le transfert FileIsTooBig=Le fichier est trop volumineux PleaseBePatient=Merci de patienter quelques instants… +RequestToResetPasswordReceived=Une demande de modification de mot de passe a été reçue +NewKeyIs=Voici vos nouveaux identifiants pour vous connecter +NewKeyWillBe=Vos nouveaux identifiants pour vous connecter à l'application seront +ClickHereToGoTo=Cliquez ici pour aller sur %s +YouMustClickToChange=Vous devez toutefois auparavant cliquer sur le lien suivant, afin de valider ce changement de mot de passe +ForgetIfNothing=Si vous n'êtes pas à l'origine de la demande, ignorez simplement ce mail. Votre accès reste sécurisé. ##### Calendar common ##### AddCalendarEntry=Ajouter entrée dans le calendrier %s diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 39fc2132042..65ea0dd73f1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -96,7 +96,7 @@ class User extends CommonObject var $users; // To store all tree of users hierarchy var $parentof; // To store an array of all parents for all ids. - + var $accountancy_code; // Accountancy code in prevision of the complete accountancy module @@ -1457,7 +1457,6 @@ class User extends CommonObject require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $subject = $langs->trans("SubjectNewPassword"); $msgishtml=0; // Define $msg @@ -1474,35 +1473,41 @@ class User extends CommonObject $outputlangs=$langs; } + $outputlangs->load("main"); + $outputlangs->load("errors"); + $outputlangs->load("users"); + $outputlangs->load("other"); + + $subject = $outputlangs->trans("SubjectNewPassword"); + // Define $urlwithroot //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); //$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - // TODO Use outputlangs to translate messages if (! $changelater) { - $mesg.= "A request to change your Dolibarr password has been received.\n"; - $mesg.= "This is your new keys to login:\n\n"; - $mesg.= $langs->trans("Login")." : $this->login\n"; - $mesg.= $langs->trans("Password")." : $password\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= "\n"; $url = $urlwithroot; - $mesg.= 'Click here to go to Dolibarr: '.$url."\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $conf->global->MAIN_APPLICATION_TITLE).': '.$url."\n\n"; $mesg.= "--\n"; - $mesg.= $user->getFullName($langs); // Username that make then sending + $mesg.= $user->getFullName($outputlangs); // Username that make then sending } else { - $mesg.= "A request to change your Dolibarr password has been received.\n"; - $mesg.= "Your new key to login will be:\n\n"; - $mesg.= $langs->trans("Login")." : $this->login\n"; - $mesg.= $langs->trans("Password")." : $password\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= "\n"; - $mesg.= "You must click on the folowing link to validate its change.\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n"; $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordmd5=".dol_hash($password); $mesg.= $url."\n\n"; - $mesg.= "If you didn't ask anything, just forget this email\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n"; dol_syslog(get_class($this)."::send_password url=".$url); } $mailfile = new CMailFile( -- GitLab