You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Render names according to the language the user is using? #481
Providing a user switch here is an interesting challenge since within any given map view, we might have an unknown number of languages available in the tags of the items in view, and that might change based on zoom level.
I wonder how the big map providers handle this. We know they do! But they probably rely on locale setting rather than a map specific interface element
Tracesmap, an OSM-based layer provides the option to switch languages. Because it is using a raster layer, a name layer is rendered for each supported language. And OHM uses vector rendering, maybe it won't be so complicated?
OHM’s vector tile stack is similar enough to OSM Americana’s that it might be possible to leverage some of the work that went into automatic language switching (osm-americana/openstreetmap-americana#578) and local language glosses (osm-americana/openstreetmap-americana#592) in that style. The functionality is based on language-qualified name:* tags that Planetiler includes in the tiles per the OpenMapTiles schema and this Planetiler configuration. The Americana stylesheet includes some complex expressions to choose which name tags to include in the labels.
At a glance, there are two obstacles to localized labels in OHM:
Only name is included in the vector tiles, but no name:* key is included, as you can see by clicking on “Éire / Ireland” in this inspector and comparing to this node.
The Historic, Woodblock, and Japanese Scroll styles all use the deprecated {token} syntax in text-field properties. This syntax doesn’t support fallback logic, so if a particular feature lacks a name:* in the user’s language, they’ll see nothing. The Mapbox GL Language plugin requires expressions, as does the more sophisticated code that Americana uses to label features. Maputnik includes a rudimentary expression editor (Added support for expressions and UI errors maplibre/maputnik#620), though progress seems to have stalled on something more sophisticated (More advanced expression editor maplibre/maputnik#622). If that doesn’t work for some reason, there’s always Mapbox Studio.
This would be a minimum viable path to localized labels:
If we’re still using osm2pgsql, this tag transform needs to include name:* keys.
The tiler should include arbitrary name:* keys, or at least the most common name:* keys, in its TOML configuration.
The Historic, Woodblock, and Japanese Scroll styles need to migrate text-field properties from the legacy style function and token syntaxes to expressions. This can happen layer by layer; it doesn’t have to happen all at once.
Americana plans to eventually split out its more sophisticated bilingual labeling as a plugin (osm-americana/openstreetmap-americana#914), but Mapbox GL Language is a decent starting point.
@danrademacher - can we get this broken out appropriately as an example of a tile styling pipeline improvement, per our weekly meeting today?
Here's what I see in the notes there:
Tile styling pipeline / processing to help improve cartography?
Label points? (polygon points, etc.)
Multilingual labeling
Last line links back to this ticket.
I can guess that we need two tickets here, one for vector tile creation changes for DevSeed and the other for style changes by Greeninfo to come after.
But I am not sure what the DevSeed part looks like.
@batpad can you add some details? Then I can see how to best split this up.
My breakdown in #481 (comment) assumes client-side language filtering, but ideally the client could just pass its preferred language(s) to the server as a URL query parameter and the server would resolve the languages down to a single name field. The OSM Americana project is working on something like this for its Planetiler- and AWS-based stack, but I don’t know if it would be compatible with OHM’s Tegola-based stack. Regardless, client-side filtering does work for any tileset, so we’ll try to package that up for OHM to use.
Let's disregard the 2-line labeling requirement for this ticket and see what we can do to enable the original request of rendering labels in the viewer's language, using either of the methods @1ec5 describes above – client-side language filtering or passing the viewer's language as a URL-query parameter.
As far as we know, is the PR to OSM fully functional but just subject to debate about desireability? I see based on the comments over there that it might be working at https://osm.openmaptiles.org/#map=5/25.364/92.153&layers=V, though when I use my locale switcher to test different languages, I don't see labels changing (tried French, Arabic, Chinese, Vietnamese), though maybe they are changing in some cases I'm not noticing. I thought maybe I needed to log in to see it work, but I couldn't get my OSM login to work on the OMT clone, and also couldn't make an account there. I might be missing something!
Anyway, question stands: Is that PR working code we need to mine for insights into how we would do it, or maybe we don't know? Either answer is fine, but I'll frame our approach differently depending.
Yes, openstreetmap/openstreetmap-website#4042 is functional last I checked. However, MapTiler recently removed support for backfilling translations from Wikidata over concerns about misleading mappers into thinking the translations are coming from OSM. So in practice, you’re going to see far fewer translated labels on that site. Fortunately, we don’t use MapTiler-hosted tiles. At some point we may want to have our labels fall back to Wikidata also, but that’ll be independent of this effort. (It may require more substantial work such as migrating away from Tegola.)
The only interesting aspect of that PR from our perspective is hooking up the language selection to your account preferences. Otherwise, it’s just a straightforward installation of the mapbox-gl-language plugin. But it won’t work until the tiles contain the localized names (#679) and the styles migrate to expressions (#775) so that they can read those localized names with an appropriate fallback.
The main historic style in Upgrade styles to expressions #775 is close to fully converted to expressions, though not the most important part for this ticket (text labels). But Tim has a clear path and that should happen shortly.
Activity
danrademacher commentedon Nov 8, 2022
Good question. Currently we show the Name tag in whatever language it is provided:
Example: https://www.openhistoricalmap.org/node/2091139302#map=14/37.4742/35.0409&layers=OD&date=1922-01-01&daterange=1922-01-01,2022-12-31
Providing a user switch here is an interesting challenge since within any given map view, we might have an unknown number of languages available in the tags of the items in view, and that might change based on zoom level.
I wonder how the big map providers handle this. We know they do! But they probably rely on locale setting rather than a map specific interface element
SteveLz commentedon Nov 8, 2022
Tracesmap, an OSM-based layer provides the option to switch languages. Because it is using a raster layer, a name layer is rendered for each supported language. And OHM uses vector rendering, maybe it won't be so complicated?
1ec5 commentedon Aug 12, 2023
OHM’s vector tile stack is similar enough to OSM Americana’s that it might be possible to leverage some of the work that went into automatic language switching (osm-americana/openstreetmap-americana#578) and local language glosses (osm-americana/openstreetmap-americana#592) in that style. The functionality is based on language-qualified
name:*tags that Planetiler includes in the tiles per the OpenMapTiles schema and this Planetiler configuration. The Americana stylesheet includes some complex expressions to choose which name tags to include in the labels.At a glance, there are two obstacles to localized labels in OHM:
nameis included in the vector tiles, but noname:*key is included, as you can see by clicking on “Éire / Ireland” in this inspector and comparing to this node.{token}syntax intext-fieldproperties. This syntax doesn’t support fallback logic, so if a particular feature lacks aname:*in the user’s language, they’ll see nothing. The Mapbox GL Language plugin requires expressions, as does the more sophisticated code that Americana uses to label features. Maputnik includes a rudimentary expression editor (Added support for expressions and UI errors maplibre/maputnik#620), though progress seems to have stalled on something more sophisticated (More advanced expression editor maplibre/maputnik#622). If that doesn’t work for some reason, there’s always Mapbox Studio.This would be a minimum viable path to localized labels:
name:*keys.name:*keys, or at least the most commonname:*keys, in its TOML configuration.text-fieldproperties from the legacy style function and token syntaxes to expressions. This can happen layer by layer; it doesn’t have to happen all at once.Americana plans to eventually split out its more sophisticated bilingual labeling as a plugin (osm-americana/openstreetmap-americana#914), but Mapbox GL Language is a decent starting point.
jeffreyameyer commentedon Oct 3, 2023
@danrademacher - can we get this broken out appropriately as an example of a tile styling pipeline improvement, per our weekly meeting today?
jeffreyameyer commentedon Oct 3, 2023
IMO, it would be best to have a 2-line labeling system of some sort - first line is viewer's language, second line (smaller) is the local language.
e.g.,

danrademacher commentedon Oct 3, 2023
Here's what I see in the notes there:
Last line links back to this ticket.
I can guess that we need two tickets here, one for vector tile creation changes for DevSeed and the other for style changes by Greeninfo to come after.
But I am not sure what the DevSeed part looks like.
@batpad can you add some details? Then I can see how to best split this up.
1ec5 commentedon Oct 5, 2023
This is blocked on osm-americana/openstreetmap-americana#914, but I think even just labeling in the user’s language would be an improvement in the meantime.
My breakdown in #481 (comment) assumes client-side language filtering, but ideally the client could just pass its preferred language(s) to the server as a URL query parameter and the server would resolve the languages down to a single name field. The OSM Americana project is working on something like this for its Planetiler- and AWS-based stack, but I don’t know if it would be compatible with OHM’s Tegola-based stack. Regardless, client-side filtering does work for any tileset, so we’ll try to package that up for OHM to use.
jeffreyameyer commentedon Nov 28, 2023
Let's disregard the 2-line labeling requirement for this ticket and see what we can do to enable the original request of rendering labels in the viewer's language, using either of the methods @1ec5 describes above – client-side language filtering or passing the viewer's language as a URL-query parameter.
jeffreyameyer commentedon Nov 28, 2023
@danrademacher - is there anything we are blocked in from Minh's comment above? #481 (comment)
batpad commentedon Nov 28, 2023
@Rub21 @geohacker - can we add all
name:*keys to the vector tiles?11 remaining items
danrademacher commentedon Jun 4, 2024
Ok, so looking at the changes and comments in the PR https://github.com/openstreetmap/openstreetmap-website/pull/4042/files, there's a lot to process here.
As far as we know, is the PR to OSM fully functional but just subject to debate about desireability? I see based on the comments over there that it might be working at https://osm.openmaptiles.org/#map=5/25.364/92.153&layers=V, though when I use my locale switcher to test different languages, I don't see labels changing (tried French, Arabic, Chinese, Vietnamese), though maybe they are changing in some cases I'm not noticing. I thought maybe I needed to log in to see it work, but I couldn't get my OSM login to work on the OMT clone, and also couldn't make an account there. I might be missing something!
Anyway, question stands: Is that PR working code we need to mine for insights into how we would do it, or maybe we don't know? Either answer is fine, but I'll frame our approach differently depending.
1ec5 commentedon Jun 4, 2024
Yes, openstreetmap/openstreetmap-website#4042 is functional last I checked. However, MapTiler recently removed support for backfilling translations from Wikidata over concerns about misleading mappers into thinking the translations are coming from OSM. So in practice, you’re going to see far fewer translated labels on that site. Fortunately, we don’t use MapTiler-hosted tiles. At some point we may want to have our labels fall back to Wikidata also, but that’ll be independent of this effort. (It may require more substantial work such as migrating away from Tegola.)
The only interesting aspect of that PR from our perspective is hooking up the language selection to your account preferences. Otherwise, it’s just a straightforward installation of the mapbox-gl-language plugin. But it won’t work until the tiles contain the localized names (#679) and the styles migrate to expressions (#775) so that they can read those localized names with an appropriate fallback.
danrademacher commentedon Jun 12, 2024
Update on this ticket:
name:*into vector tiles.Regarding the frontend for this, since @1ec5 wrote his original todo list for this last October, we moved away from old MapboxGL to new MapLibre.
Do we know if https://github.com/mapbox/mapbox-gl-language/ works with Maplibre? First line of the README is that it requires mapbox-gl-js, but we also use the RTL plugin with MapLibre and overall I know Mapbox GL plugins tend to work in MapLibre, so probably this is fine.
1ec5 commentedon Jun 13, 2024
Yes, mapbox-gl-language works with MapLibre GL JS too.
1ec5 commentedon May 27, 2025
Fixed in OpenHistoricalMap/ohm-deploy#530.