diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php index 419ebc3817..ff2bbf7787 100644 --- a/src/wp-includes/l10n.php +++ b/src/wp-includes/l10n.php @@ -169,7 +169,7 @@ function determine_locale() { * @param string $text Text to translate. * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. * Default 'default'. - * @return string Translated text + * @return string Translated text. */ function translate( $text, $domain = 'default' ) { $translations = get_translations_for_domain( $domain ); @@ -210,8 +210,7 @@ function before_last_bar( $string ) { /** * Retrieve the translation of $text in the context defined in $context. * - * If there is no translation, or the text domain isn't loaded the original - * text is returned. + * If there is no translation, or the text domain isn't loaded, the original text is returned. * * *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions. * @@ -282,7 +281,7 @@ function esc_attr__( $text, $domain = 'default' ) { * @param string $text Text to translate. * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. * Default 'default'. - * @return string Translated text + * @return string Translated text. */ function esc_html__( $text, $domain = 'default' ) { return esc_html( translate( $text, $domain ) ); @@ -304,6 +303,11 @@ function _e( $text, $domain = 'default' ) { /** * Display translated text that has been escaped for safe use in an attribute. * + * Encodes `< > & " '` (less than, greater than, ampersand, double quote, single quote). + * Will never double encode entities. + * + * If you need the value for use in PHP, use esc_attr__(). + * * @since 2.8.0 * * @param string $text Text to translate. @@ -317,6 +321,11 @@ function esc_attr_e( $text, $domain = 'default' ) { /** * Display translated text that has been escaped for safe use in HTML output. * + * If there is no translation, or the text domain isn't loaded, the original text + * is escaped and displayed. + * + * If you need the value for use in PHP, use esc_html__(). + * * @since 2.8.0 * * @param string $text Text to translate. @@ -366,13 +375,16 @@ function _ex( $text, $context, $domain = 'default' ) { /** * Translate string with gettext context, and escapes it for safe use in an attribute. * + * If there is no translation, or the text domain isn't loaded, the original text + * is escaped and returned. + * * @since 2.8.0 * * @param string $text Text to translate. * @param string $context Context information for the translators. * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. * Default 'default'. - * @return string Translated text + * @return string Translated text. */ function esc_attr_x( $text, $context, $domain = 'default' ) { return esc_attr( translate_with_gettext_context( $text, $context, $domain ) ); @@ -381,6 +393,9 @@ function esc_attr_x( $text, $context, $domain = 'default' ) { /** * Translate string with gettext context, and escapes it for safe use in HTML output. * + * If there is no translation, or the text domain isn't loaded, the original text + * is escaped and returned. + * * @since 2.9.0 * * @param string $text Text to translate.