Ticket #16750: 16750.4.diff
| File 16750.4.diff, 13.2 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/l10n.php
60 60 /** 61 61 * Retrieve the translation of $text. 62 62 * 63 * If there is no translation, or the domain isn't loaded, the original text is returned.63 * If there is no translation, or the text domain isn't loaded, the original text is returned. 64 64 * 65 65 * <strong>Note:</strong> Don't use translate() directly, use __() or related functions. 66 66 * 67 67 * @since 2.2.0 68 68 * 69 69 * @param string $text Text to translate. 70 * @param string $domain Optional. Unique identifier for retrieving translated strings.70 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 71 71 * @return string Translated text 72 72 */ 73 73 function translate( $text, $domain = 'default' ) { … … 107 107 /** 108 108 * Retrieve the translation of $text in the context defined in $context. 109 109 * 110 * If there is no translation, or the domain isn't loaded the original110 * If there is no translation, or the text domain isn't loaded the original 111 111 * text is returned. 112 112 * 113 113 * @since 2.8.0 114 114 * 115 115 * @param string $text Text to translate. 116 116 * @param string $context Context information for the translators. 117 * @param string $domain Optional. Unique identifier for retrieving translated strings.117 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 118 118 * @return string Translated text on success, original text on failure. 119 119 */ 120 120 function translate_with_gettext_context( $text, $context, $domain = 'default' ) { … … 135 135 136 136 /** 137 137 * Retrieve the translation of $text. If there is no translation, 138 * or the domain isn't loaded, the original text is returned.138 * or the text domain isn't loaded, the original text is returned. 139 139 * 140 140 * @since 2.1.0 141 141 * 142 142 * @param string $text Text to translate. 143 * @param string $domain Optional. Unique identifier for retrieving translated strings.143 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 144 144 * @return string Translated text. 145 145 */ 146 146 function __( $text, $domain = 'default' ) { … … 150 150 /** 151 151 * Retrieve the translation of $text and escapes it for safe use in an attribute. 152 152 * 153 * If there is no translation, or the domain isn't loaded, the original text is returned.153 * If there is no translation, or the text domain isn't loaded, the original text is returned. 154 154 * 155 155 * @since 2.8.0 156 156 * 157 157 * @param string $text Text to translate. 158 * @param string $domain Optional. Unique identifier for retrieving translated strings.158 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 159 159 * @return string Translated text on success, original text on failure. 160 160 */ 161 161 function esc_attr__( $text, $domain = 'default' ) { … … 165 165 /** 166 166 * Retrieve the translation of $text and escapes it for safe use in HTML output. 167 167 * 168 * If there is no translation, or the domain isn't loaded, the original text is returned.168 * If there is no translation, or the text domain isn't loaded, the original text is returned. 169 169 * 170 170 * @since 2.8.0 171 171 * 172 172 * @param string $text Text to translate. 173 * @param string $domain Optional. Unique identifier for retrieving translated strings.173 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 174 174 * @return string Translated text 175 175 */ 176 176 function esc_html__( $text, $domain = 'default' ) { … … 183 183 * @since 1.2.0 184 184 * 185 185 * @param string $text Text to translate. 186 * @param string $domain Optional. Unique identifier for retrieving translated strings.186 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 187 187 */ 188 188 function _e( $text, $domain = 'default' ) { 189 189 echo translate( $text, $domain ); … … 195 195 * @since 2.8.0 196 196 * 197 197 * @param string $text Text to translate. 198 * @param string $domain Optional. Unique identifier for retrieving translated strings.198 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 199 199 */ 200 200 function esc_attr_e( $text, $domain = 'default' ) { 201 201 echo esc_attr( translate( $text, $domain ) ); … … 207 207 * @since 2.8.0 208 208 * 209 209 * @param string $text Text to translate. 210 * @param string $domain Optional. Unique identifier for retrieving translated strings.210 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 211 211 */ 212 212 function esc_html_e( $text, $domain = 'default' ) { 213 213 echo esc_html( translate( $text, $domain ) ); … … 226 226 * 227 227 * @param string $text Text to translate. 228 228 * @param string $context Context information for the translators. 229 * @param string $domain Optional. Unique identifier for retrieving translated strings.229 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 230 230 * @return string Translated context string without pipe. 231 231 */ 232 232 function _x( $text, $context, $domain = 'default' ) { … … 240 240 * 241 241 * @param string $text Text to translate. 242 242 * @param string $context Context information for the translators. 243 * @param string $domain Optional. Unique identifier for retrieving translated strings.243 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 244 244 * @return string Translated context string without pipe. 245 245 */ 246 246 function _ex( $text, $context, $domain = 'default' ) { … … 254 254 * 255 255 * @param string $text Text to translate. 256 256 * @param string $context Context information for the translators. 257 * @param string $domain Optional. Unique identifier for retrieving translated strings.257 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 258 258 * @return string Translated text 259 259 */ 260 260 function esc_attr_x( $text, $context, $domain = 'default' ) { … … 268 268 * 269 269 * @param string $text Text to translate. 270 270 * @param string $context Context information for the translators. 271 * @param string $domain Optional. Unique identifier for retrieving translated strings.271 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 272 272 * @return string Translated text. 273 273 */ 274 274 function esc_html_x( $text, $context, $domain = 'default' ) { … … 278 278 /** 279 279 * Retrieve the plural or single form based on the supplied amount. 280 280 * 281 * If the domain is not set in the $l10n list, then a comparison will be made281 * If the text domain is not set in the $l10n list, then a comparison will be made 282 282 * and either $plural or $single parameters returned. 283 283 * 284 * If the domain does exist, then the parameters $single, $plural, and $number285 * will first be passed to the domain's ngettext method. Then it will be passed284 * If the text domain does exist, then the parameters $single, $plural, and $number 285 * will first be passed to the text domain's ngettext method. Then it will be passed 286 286 * to the 'ngettext' filter hook along with the same parameters. The expected 287 287 * type will be a string. 288 288 * … … 291 291 * @param string $single The text that will be used if $number is 1. 292 292 * @param string $plural The text that will be used if $number is not 1. 293 293 * @param int $number The number to compare against to use either $single or $plural. 294 * @param string $domain Optional. Unique identifier for retrieving translated strings.294 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 295 295 * @return string Either $single or $plural translated text. 296 296 */ 297 297 function _n( $single, $plural, $number, $domain = 'default' ) { … … 322 322 * @param string $plural The text that will be used if $number is not 1. 323 323 * @param int $number The number to compare against to use either $single or $plural. 324 324 * @param string $context Context information for the translators. 325 * @param string $domain Optional. Unique identifier for retrieving translated strings.325 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 326 326 * @return string Either $single or $plural translated text with context. 327 327 */ 328 328 function _nx($single, $plural, $number, $context, $domain = 'default') { … … 364 364 * 365 365 * @param string $singular Single form to be i18ned. 366 366 * @param string $plural Plural form to be i18ned. 367 * @param string $domain Optional. Unique identifier for retrieving translated strings.367 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 368 368 * @return array array($singular, $plural) 369 369 */ 370 370 function _n_noop( $singular, $plural, $domain = null ) { … … 387 387 * 388 388 * @param array $nooped_plural Array with singular, plural and context keys, usually the result of _n_noop() or _nx_noop() 389 389 * @param int $count Number of objects 390 * @param string $domain Optional. Unique identifier for retrieving translated strings. If $nooped_plural contains391 * a domain passed to _n_noop() or _nx_noop(), it will override this value.390 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. If $nooped_plural contains 391 * a text domain passed to _n_noop() or _nx_noop(), it will override this value. 392 392 * @return string Either $single or $plural translated text. 393 393 */ 394 394 function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) { … … 402 402 } 403 403 404 404 /** 405 * Load a .mo file into the domain $domain.405 * Load a .mo file into the text domain $domain. 406 406 * 407 * If the domain already exists, the translations will be merged. If both407 * If the text domain already exists, the translations will be merged. If both 408 408 * sets have the same string, the translation from the original value will be taken. 409 409 * 410 410 * On success, the .mo file will be placed in the $l10n global by $domain … … 412 412 * 413 413 * @since 1.5.0 414 414 * 415 * @param string $domain Unique identifier for retrieving translated strings.415 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 416 416 * @param string $mofile Path to the .mo file. 417 417 * @return bool True on success, false on failure. 418 418 */ … … 468 468 } 469 469 470 470 /** 471 * Unload translations for a domain.471 * Unload translations for a text domain. 472 472 * 473 473 * @since 3.0.0 474 474 * 475 * @param string $domain Unique identifier for retrieving translated strings.475 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 476 476 * @return bool Whether textdomain was unloaded. 477 477 */ 478 478 function unload_textdomain( $domain ) { 479 479 global $l10n; 480 480 481 481 /** 482 * Filter text domain for loading translation.482 * Filter text text domain for loading translation. 483 483 * 484 484 * @since 3.0.0 485 485 * … … 541 541 * 542 542 * If the path is not given then it will be the root of the plugin directory. 543 543 * 544 * The .mo file should be named based on the domain with a dash, and then the locale exactly.544 * The .mo file should be named based on the text domain with a dash, and then the locale exactly. 545 545 * 546 546 * @since 1.5.0 547 547 * … … 585 585 * 586 586 * @since 3.0.0 587 587 * 588 * @param string $domain Unique identifier for retrieving translated strings.588 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 589 589 * @param string $mu_plugin_rel_path Relative to WPMU_PLUGIN_DIR directory in which the .mo file resides. 590 590 * Default empty string. 591 591 * @return bool True when textdomain is successfully loaded, false otherwise. … … 615 615 * 616 616 * @since 1.5.0 617 617 * 618 * @param string $domain Unique identifier for retrieving translated strings.618 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 619 619 * @param string $path Optional. Path to the directory containing the .mo file. 620 620 * Default false. 621 621 * @return bool True when textdomain is successfully loaded, false otherwise. … … 655 655 * 656 656 * @since 2.9.0 657 657 * 658 * @param string $domain Unique identifier for retrieving translated strings.658 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 659 659 * @return bool True when the theme textdomain is successfully loaded, false otherwise. 660 660 */ 661 661 function load_child_theme_textdomain( $domain, $path = false ) { … … 665 665 } 666 666 667 667 /** 668 * Return the Translations instance for a domain.668 * Return the Translations instance for a text domain. 669 669 * 670 670 * If there isn't one, returns empty Translations instance. 671 671 * 672 * @param string $domain Unique identifier for retrieving translated strings.672 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 673 673 * @return Translations A Translations instance. 674 674 */ 675 675 function get_translations_for_domain( $domain ) { … … 681 681 } 682 682 683 683 /** 684 * Whether there are translations for the domain684 * Whether there are translations for the text domain. 685 685 * 686 686 * @since 3.0.0 687 * @param string $domain Unique identifier for retrieving translated strings.687 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 688 688 * @return bool Whether there are translations. 689 689 */ 690 690 function is_textdomain_loaded( $domain ) {