Allow nooped plurals to receive a textdomain on registration to then be used on translation.
This is good for when the code registering the plural is not also translating it. This occurs in core with register_post_status(), which accepts a nooped plural as an argument, and then calls translate_nooped_plural() without a domain. translate_nooped_plural() can still be called with a domain. The argument will just be overridden if the nooped plural contains a domain key. fixes #20188. git-svn-id: http://svn.automattic.com/wordpress/trunk@20648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
24b4c94fcf
commit
c22a2e2d7a
|
@ -272,10 +272,11 @@ function _nx($single, $plural, $number, $context, $domain = 'default') {
|
|||
* @since 2.5
|
||||
* @param string $singular Single form to be i18ned
|
||||
* @param string $plural Plural form to be i18ned
|
||||
* @param string $domain Optional. The domain identifier the text will be retrieved in
|
||||
* @return array array($singular, $plural)
|
||||
*/
|
||||
function _n_noop( $singular, $plural ) {
|
||||
return array( 0 => $singular, 1 => $plural, 'singular' => $singular, 'plural' => $plural, 'context' => null );
|
||||
function _n_noop( $singular, $plural, $domain = null ) {
|
||||
return array( 0 => $singular, 1 => $plural, 'singular' => $singular, 'plural' => $plural, 'context' => null, 'domain' => $domain );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,8 +284,8 @@ function _n_noop( $singular, $plural ) {
|
|||
*
|
||||
* @see _n_noop()
|
||||
*/
|
||||
function _nx_noop( $singular, $plural, $context ) {
|
||||
return array( 0 => $singular, 1 => $plural, 2 => $context, 'singular' => $singular, 'plural' => $plural, 'context' => $context );
|
||||
function _nx_noop( $singular, $plural, $context, $domain = null ) {
|
||||
return array( 0 => $singular, 1 => $plural, 2 => $context, 'singular' => $singular, 'plural' => $plural, 'context' => $context, 'domain' => $domain );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -293,9 +294,13 @@ function _nx_noop( $singular, $plural, $context ) {
|
|||
* @since 3.1
|
||||
* @param array $nooped_plural Array with singular, plural and context keys, usually the result of _n_noop() or _nx_noop()
|
||||
* @param int $count Number of objects
|
||||
* @param string $domain Optional. The domain identifier the text should be retrieved in
|
||||
* @param string $domain Optional. The domain identifier the text should be retrieved in. If $nooped_plural contains
|
||||
* a domain passed to _n_noop() or _nx_noop(), it will override this value.
|
||||
*/
|
||||
function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) {
|
||||
if ( $nooped_plural['domain'] )
|
||||
$domain = $nooped_plural['domain'];
|
||||
|
||||
if ( $nooped_plural['context'] )
|
||||
return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain );
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue