[openstreetmap/openstreetmap-website] Move more map layer logic to MapLayers lib to simplify JS (PR #5832)

Marwin Hochfelsner notifications at github.com
Fri Mar 21 07:31:01 UTC 2025


This PR moves name and attribution i18n from `L.OSM.Map.initialize` to the new `MapLayers` lib from #5809.
So I could remove `layerConstructor` redefinitions and simplify the generation of the map's `baseLayers` by using `OSM.LAYER_DEFINITIONS.map()`.
There might be a better place for the translations I moved from `javascripts.map` to `site.index.map` but I couldn't find one.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/5832

-- Commit Summary --

  * Translate names in MapLayers lib
  * Build attribution in MapLayers lib
  * Refactor map base layer initialization

-- File Changes --

    M app/assets/javascripts/leaflet.map.js (69)
    M config/locales/en.yml (41)
    M lib/map_layers.rb (32)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5832.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5832.diff

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

Message ID: <openstreetmap/openstreetmap-website/pull/5832 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250321/29e4fbcc/attachment-0001.htm>


More information about the rails-dev mailing list