Allow special pitchnames for pitch-sport combinations #9

Merged
plepe merged 1 commits from Hufkratzer/main:pitchnames into master 5 years ago

This is a proposal to allow to display special names for frequently used pitch-sport combinations in the "Leisure" category via weblate where these names can also be translated.

I had found several similar entries for translations of tag combinations in weblate (e.g. for "tag:amenity=toilets diaper=yes") and have followed this scheme.

The new code constructs a string like e.g. "tag:leisure=pitch sport=tennis" and tries to find a translation. If it finds one (which in this case should be "Tennis Court") it will be used, if it doesn't the old description "Pitch - Tennis" will be displayed.

Compare iD presets for frecuently used pitches

Makes sense?

I couldn't find out yet how to insert the necessary entries in weblate. How does this work?

This is a proposal to allow to display special names for frequently used pitch-sport combinations in the "Leisure" category via weblate where these names can also be translated. I had found several similar entries for translations of tag combinations in weblate (e.g. for "tag:amenity=toilets&nbsp;diaper=yes") and have followed this scheme. The new code constructs a string like e.g. "tag:leisure=pitch&nbsp;sport=tennis" and tries to find a translation. If it finds one (which in this case should be "Tennis Court") it will be used, if it doesn't the old description "Pitch - Tennis" will be displayed. Compare <a href="https://github.com/openstreetmap/iD/tree/master/data/presets/presets/leisure/pitch">iD presets for frecuently used pitches</a> Makes sense? I couldn't find out yet how to insert the necessary entries in weblate. How does this work?
Owner

Yes, this is possible, but there's no "native" support for it.

You should use the following syntax:

{{ tagTransList("leisure=pitch sport", tags.sport) }}

Which will generate the string "tag:leisure=pitch sport=tennis" => "Tennispitch" (or so). tagTransList will handle multivalue tags, so if the tag 'sport' is "tennis;squash", it will generate a list: Tennispitch and Squashpitch.

There's no way (yet) to check, whether a string "tag:leisure=pitch sport=tennis" actually exists, nor whether it has been translated. The return value defaults to "tennis".

You can add the tags the the tags/en.json file in openstreetmap-tag-translations yourself (there's an executable "tag-add" in that repo), or I can do that for you.

Yes, this is possible, but there's no "native" support for it. You should use the following syntax: ``` {{ tagTransList("leisure=pitch sport", tags.sport) }} ``` Which will generate the string "tag:leisure=pitch sport=tennis" => "Tennispitch" (or so). `tagTransList` will handle multivalue tags, so if the tag 'sport' is "tennis;squash", it will generate a list: Tennispitch and Squashpitch. There's no way (yet) to check, whether a string "tag:leisure=pitch sport=tennis" actually exists, nor whether it has been translated. The return value defaults to "tennis". You can add the tags the the `tags/en.json` file in openstreetmap-tag-translations yourself (there's an executable "tag-add" in that repo), or I can do that for you.
plepe closed this pull request 5 years ago
Owner

I also added commit 8512e6855c to allow multi-values.

Thanks for your contribution!

I also added commit 8512e6855c1a6e3c310a29055d9cebe8f3f07791 to allow multi-values. Thanks for your contribution!
Hufkratzer deleted branch pitchnames 5 years ago
plepe referenced this issue from a commit 2 years ago
The pull request has been merged as 8fb281747a.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.