Ticket #26638: 26638.2.patch
File 26638.2.patch, 2.5 KB (added by , 11 years ago) |
---|
-
wp-includes/l10n.php
71 71 * @return string Translated text 72 72 */ 73 73 function translate( $text, $domain = 'default' ) { 74 $translations = get_translations_for_domain( $domain ); 75 $translations = $translations->translate( $text ); 74 global $l10n; 75 76 if ( isset( $l10n[ $domain ] ) ) { 77 $translations = get_translations_for_domain( $domain ); 78 $translations = $translations->translate( $text ); 79 } else { 80 $translations = $text; 81 } 82 76 83 /** 77 84 * Filter text with its translation. 78 85 * … … 118 125 * @return string Translated text on success, original text on failure. 119 126 */ 120 127 function translate_with_gettext_context( $text, $context, $domain = 'default' ) { 121 $translations = get_translations_for_domain( $domain ); 122 $translations = $translations->translate( $text, $context ); 128 global $l10n; 129 130 if ( isset( $l10n[ $domain ] ) ) { 131 $translations = get_translations_for_domain( $domain ); 132 $translations = $translations->translate( $text, $context ); 133 } else { 134 $translations = $text; 135 } 136 123 137 /** 124 138 * Filter text with its translation based on context information. 125 139 * … … 295 309 * @return string Either $single or $plural translated text. 296 310 */ 297 311 function _n( $single, $plural, $number, $domain = 'default' ) { 298 $translations = get_translations_for_domain( $domain ); 299 $translation = $translations->translate_plural( $single, $plural, $number ); 312 global $l10n; 313 314 if ( isset( $l10n[ $domain ] ) ) { 315 $translations = get_translations_for_domain( $domain ); 316 $translation = $translations->translate_plural( $single, $plural, $number ); 317 } else { 318 $translation = ( 1 == $number ) ? $single : $plural; 319 } 320 300 321 /** 301 322 * Filter text with its translation when plural option is available. 302 323 * … … 326 347 * @return string Either $single or $plural translated text with context. 327 348 */ 328 349 function _nx($single, $plural, $number, $context, $domain = 'default') { 329 $translations = get_translations_for_domain( $domain ); 330 $translation = $translations->translate_plural( $single, $plural, $number, $context ); 350 global $l10n; 351 352 if ( isset( $l10n[ $domain ] ) ) { 353 $translations = get_translations_for_domain( $domain ); 354 $translation = $translations->translate_plural( $single, $plural, $number, $context ); 355 } else { 356 $translation = ( 1 == $number ) ? $single : $plural; 357 } 358 331 359 /** 332 360 * Filter text with its translation while plural option and context are available. 333 361 *