Make WordPress Core


Ignore:
Timestamp:
03/02/2016 04:10:00 PM (9 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r36698 r36802  
    709709            break;
    710710        case 'language':
    711             $output = get_locale();
    712             $output = str_replace('_', '-', $output);
     711            /* translators: Translate this to the correct language tag for your locale,
     712             * see https://www.w3.org/International/articles/language-tags/ for reference.
     713             * Do not translate into your own language.
     714             */
     715            $output = __( 'html_lang_attribute' );
     716            if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) {
     717                $output = get_locale();
     718                $output = str_replace( '_', '-', $output );
     719            }
    713720            break;
    714721        case 'text_direction':
Note: See TracChangeset for help on using the changeset viewer.