[openstreetmap/openstreetmap-website] Allow arrays of names in map key entries (PR #4425)

Anton Khorev notifications at github.com
Wed Dec 20 01:26:48 UTC 2023


Fix #3816 by not constructing sentences and not having combined i18n strings.

I don't think sentences are expected in map key, so instead of this:
![image](https://github.com/openstreetmap/openstreetmap-website/assets/4158490/efe18e2e-e5d6-4fc1-a6b6-cb0197069ba4)
we can connect terms by dots, like we do with *secondary actions* ("Download XML ·View History" on element pages etc):
![image](https://github.com/openstreetmap/openstreetmap-website/assets/4158490/654078b9-7fe3-4104-8f1d-e946532db78c)

Don't group locale strings in site.key.table.entry. Instead of this:

          cable:
            - Cable car
            - chair lift

have this:

          cable_car: "Cable car"
          chair_lift: "Chair lift"

Group them in `key.yml`, depending on layer. Instead of this:

    - { min_zoom: 12, name: cable, image: cable.png }

have this:

    - { min_zoom: 12, name: [cable_car, chair_lift], image: cable.png }

---

The advantage is that if features are grouped differently on various layers, their names can be translated independently. For example, mapnik has different colors for parks and allotments with two different entries in `key.yml`:

    - { min_zoom: 10, name: park, width: 26, height: 10, fill: "#c8facc" }
    - { min_zoom: 10, name: allotments, width: 26, height: 10, fill: "#d4e6cc" }

Opnvkarte renders parks and allotments the same, they can have one entry:

    - { min_zoom: 12, name: [park, allotments], width: 26, height: 10, fill: "#c2d89a" }

And there can be two independent locale strings:

    park: "Park"
    allotments: "Allotments"

You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Allow arrays of names in map key entries

-- File Changes --

    M app/controllers/site_controller.rb (3)
    M app/views/site/key.html.erb (2)
    M config/key.yml (44)
    M config/locales/en.yml (47)

-- Patch Links --

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

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

Message ID: <openstreetmap/openstreetmap-website/pull/4425 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231219/b0e9c9ff/attachment.htm>


More information about the rails-dev mailing list