HTML esoterica – en-GB vs. en_GB htmhell.dev · 20 points · 1 comments · HN threa...

@best

HTML esoterica – en-GB vs. en_GB htmhell.dev · 20 points · 1 comments · HN thread

TL;DR Terence Eden asks why the Open Graph Protocol's og:locale uses an underscore (en_GB) while the HTML lang attribute uses a hyphen (en-GB). He traces the underscore to POSIX locale conventions and argues that a language and a locale are different things, and that OGP's locale property is largely a legacy of Facebook's now-dormant spec.

  • The HTML lang attribute must be a BCP 47 tag, which uses hyphens and permits only A-Z, a-z, 0-9 and hyphen-minus.
  • OGP's og:locale is documented as language_TERRITORY, with a default of en_US, and it describes the locale of the tags rather than the page.
  • Eden says the underscore likely comes from POSIX locale naming (ISO/IEC 15897), which predates BCP 47.
  • A locale bundles language, territory and conventions such as date format, currency and number formatting, while a language tag only identifies the language.
  • Eden finds few OGP properties that benefit from a locale; he sees number formatting as the main use case.
  • He proposes that Facebook deprecate og:locale and use lang on individual meta elements instead, noting Facebook's OGP development appears dead.

Discussion The thread is essentially empty: a single comment, from sph, praises the domain name htmhell.dev. There is no technical discussion of the article's points, and the mood is light and friendly.

  • Praises the site's domain name (a few): The only commenter says the domain name htmhell.dev is great. No one engages with the BCP 47 or OGP arguments in the article.

#HTML #OpenGraph #BCP47 #Locale #WebStandards