1ec5 created an issue (openstreetmap/openstreetmap-website#6319)
#6313 modified the language picker so that every language option has the
English name below the native name. It’s always in English regardless of the
user’s preferred language. This can be a very useful feature: you can easily
see what the map looks like in another language like Greek, even if you don’t
know that “Ελληνικά” means Greek in Greek. Unfortunately, this feature mostly
only benefits users who speak some English. Speakers of other languages will
only recognize the words if it’s similar to their own language.
Similar to #6127, we could instead display each language’s name in both the
native name and the current locale using
[`Intl.DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames).
Different browsers have translations of different language names into
different languages, so we’d need to fall back to either the English name or
the raw language code:
```js
const displayNames = new Intl.DisplayNames(OSM.preferred_languages, { type:
"language" });
let displayName = displayNames.of(:code);
if (displayName === :code) {
displayName = language[:english_name];
}
```
As discussed in
https://github.com/openstreetmap/openstreetmap-website/pull/6313#discussion_r2268803424,
in the case where the user lacks a font for the current interface language,
they probably will have a font for the language they speak. The dialog would
continue to label that language with the native name, which they can still read.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/6319
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/[email protected]>_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev