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
This commit is contained in:
Dominik Schilling (ocean90) 2016-03-02 16:10:00 +00:00
parent 0c3716670a
commit c119ce9ac2
1 changed files with 9 additions and 2 deletions

View File

@ -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(