Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c35341e8b |
@@ -160,6 +160,12 @@ _textdomain($domain);
|
|||||||
_bindtextdomain($domain, $path);
|
_bindtextdomain($domain, $path);
|
||||||
_bind_textdomain_codeset($domain, $encoding);
|
_bind_textdomain_codeset($domain, $encoding);
|
||||||
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "<br>";
|
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "<br>";
|
||||||
|
$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) . "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
$locale = 'en_US.UTF-8';
|
$locale = 'en_US.UTF-8';
|
||||||
_setlocale(LC_MESSAGES, $locale);
|
_setlocale(LC_MESSAGES, $locale);
|
||||||
@@ -167,6 +173,12 @@ _textdomain($domain);
|
|||||||
_bindtextdomain($domain, $path);
|
_bindtextdomain($domain, $path);
|
||||||
_bind_textdomain_codeset($domain, $encoding);
|
_bind_textdomain_codeset($domain, $encoding);
|
||||||
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "<br>";
|
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "<br>";
|
||||||
|
$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) . "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,12 @@
|
|||||||
<b>Translate Test with replace:</b><br>
|
<b>Translate Test with replace:</b><br>
|
||||||
ORIGINAL: Original with string: %1 ({$replace})<br>
|
ORIGINAL: Original with string: %1 ({$replace})<br>
|
||||||
TRANSLATED: {t 1=$replace}Original with string: %1{/t}<br>
|
TRANSLATED: {t 1=$replace}Original with string: %1{/t}<br>
|
||||||
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}
|
TRANSLATED (escape): {t escape=on 1=$replace}Original with string: %1{/t}<br>
|
||||||
|
{capture assign="extra_title"}{t}INPUT TEST{/t}{/capture}
|
||||||
|
Capture test: {$extra_title}<br>
|
||||||
|
{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}<br>
|
||||||
|
{/section}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<b>Variable variables:</b><br>
|
<b>Variable variables:</b><br>
|
||||||
|
|||||||
@@ -57,14 +57,18 @@ function smarty_gettext_strarg($str/*, $varargs... */)
|
|||||||
* - escape - sets escape mode:
|
* - escape - sets escape mode:
|
||||||
* - 'html' for HTML escaping, this is the default.
|
* - 'html' for HTML escaping, this is the default.
|
||||||
* - 'js' for javascript escaping.
|
* - 'js' for javascript escaping.
|
||||||
|
* - 'url' for url escaping.
|
||||||
* - 'no'/'off'/0 - turns off escaping
|
* - 'no'/'off'/0 - turns off escaping
|
||||||
* - plural - The plural version of the text (2nd parameter of ngettext())
|
* - plural - The plural version of the text (2nd parameter of ngettext())
|
||||||
* - count - The item count for plural mode (3rd 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
|
// 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)) {
|
if (!isset($text)) {
|
||||||
return $text;
|
return $text;
|
||||||
@@ -122,15 +126,15 @@ function smarty_block_t($params, $text, $template, &$repeat)
|
|||||||
}
|
}
|
||||||
} elseif (isset($context)) {
|
} elseif (isset($context)) {
|
||||||
if (is_callable('_npgettext')) {
|
if (is_callable('_npgettext')) {
|
||||||
$text == _npgettext($context, $text, $plural, $count);
|
$text = _npgettext($context, $text, $plural, $count);
|
||||||
}/* elseif (is_callable('npgettext')) {
|
}/* elseif (is_callable('npgettext')) {
|
||||||
$text = npgettext($context, $text, $plural, $count);
|
$text = npgettext($context, $text, $plural, $count);
|
||||||
} */
|
} */
|
||||||
} else {
|
} else {
|
||||||
if (is_callable('_ngettext')) {
|
if (is_callable('_ngettext')) {
|
||||||
$text == _ngettext($text, $plural, $count);
|
$text = _ngettext($text, $plural, $count);
|
||||||
} elseif (is_callable('ngettext')) {
|
} elseif (is_callable('ngettext')) {
|
||||||
$text == ngettext($text, $plural, $count);
|
$text = ngettext($text, $plural, $count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // use normal
|
} else { // use normal
|
||||||
|
|||||||
Reference in New Issue
Block a user