To be clear, the focus of this discussion is the name
key, which is not in a single language worldwide. This discussion arose because even a map that uses name:*
keys can achieve an extra bit of sophistication by including the name(s) in the local language(s).
If we suppose that a renderer is already showing the name in one or more of the user’s preferred languages, all that’s left is to show any remaining names in the local languages. Maybe the renderer can pull in some external comprehensive source of what’s spoken or signposted in every locality, but a very tempting simpler alternative is to just use name
. What a renderer can do with name
depends on how its values are delimited:
- If the values are separated by an arbitrary, human-readable delimiter, then it can only display the entire
name
tag verbatim, potentially repeating names that have already been listed. - If the values are separated by a predictable semicolon, then it can display only the names that haven’t been listed yet. It can also apply some nice punctuation or spacing between the names.
Note that names may overlap between unrelated languages. It’s “Bolzano” to both Italian and English, so an English speaker would want the Italian name to be omitted. No matter how important Italian is locally, its name for the city is redundant to the English name. At this point, we don’t even need to know that it’s Italian, just that this seven-character-long name has already appeared earlier in the label.
I would caution against relying too heavily on user preferences. Let’s consider your ideal desired behavior again:
Is there an example of an online map (doesn’t have to be OSM-based) that implements such complex fallbacks dynamically based on user preferences alone? What does the form look like to specify your preferences? Most users would not want to fill out a questionnaire just to see a map.
In reality, some language fallbacks are handled automatically for the user based on a very simple user preference. OSM Americana currently implements the ICU locale fallback algorithm, which is the bare minimum needed to make browser preferences align with the data in the map tiles. Users don’t need to explicitly add en
as a fallback to en-US
because Americana knows to strip off the region code.
If you speak a language like Serbian, you’d probably appreciate the more nuanced fallbacks in the CLDR language matching algorithm or MediaWiki’s homegrown alternative:
Typical UIs use English as a last resort fallback, but for maps it would be better to use the local language, hence the focus on name
. Maybe the behavior could vary depending on the country you’re looking at. This crosses the boundary into what needs to be implemented server-side, where there’s less ability to respond to dynamic user preferences. But you know, OSM Americana is easy to fork – a Croatia-focused style can afford to hard-code some assumptions about its users’ language skills. Americana tries to avoid making assumptions because the U.S. is such a multilingual country.
The most sophisticated fallback strategies are difficult to implement, but internationalization is never an all-or-nothing affair. For a renderer unable to implement language identification and language-aware transliteration, presenting name
is not a terrible alternative. The only catch is that it can contain multiple names separated by one of several punctuation characters that can reasonably appear inside a name too.