summaryrefslogtreecommitdiffstats
path: root/wp-includes/l10n.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-05-21 18:37:58 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-05-21 18:37:58 +0000
commit89fe0ff804e7c6497ebacc8b341ac89974f6f255 (patch)
tree3fce310b29c685008fdbb75c5ab531bc3a6ae12a /wp-includes/l10n.php
parenta139071806ba941346a109fbefb2d5f22bae1cc4 (diff)
downloadwordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.tar.gz
wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.tar.xz
wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.zip
WP Merge to rev 5499, this is a big one! Test it before you put it live!
Test only, not for production use yet git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@972 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/l10n.php')
-rw-r--r--wp-includes/l10n.php36
1 files changed, 15 insertions, 21 deletions
diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php
index 0847ea3..4dba679 100644
--- a/wp-includes/l10n.php
+++ b/wp-includes/l10n.php
@@ -17,8 +17,7 @@ function get_locale() {
return $locale;
}
-// Return a translated string.
-function __($text, $domain = 'default') {
+function translate($text, $domain) {
global $l10n;
if (isset($l10n[$domain]))
@@ -27,29 +26,24 @@ function __($text, $domain = 'default') {
return $text;
}
+// Return a translated string.
+function __($text, $domain = 'default') {
+ return translate($text, $domain);
+}
+
// Echo a translated string.
function _e($text, $domain = 'default') {
- global $l10n;
-
- if (isset($l10n[$domain]))
- echo apply_filters('gettext', $l10n[$domain]->translate($text), $text);
- else
- echo $text;
+ echo translate($text, $domain);
}
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];
+ $whole = translate($text, $domain);
+ $last_bar = strrpos($whole, '|');
+ if ( false == $last_bar ) {
+ return $whole;
+ } else {
+ return substr($whole, 0, $last_bar);
+ }
}
// Return the plural form.
@@ -57,7 +51,7 @@ function __ngettext($single, $plural, $number, $domain = 'default') {
global $l10n;
if (isset($l10n[$domain])) {
- return $l10n[$domain]->ngettext($single, $plural, $number);
+ return apply_filters('ngettext', $l10n[$domain]->ngettext($single, $plural, $number), $single, $plural, $number);
} else {
if ($number != 1)
return $plural;