Fix: Les traductions peuvent contenir des caractères spéciaux (entities). On propose 2 fonction, la standard "trans" qui converti via htmlentities et une secondaire "transnoentities" pour les cas ou le texte ou paramètre ne doit pas etre converti.
This commit is contained in:
parent
fdd7966c22
commit
af9e19a0bc
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -546,7 +546,7 @@ function add_row_for_webcal_link()
|
|||||||
{
|
{
|
||||||
print '<tr><td width="10%">'.$langs->trans("AddCalendarEntry").'</td>';
|
print '<tr><td width="10%">'.$langs->trans("AddCalendarEntry").'</td>';
|
||||||
print '<td><input type="checkbox" disabled name="todo_webcal">';
|
print '<td><input type="checkbox" disabled name="todo_webcal">';
|
||||||
print ' '.$langs->trans("ErrorWebcalLoginNotDefined","<a href=\"/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
|
print ' '.$langs->transnoentities("ErrorWebcalLoginNotDefined","<a href=\"/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,9 +122,24 @@ class Translate {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function trans($str, $param1='', $param2='', $param3='') {
|
function trans($str, $param1='', $param2='', $param3='') {
|
||||||
|
return $this->transnoentities($str,htmlentities($param1),htmlentities($param2),htmlentities($param3));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Retourne la version traduite du texte passé en paramètre
|
||||||
|
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
|
||||||
|
* et si toujours pas trouvé, il est retourné tel quel
|
||||||
|
* \param str chaine a traduire
|
||||||
|
* \param param1 chaine de param1
|
||||||
|
* \param param2 chaine de param1
|
||||||
|
* \param param3 chaine de param1
|
||||||
|
* \return string chaine traduite
|
||||||
|
*/
|
||||||
|
|
||||||
|
function transnoentities($str, $param1='', $param2='', $param3='') {
|
||||||
if ($this->tab_translate[$str]) {
|
if ($this->tab_translate[$str]) {
|
||||||
// Si la traduction est disponible
|
// Si la traduction est disponible
|
||||||
return sprintf($this->tab_translate[$str],htmlentities($param1),htmlentities($param2),htmlentities($param3));
|
return sprintf($this->tab_translate[$str],$param1,$param2,$param3);
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user