Add _c() for disambiguatin translateable strings. Props nbachiyski. fixes #3687
git-svn-id: http://svn.automattic.com/wordpress/trunk@5081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9f9d9a8d9e
commit
43e6d1b011
|
@ -37,6 +37,21 @@ function _e($text, $domain = 'default') {
|
||||||
echo $text;
|
echo $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _c($text, $domain = 'default') {
|
||||||
|
global $l10n;
|
||||||
|
|
||||||
|
if ( isset($l10n[$domain]) )
|
||||||
|
$whole = apply_filters('gettext', $l10n[$domain]->translate($text), $text);
|
||||||
|
else
|
||||||
|
$whole = $text;
|
||||||
|
|
||||||
|
$trans = explode('|', $whole, 2);
|
||||||
|
if ( isset( $trans[1] ) )
|
||||||
|
return $trans[1];
|
||||||
|
else
|
||||||
|
return $trans[0];
|
||||||
|
}
|
||||||
|
|
||||||
// Return the plural form.
|
// Return the plural form.
|
||||||
function __ngettext($single, $plural, $number, $domain = 'default') {
|
function __ngettext($single, $plural, $number, $domain = 'default') {
|
||||||
global $l10n;
|
global $l10n;
|
||||||
|
|
Loading…
Reference in New Issue