From 83573624402924dda2cc6bd2911a16949aab7129 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 22 Mar 2007 03:34:23 +0000 Subject: [PATCH] Add _c() for disambiguatin translateable strings. Props nbachiyski. fixes #3687 git-svn-id: https://develop.svn.wordpress.org/trunk@5081 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/l10n.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 4a0a6409b6..0847ea3775 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -37,6 +37,21 @@ function _e($text, $domain = 'default') { 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. function __ngettext($single, $plural, $number, $domain = 'default') { global $l10n;