DEV Community

RC
RC

Posted on Originally published at randomchaos.us

Locale decides the payload

Every post on shkspr.mobi opens with the same two lines: <!doctype html> and <html lang=en-GB>. The author treats that second line as an instruction, not decoration. It declares the page as British English, and the argument that follows is that anything reading the page should act on it. A text-to-speech engine should read the text in a British accent. Nothing downstream should quietly rewrite "jumper" as "sweater" to make the content easier for a global audience to swallow.

The post exists because someone left a comment asking the author to make the language more inclusive, trading local cultural references for tropes that are more globally known. The answer was no. The stated reasoning is that the lang tag carries more than vocabulary. It encodes accent, idiom, and a specific cultural context, and the reader, human or machine, is expected to handle the unfamiliar parts the way people always have, with context. The author's examples are a kid eating a sherbet lemon, Hermione's fringe, Harry wearing a jumper: all perfectly resolvable by a reader who has never heard the words before.

What the tag actually does

lang=en-GB is a BCP 47 language tag. The en is the language subtag, GB is the region. It is machine-readable metadata, and a lot of tooling keys off it. Screen readers pick a voice from it. Browsers choose hyphenation and spell-check dictionaries from it. Translation layers use it as the source language. An LLM asked to summarise or narrate a page can read it as a signal about which variety of English the text is written in. The author's position is that the tag is the authoritative declaration of intent, and consumers should honour it rather than normalise everything toward en-US.

That normalisation is not hypothetical. The post reaches for the obvious case: the first Harry Potter book shipped in the United States as Sorcerer's Stone instead of Philosopher's Stone, with around a dozen other word changes, which annoyed the fandom. That is localisation rewriting the payload for a target locale. The region subtag is the switch that decides whether the reader gets "philosopher" or "sorcerer," and the author's complaint is with systems that flip that switch without being asked.

If you build the consumer side

The practical read for anyone building the thing that ingests the page: the lang attribute is declared intent, and discarding it throws away information the author put there on purpose. Voice selection, hyphenation, spell-check, date and number formatting, and machine-translation defaults should all follow the content's declared locale when it is present. Defaulting the whole pipeline to en-US because that is the common case is a decision, and it is a lossy one. A TTS system that reads en-GB text in a General American voice is contradicting the document it was handed.

The counterargument the author is responding to, that the text should be flattened for accessibility, does not survive contact with how people actually read. The post offers the author's own history as evidence: not having seen a Twinkie until their mid-twenties and inferring from a hundred books and films that it was an unappealing food that was somehow popular, and reciting the lyrics to Ice Ice Baby as a child without understanding half the references. Unfamiliar tokens get resolved from surrounding context. That is as true for a model as it is for a kid.

Where the tag runs out

The honest limit is in the footnote. en-GB is coarse. BCP 47 expresses region well enough, en-GB versus en-US versus en-AU, but it does not cleanly express a specific accent within a country. The author points this out directly and admits uncertainty about whether BCP-style tags even exist for intra-country accents. The UK alone contains several countries with their own pronunciations, and the tag cannot distinguish them. So "a British accent" out of a speech engine is already an approximation of an approximation. The metadata can tell a consumer the content is British English and that it should not be Americanised. It cannot tell the consumer which British voice to use, and there is no standard field to put that in.

Top comments (0)