• Topic: ISO-compliant HTML Language Attributes and Formal Language Packs

    To anyone using either:

    • WP 4.3.x
    • OR WP 4.4.x

    AND one of the “formal” language variants such as

    • German (Formal) / Deutsch (Sie)
    • Swiss German (Formal)
    • Dutch (Formal)

    There is an unfixed bug in WordPress versions 4.3.x and 4.4.x, which in combination with any of the above “formal” language variants leads to an invalid HTML language attribute in your HTML markup, such as <html lang="de-DE-formal"> instead of <html lang="de-DE">.

    Since this is not ISO compliant, applications (browsers and especially screen-readers) will not know what language is actually being used. This in turn may lead to unexpected and unpleasant consequences for your visitors.

    This has been fixed in WordPress 4.5
    by adding the string html_lang_attribute to all WordPress language files, which is then being used to populate the HTML language attribute.

    However, since there are those who cannot install WordPress 4.5 yet (in which case you might want to have a look at WP Downgrade), I asked Bernhard Kau if he could think of a solution to this. Within an hour (!) he came up with Language Attribute Variant Fix, which truncates the language attribute to make it ISO-compliant.

    I packaged the new plugin as language-attribute-variant-fix.zip, so that it can be easily uploaded and installed manually.

    https://wordpress.org/plugins/language-fallback/

Viewing 1 replies (of 1 total)
  • Plugin Author Bernhard Kau

    (@kau-boy)

    The plugin would not only strip “-formal” (btw. Portuguese also has a formal variant and Swiss German is formal by default), but any language variant. So even pt-PT-ao1990 would be fixed to pt-PT if the Portuguese translator create that variant.

Viewing 1 replies (of 1 total)
  • The topic ‘FYI: Language Attribute Variant Fix’ is closed to new replies.