Make WordPress Core

Ticket #48383: 48383.2.diff

File 48383.2.diff, 3.1 KB (added by SergeyBiryukov, 6 years ago)
  • src/wp-includes/l10n.php

     
    169169 * @param string $text   Text to translate.
    170170 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
    171171 *                       Default 'default'.
    172  * @return string Translated text
     172 * @return string Translated text.
    173173 */
    174174function translate( $text, $domain = 'default' ) {
    175175        $translations = get_translations_for_domain( $domain );
     
    210210/**
    211211 * Retrieve the translation of $text in the context defined in $context.
    212212 *
    213  * If there is no translation, or the text domain isn't loaded the original
    214  * text is returned.
     213 * If there is no translation, or the text domain isn't loaded, the original text is returned.
    215214 *
    216215 * *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions.
    217216 *
     
    282281 * @param string $text   Text to translate.
    283282 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
    284283 *                       Default 'default'.
    285  * @return string Translated text
     284 * @return string Translated text.
    286285 */
    287286function esc_html__( $text, $domain = 'default' ) {
    288287        return esc_html( translate( $text, $domain ) );
     
    304303/**
    305304 * Display translated text that has been escaped for safe use in an attribute.
    306305 *
     306 * Encodes `< > & " '` (less than, greater than, ampersand, double quote, single quote).
     307 * Will never double encode entities.
     308 *
     309 * If you need the value for use in PHP, use esc_attr__().
     310 *
    307311 * @since 2.8.0
    308312 *
    309313 * @param string $text   Text to translate.
     
    317321/**
    318322 * Display translated text that has been escaped for safe use in HTML output.
    319323 *
     324 * If there is no translation, or the text domain isn't loaded, the original text
     325 * is escaped and displayed.
     326 *
     327 * If you need the value for use in PHP, use esc_html__().
     328 *
    320329 * @since 2.8.0
    321330 *
    322331 * @param string $text   Text to translate.
     
    366375/**
    367376 * Translate string with gettext context, and escapes it for safe use in an attribute.
    368377 *
     378 * If there is no translation, or the text domain isn't loaded, the original text
     379 * is escaped and returned.
     380 *
    369381 * @since 2.8.0
    370382 *
    371383 * @param string $text    Text to translate.
     
    372384 * @param string $context Context information for the translators.
    373385 * @param string $domain  Optional. Text domain. Unique identifier for retrieving translated strings.
    374386 *                        Default 'default'.
    375  * @return string Translated text
     387 * @return string Translated text.
    376388 */
    377389function esc_attr_x( $text, $context, $domain = 'default' ) {
    378390        return esc_attr( translate_with_gettext_context( $text, $context, $domain ) );
     
    381393/**
    382394 * Translate string with gettext context, and escapes it for safe use in HTML output.
    383395 *
     396 * If there is no translation, or the text domain isn't loaded, the original text
     397 * is escaped and returned.
     398 *
    384399 * @since 2.9.0
    385400 *
    386401 * @param string $text    Text to translate.