[openstreetmap/openstreetmap-website] Apply `lang` to localized `name:*` values (Issue #6834)

Minh Nguyễn notifications at github.com
Sat Feb 21 23:49:56 UTC 2026


1ec5 created an issue (openstreetmap/openstreetmap-website#6834)

In an element page’s “Tags” section, the table cell for the value of each localized name, such as `name:fr=*` or `alt_name:en=*`, should have a `lang` attribute set to the language code. This would help the browser choose an appropriate font. Screen readers would also be less likely to trip over text in languages that are related to the user’s preferred language.

For example, the [Yellow Sea](https://www.openstreetmap.org/node/305639182) node has `name:ja`, `name:ko`, `name:zh`, `name:zh-Hans`, and `name:zh-Hant` all set to the same value, but the characters should look significantly different based on a language-appropriate font being applied. As I understand it, the visual differences are about as significant as presenting “Londres” as the English name for London. We probably don’t want to get into the business of choosing specific fonts, but even just telling the browser which language it’s in will help the browser choose the right font.

I don’t know of a comprehensive list of localizable keys. In principle, any freeform text key can have localized subkeys, but the most common one by far is `name:*=*`. Other common keys include `addr:street`/`city`/`place:*=*`, `brand:*=*`, `operator=*`, and `species=*`. Ideally, the code would check each subkey to see if it’s a valid IETF language tag, but I don’t think Rails comes with anything like that. As a workaround, a regular expression like the one mentioned in https://github.com/pnorman/spirit/pull/80#issuecomment-3599484382 would detect these language subkeys reasonably well.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/6834
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/6834 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260221/a6ee9109/attachment.htm>


More information about the rails-dev mailing list