diff --git a/www/admin/class_test.lang.php b/www/admin/class_test.lang.php index 0dd599e8..89fe667a 100644 --- a/www/admin/class_test.lang.php +++ b/www/admin/class_test.lang.php @@ -160,6 +160,12 @@ _textdomain($domain); _bindtextdomain($domain, $path); _bind_textdomain_codeset($domain, $encoding); echo "INPUT TEST $locale: " . $string . " => " . __($string) . "
"; +$single_string = 'single'; +$multi_string = 'multi'; +for ($n = 0; $n <= 3; $n++) { + echo "MULTI TEST $n: " . $single_string . "/" . $multi_string . " => " + . _ngettext($single_string, $multi_string, $n) . "
"; +} $locale = 'en_US.UTF-8'; _setlocale(LC_MESSAGES, $locale); @@ -167,6 +173,12 @@ _textdomain($domain); _bindtextdomain($domain, $path); _bind_textdomain_codeset($domain, $encoding); echo "INPUT TEST $locale: " . $string . " => " . __($string) . "
"; +$single_string = 'single'; +$multi_string = 'multi'; +for ($n = 0; $n <= 3; $n++) { + echo "MULTI TEST $n: " . $single_string . "/" . $multi_string . " => " + . _ngettext($single_string, $multi_string, $n) . "
"; +} print ""; diff --git a/www/includes/templates/admin/smarty_test.tpl b/www/includes/templates/admin/smarty_test.tpl index 2b83a97c..d38522cd 100644 --- a/www/includes/templates/admin/smarty_test.tpl +++ b/www/includes/templates/admin/smarty_test.tpl @@ -14,7 +14,12 @@ Translate Test with replace:
ORIGINAL: Original with string: %1 ({$replace})
TRANSLATED: {t 1=$replace}Original with string: %1{/t}
- TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t} + TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}
+ {capture assign="extra_title"}{t}INPUT TEST{/t}{/capture} + Capture test: {$extra_title}
+ {section name=plural_test start=0 loop=3} + Plural test {$smarty.section.plural_test.index}: {t count=$smarty.section.plural_test.index plural="multi"}single{/t}
+ {/section}
Variable variables:
diff --git a/www/lib/smarty-4.1.0/libs/plugins/block.t.php b/www/lib/smarty-4.1.0/libs/plugins/block.t.php index 0bc1a7d6..ba62a098 100644 --- a/www/lib/smarty-4.1.0/libs/plugins/block.t.php +++ b/www/lib/smarty-4.1.0/libs/plugins/block.t.php @@ -57,14 +57,18 @@ function smarty_gettext_strarg($str/*, $varargs... */) * - escape - sets escape mode: * - 'html' for HTML escaping, this is the default. * - 'js' for javascript escaping. + * - 'url' for url escaping. * - 'no'/'off'/0 - turns off escaping * - plural - The plural version of the text (2nd parameter of ngettext()) * - count - The item count for plural mode (3rd parameter of ngettext()) + * - domain - Textdomain to be used, default if skipped (dgettext() instead of gettext()) + * - context - gettext context. reserved for future use. + * */ // cs modified: __ calls instead of direct gettext calls -function smarty_block_t($params, $text, $template, &$repeat) +function smarty_block_t($params, $text) { if (!isset($text)) { return $text; @@ -122,15 +126,15 @@ function smarty_block_t($params, $text, $template, &$repeat) } } elseif (isset($context)) { if (is_callable('_npgettext')) { - $text == _npgettext($context, $text, $plural, $count); + $text = _npgettext($context, $text, $plural, $count); }/* elseif (is_callable('npgettext')) { $text = npgettext($context, $text, $plural, $count); } */ } else { if (is_callable('_ngettext')) { - $text == _ngettext($text, $plural, $count); + $text = _ngettext($text, $plural, $count); } elseif (is_callable('ngettext')) { - $text == ngettext($text, $plural, $count); + $text = ngettext($text, $plural, $count); } } } else { // use normal