Ticket #24212: 24212.4.diff
| File 24212.4.diff, 12.5 KB (added by , 12 years ago) |
|---|
-
wp-includes/l10n.php
52 52 /** 53 53 * Retrieve the translation of $text. 54 54 * 55 * If there is no translation, or the domain isn't loaded, the original text is returned.55 * If there is no translation, or the text domain isn't loaded, the original text is returned. 56 56 * 57 57 * <strong>Note:</strong> Don't use translate() directly, use __() or related functions. 58 58 * 59 59 * @since 2.2.0 60 60 * 61 61 * @param string $text Text to translate. 62 * @param string $domain Optional. Unique identifier for retrieving translated strings.62 * @param string $domain Optional. Text domain. 63 63 * @return string Translated text 64 64 */ 65 65 function translate( $text, $domain = 'default' ) { … … 89 89 /** 90 90 * Retrieve the translation of $text in the context defined in $context. 91 91 * 92 * If there is no translation, or the domain isn't loaded the original92 * If there is no translation, or the text domain isn't loaded the original 93 93 * text is returned. 94 94 * 95 95 * @since 2.8.0 96 96 * 97 97 * @param string $text Text to translate. 98 98 * @param string $context Context information for the translators. 99 * @param string $domain Optional. Unique identifier for retrieving translated strings.99 * @param string $domain Optional. Text domain. 100 100 * @return string Translated text on success, original text on failure. 101 101 */ 102 102 function translate_with_gettext_context( $text, $context, $domain = 'default' ) { … … 106 106 107 107 /** 108 108 * Retrieve the translation of $text. If there is no translation, 109 * or the domain isn't loaded, the original text is returned.109 * or the text domain isn't loaded, the original text is returned. 110 110 * 111 111 * @since 2.1.0 112 112 * 113 113 * @param string $text Text to translate. 114 * @param string $domain Optional. Unique identifier for retrieving translated strings.114 * @param string $domain Optional. Text domain. 115 115 * @return string Translated text. 116 116 */ 117 117 function __( $text, $domain = 'default' ) { … … 121 121 /** 122 122 * Retrieve the translation of $text and escapes it for safe use in an attribute. 123 123 * 124 * If there is no translation, or the domain isn't loaded, the original text is returned.124 * If there is no translation, or the text domain isn't loaded, the original text is returned. 125 125 * 126 126 * @since 2.8.0 127 127 * 128 128 * @param string $text Text to translate. 129 * @param string $domain Optional. Unique identifier for retrieving translated strings.129 * @param string $domain Optional. Text domain. 130 130 * @return string Translated text on success, original text on failure. 131 131 */ 132 132 function esc_attr__( $text, $domain = 'default' ) { … … 136 136 /** 137 137 * Retrieve the translation of $text and escapes it for safe use in HTML output. 138 138 * 139 * If there is no translation, or the domain isn't loaded, the original text is returned.139 * If there is no translation, or the text domain isn't loaded, the original text is returned. 140 140 * 141 141 * @since 2.8.0 142 142 * 143 143 * @param string $text Text to translate. 144 * @param string $domain Optional. Unique identifier for retrieving translated strings.144 * @param string $domain Optional. Text domain. 145 145 * @return string Translated text 146 146 */ 147 147 function esc_html__( $text, $domain = 'default' ) { … … 154 154 * @since 1.2.0 155 155 * 156 156 * @param string $text Text to translate. 157 * @param string $domain Optional. Unique identifier for retrieving translated strings.157 * @param string $domain Optional. Text domain. 158 158 */ 159 159 function _e( $text, $domain = 'default' ) { 160 160 echo translate( $text, $domain ); … … 166 166 * @since 2.8.0 167 167 * 168 168 * @param string $text Text to translate. 169 * @param string $domain Optional. Unique identifier for retrieving translated strings.169 * @param string $domain Optional. Text domain. 170 170 */ 171 171 function esc_attr_e( $text, $domain = 'default' ) { 172 172 echo esc_attr( translate( $text, $domain ) ); … … 178 178 * @since 2.8.0 179 179 * 180 180 * @param string $text Text to translate. 181 * @param string $domain Optional. Unique identifier for retrieving translated strings.181 * @param string $domain Optional. Text domain. 182 182 */ 183 183 function esc_html_e( $text, $domain = 'default' ) { 184 184 echo esc_html( translate( $text, $domain ) ); … … 197 197 * 198 198 * @param string $text Text to translate. 199 199 * @param string $context Context information for the translators. 200 * @param string $domain Optional. Unique identifier for retrieving translated strings.200 * @param string $domain Optional. Text domain. 201 201 * @return string Translated context string without pipe. 202 202 */ 203 203 function _x( $text, $context, $domain = 'default' ) { … … 211 211 * 212 212 * @param string $text Text to translate. 213 213 * @param string $context Context information for the translators. 214 * @param string $domain Optional. Unique identifier for retrieving translated strings.214 * @param string $domain Optional. Text domain. 215 215 * @return string Translated context string without pipe. 216 216 */ 217 217 function _ex( $text, $context, $domain = 'default' ) { … … 219 219 } 220 220 221 221 /** 222 * Display translatedstring with gettext context, and escapes it for safe use in an attribute.222 * Translate string with gettext context, and escapes it for safe use in an attribute. 223 223 * 224 224 * @since 2.8.0 225 225 * 226 226 * @param string $text Text to translate. 227 227 * @param string $context Context information for the translators. 228 * @param string $domain Optional. Unique identifier for retrieving translated strings.228 * @param string $domain Optional. Text domain. 229 229 * @return string Translated text 230 230 */ 231 231 function esc_attr_x( $text, $context, $domain = 'default' ) { … … 233 233 } 234 234 235 235 /** 236 * Display translatedstring with gettext context, and escapes it for safe use in HTML output.236 * Translate string with gettext context, and escapes it for safe use in HTML output. 237 237 * 238 238 * @since 2.9.0 239 239 * 240 240 * @param string $text Text to translate. 241 241 * @param string $context Context information for the translators. 242 * @param string $domain Optional. Unique identifier for retrieving translated strings.242 * @param string $domain Optional. Text domain. 243 243 * @return string Translated text. 244 244 */ 245 245 function esc_html_x( $text, $context, $domain = 'default' ) { … … 249 249 /** 250 250 * Retrieve the plural or single form based on the supplied amount. 251 251 * 252 * If the domain is not set in the $l10n list, then a comparison will be made252 * If the text domain is not set in the $l10n list, then a comparison will be made 253 253 * and either $plural or $single parameters returned. 254 254 * 255 * If the domain does exist, then the parameters $single, $plural, and $number256 * will first be passed to the domain's ngettext method. Then it will be passed255 * If the text domain does exist, then the parameters $single, $plural, and $number 256 * will first be passed to the text domain's ngettext method. Then it will be passed 257 257 * to the 'ngettext' filter hook along with the same parameters. The expected 258 258 * type will be a string. 259 259 * … … 262 262 * @param string $single The text that will be used if $number is 1. 263 263 * @param string $plural The text that will be used if $number is not 1. 264 264 * @param int $number The number to compare against to use either $single or $plural. 265 * @param string $domain Optional. Unique identifier for retrieving translated strings.265 * @param string $domain Optional. Text domain. 266 266 * @return string Either $single or $plural translated text. 267 267 */ 268 268 function _n( $single, $plural, $number, $domain = 'default' ) { … … 282 282 * @param string $plural The text that will be used if $number is not 1. 283 283 * @param int $number The number to compare against to use either $single or $plural. 284 284 * @param string $context Context information for the translators. 285 * @param string $domain Optional. Unique identifier for retrieving translated strings.285 * @param string $domain Optional. Text domain. 286 286 * @return string Either $single or $plural translated text with context. 287 287 */ 288 288 function _nx($single, $plural, $number, $context, $domain = 'default') { … … 312 312 * 313 313 * @param string $singular Single form to be i18ned. 314 314 * @param string $plural Plural form to be i18ned. 315 * @param string $domain Optional. Unique identifier for retrieving translated strings.315 * @param string $domain Optional. Text domain. 316 316 * @return array array($singular, $plural) 317 317 */ 318 318 function _n_noop( $singular, $plural, $domain = null ) { … … 335 335 * 336 336 * @param array $nooped_plural Array with singular, plural and context keys, usually the result of _n_noop() or _nx_noop() 337 337 * @param int $count Number of objects 338 * @param string $domain Optional. Unique identifier for retrieving translated strings. If $nooped_plural contains339 * a domain passed to _n_noop() or _nx_noop(), it will override this value.338 * @param string $domain Optional. Text domain. If $nooped_plural contains 339 * a text domain passed to _n_noop() or _nx_noop(), it will override this value. 340 340 * @return string Either $single or $plural translated text. 341 341 */ 342 342 function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) { … … 350 350 } 351 351 352 352 /** 353 * Load a .mo file into the domain $domain.353 * Load a .mo file into the text domain $domain. 354 354 * 355 * If the domain already exists, the translations will be merged. If both355 * If the text domain already exists, the translations will be merged. If both 356 356 * sets have the same string, the translation from the original value will be taken. 357 357 * 358 358 * On success, the .mo file will be placed in the $l10n global by $domain … … 360 360 * 361 361 * @since 1.5.0 362 362 * 363 * @param string $domain Unique identifier for retrieving translated strings.363 * @param string $domain Text domain. 364 364 * @param string $mofile Path to the .mo file. 365 365 * @return bool True on success, false on failure. 366 366 */ … … 391 391 } 392 392 393 393 /** 394 * Unload translations for a domain.394 * Unload translations for a text domain. 395 395 * 396 396 * @since 3.0.0 397 397 * 398 * @param string $domain Unique identifier for retrieving translated strings.398 * @param string $domain Text domain. 399 399 * @return bool Whether textdomain was unloaded. 400 400 */ 401 401 function unload_textdomain( $domain ) { … … 449 449 * 450 450 * If the path is not given then it will be the root of the plugin directory. 451 451 * 452 * The .mo file should be named based on the domain with a dash, and then the locale exactly.452 * The .mo file should be named based on the text domain with a dash, and then the locale exactly. 453 453 * 454 454 * @since 1.5.0 455 455 * 456 * @param string $domain Unique identifier for retrieving translated strings456 * @param string $domain Text domain. 457 457 * @param string $deprecated Use the $plugin_rel_path parameter instead. 458 458 * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR where the .mo file resides. 459 459 */ … … 484 484 * 485 485 * @since 3.0.0 486 486 * 487 * @param string $domain Unique identifier for retrieving translated strings.487 * @param string $domain Text domain. 488 488 * @param string $mu_plugin_rel_path Relative to WPMU_PLUGIN_DIR directory in which the .mo file resides. 489 489 * Default empty string. 490 490 * @return bool True when textdomain is successfully loaded, false otherwise. … … 513 513 * 514 514 * @since 1.5.0 515 515 * 516 * @param string $domain Unique identifier for retrieving translated strings.516 * @param string $domain Text domain. 517 517 * @return bool True when textdomain is successfully loaded, false otherwise. 518 518 */ 519 519 function load_theme_textdomain( $domain, $path = false ) { … … 542 542 * 543 543 * @since 2.9.0 544 544 * 545 * @param string $domain Unique identifier for retrieving translated strings.545 * @param string $domain Text domain. 546 546 * @return bool True when the theme textdomain is successfully loaded, false otherwise. 547 547 */ 548 548 function load_child_theme_textdomain( $domain, $path = false ) { … … 552 552 } 553 553 554 554 /** 555 * Return the Translations instance for a domain.555 * Return the Translations instance for a text domain. 556 556 * 557 557 * If there isn't one, returns empty Translations instance. 558 558 * 559 * @param string $domain Unique identifier for retrieving translated strings.559 * @param string $domain Text domain. 560 560 * @return Translations A Translations instance. 561 561 */ 562 562 function get_translations_for_domain( $domain ) { … … 568 568 } 569 569 570 570 /** 571 * Whether there are translations for the domain571 * Whether there are translations for the text domain. 572 572 * 573 573 * @since 3.0.0 574 * @param string $domain Unique identifier for retrieving translated strings.574 * @param string $domain Text domain. 575 575 * @return bool Whether there are translations. 576 576 */ 577 577 function is_textdomain_loaded( $domain ) {