Ticket #569: 569-jLocale-support-multiline-rendering-in-strings.2.diff
| File 569-jLocale-support-multiline-rendering-in-strings.2.diff, 4.0 kB (added by Julien, 4 months ago) |
|---|
-
build/manifests/testapp.mn
old new 108 108 cd testapp/modules/jelix_tests/locales/en_EN 109 109 tests1.UTF-8.properties 110 110 tests3.UTF-8.properties 111 tests4.UTF-8.properties 111 112 cd testapp/modules/jelix_tests/templates 112 113 menu.tpl 113 114 test_plugin_counter_init_allarg_noexeption.tpl -
testapp/modules/jelix_tests/locales/en_EN/tests4.UTF-8.properties
old new -
testapp/modules/jelix_tests/tests/core.jlocale.html_cli.php
old new 178 178 } 179 179 $GLOBALS['gJConfig']->charset = 'UTF-8'; 180 180 } 181 182 function testLineBreak(){ 183 $this->assertEqual("This sentence has a line break\n after the word \"break\"",jLocale::get('tests4.string.with.line.break',null,'en_EN','UTF-8')); 184 } 181 185 182 186 } 183 187 -
lib/jelix/plugins/tpl/html/function.jlocale.php
old new 3 3 * @package jelix 4 4 * @subpackage jtpl_plugin 5 5 * @author Jouanneau Laurent 6 * @contributor 6 * @contributor Julien Issler 7 7 * @copyright 2005-2007 Jouanneau laurent 8 * @copyright 2008 Julien Issler 8 9 * @link http://www.jelix.org 9 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 11 */ … … 20 21 { 21 22 if(func_num_args() == 3 && is_array(func_get_arg(2))){ 22 23 $param = func_get_arg(2); 23 echo htmlspecialchars(jLocale::get($locale, $param));24 echo nl2br(htmlspecialchars(jLocale::get($locale, $param))); 24 25 }elseif(func_num_args() > 2){ 25 26 $params = func_get_args(); 26 27 unset($params[0]); 27 28 unset($params[1]); 28 echo htmlspecialchars(jLocale::get($locale, $params));29 echo nl2br(htmlspecialchars(jLocale::get($locale, $params))); 29 30 }else{ 30 echo htmlspecialchars(jLocale::get($locale));31 echo nl2br(htmlspecialchars(jLocale::get($locale))); 31 32 } 32 33 } 33 34 -
lib/jelix/core/jLocale.class.php
old new 4 4 * @subpackage core 5 5 * @author Laurent Jouanneau 6 6 * @author Gerald Croes 7 * @contributor 7 * @contributor Julien Issler 8 8 * @copyright 2001-2005 CopixTeam, 2005-2007 Laurent Jouanneau 9 9 * Some parts of this file are took from Copix Framework v2.3dev20050901, CopixI18N.class.php, http://www.copix.org. 10 10 * copyrighted by CopixTeam and released under GNU Lesser General Public Licence. 11 11 * initial authors : Gerald Croes, Laurent Jouanneau. 12 12 * enhancement by Laurent Jouanneau for Jelix. 13 * @copyright 2008 Julien Issler 13 14 * @link http://www.jelix.org 14 15 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 15 16 */ … … 138 139 $value=''; 139 140 } 140 141 141 $this->_strings[$charset][$key] = $value;142 $this->_strings[$charset][$key] = str_replace('\n',"\n",$value); 142 143 143 144 }elseif(preg_match("/^\s*(\#.*)?$/",$line, $match)){ 144 145 // ok, juste un commentaire
