gramps-web icon indicating copy to clipboard operation
gramps-web copied to clipboard

OpenHistoricalMap labels should be in the preferred language

Open 1ec5 opened this issue 1 year ago • 2 comments

OpenHistoricalMap is currently shown with the labels in the default language, which is intended to be the local contemporary language. Perhaps users would prefer to see the labels in a consistent language matching either the frontend language settings or the server language, as requested in this forum topic.

Since OHM is being consumed in vector tiles, it’s possible to swap in other languages on the fly, as long as OHM has those alternative names. The mapbox-gl-language plugin can systematically swap label languages throughout a stylesheet. It’s a bit finicky and I’d like to write a half-decent replacement, but it should do for now. OpenHistoricalMap/openhistoricalmap-embed#8 demonstrates language switching based on a URL parameter.

1ec5 avatar Sep 10 '24 05:09 1ec5

I finally looked into this, but I'm having troubles importing that package because it's not an ESM module...

DavidMStraub avatar Jul 05 '25 19:07 DavidMStraub

Oof, sorry to hear that. I really need to get moving on osm-americana/openstreetmap-americana#914 to replace this clunky mapbox-gl-language plugin. In the meantime, you can get basic functionality by iterating over all the layers (as this project previously did for date filtering), detecting a get expression in the text-field value, replacing its name argument with name_*, and updating the layer’s text-field value. This assumes you already know which language the map should be localized into.

1ec5 avatar Jul 06 '25 23:07 1ec5