From c119ce9ac215cb827f46cbbe632c36c9cee93dc2 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Wed, 2 Mar 2016 16:10:00 +0000 Subject: [PATCH] I18N: Don't use the locale for the HTML language attribute. Locales are codes to identify a language in WordPress which can be different from the specification for language tags, see https://www.w3.org/International/articles/language-tags/. An example is `de_DE_formal` or `nl_NL_formal` where the subtag `formal` isn't officially supported. To give translators the possibility to specify the language tag of their language introduce a string `html_lang_attribute` which can be translated into the language tag which conforms to the specification. Props SergeyBiryukov. Fixes #33511. git-svn-id: https://develop.svn.wordpress.org/trunk@36802 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/general-template.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index ff2f0987f2..58273d9834 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -708,8 +708,15 @@ function get_bloginfo( $show = '', $filter = 'raw' ) { $output = $wp_version; break; case 'language': - $output = get_locale(); - $output = str_replace('_', '-', $output); + /* translators: Translate this to the correct language tag for your locale, + * see https://www.w3.org/International/articles/language-tags/ for reference. + * Do not translate into your own language. + */ + $output = __( 'html_lang_attribute' ); + if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) { + $output = get_locale(); + $output = str_replace( '_', '-', $output ); + } break; case 'text_direction': _deprecated_argument( __FUNCTION__, '2.2', sprintf(