Fix: await 'country' to be loaded

This commit is contained in:
Pieter Vander Vennet 2023-07-18 01:53:37 +02:00
parent e3a73d551a
commit 3c5bde1ae3
6 changed files with 102 additions and 35 deletions

View file

@ -128,7 +128,7 @@
{ {
"id": "charge", "id": "charge",
"question": { "question": {
"en": "How much does it cost to press a coin?" "en": "How much does it cost to press a penny?"
}, },
"freeform": { "freeform": {
"key": "charge", "key": "charge",
@ -140,20 +140,20 @@
{ {
"if": "charge=1 EUR", "if": "charge=1 EUR",
"then": { "then": {
"en": "It costs 1 euro to press a coin." "en": "It costs 1 euro to press a penny."
}, },
"hideInAnswer": "_currency!~.*EUR.*" "hideInAnswer": "_currency!~.*EUR.*"
}, },
{ {
"if": "charge=2 EUR", "if": "charge=2 EUR",
"then": { "then": {
"en": "It costs 2 euros to press a coin." "en": "It costs 2 euros to press a penny."
}, },
"hideInAnswer": "_currency!~.*EUR.*" "hideInAnswer": "_currency!~.*EUR.*"
} }
], ],
"render": { "render": {
"en": "It costs {charge} to press a coin." "en": "It costs {charge} to press a penny."
} }
}, },
"denominations-coins", "denominations-coins",

View file

@ -46,7 +46,6 @@
"startLon": 0, "startLon": 0,
"startZoom": 1, "startZoom": 1,
"widenFactor": 2, "widenFactor": 2,
"clustering": { "clustering": {
"maxZoom": 14, "maxZoom": 14,
"minNeededElements": 250 "minNeededElements": 250

View file

@ -1,13 +1,19 @@
{ {
"id": "mapcomplete-changes", "id": "mapcomplete-changes",
"title": { "title": {
"en": "Changes made with MapComplete" "en": "Changes made with MapComplete",
"de": "Mit MapComplete erstellte Änderungen",
"nl": "Wijzigingen gemaakt met MapComplete"
}, },
"shortDescription": { "shortDescription": {
"en": "Shows changes made by MapComplete" "en": "Show changes made with MapComplete",
"de": "Mit MapComplete erstellte Änderungen anzeigen",
"nl": "Toon wijzigingen gemaakt met MapComplete"
}, },
"description": { "description": {
"en": "This maps shows all the changes made with MapComplete" "en": "This maps shows all the changes made with MapComplete",
"de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen",
"nl": "Deze kaart toont alle wijzigingen die met MapComplete gemaakt werden"
}, },
"icon": "./assets/svg/logo.svg", "icon": "./assets/svg/logo.svg",
"hideFromOverview": true, "hideFromOverview": true,
@ -20,7 +26,9 @@
{ {
"id": "mapcomplete-changes", "id": "mapcomplete-changes",
"name": { "name": {
"en": "Changeset centers" "en": "Changeset centers",
"de": "Zentrum der Änderungssätze",
"nl": "Centerpunt van changeset"
}, },
"minzoom": 0, "minzoom": 0,
"source": { "source": {
@ -31,41 +39,51 @@
}, },
"title": { "title": {
"render": { "render": {
"en": "Changeset for {theme}" "en": "Changeset for {theme}",
"de": "Änderungssatz für {theme}"
} }
}, },
"description": { "description": {
"en": "Shows all MapComplete changes" "en": "Show all MapComplete changes",
"de": "Alle MapComplete-Änderungen anzeigen",
"nl": "Toon alle MapComplete wijzigingen"
}, },
"tagRenderings": [ "tagRenderings": [
{ {
"id": "show_changeset_id", "id": "show_changeset_id",
"render": { "render": {
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>" "en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
"de": "Änderungssatz <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
} }
}, },
{ {
"id": "contributor", "id": "contributor",
"question": { "question": {
"en": "What contributor did make this change?" "en": "Which contributor made this change?",
"de": "Welcher Mitwirkende hat diese Änderung vorgenommen?",
"nl": "Welke bijdrager maakte deze wijziging?"
}, },
"freeform": { "freeform": {
"key": "user" "key": "user"
}, },
"render": { "render": {
"en": "Change made by <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>" "en": "Change made by <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>",
"de": "Änderung gemacht von <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>",
"nl": "Wijziging gemaakt door <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>"
} }
}, },
{ {
"id": "theme-id", "id": "theme-id",
"question": { "question": {
"en": "What theme was used to make this change?" "en": "What theme was used to make this change?",
"de": "Welches Thema wurde für diese Änderung verwendet?\""
}, },
"freeform": { "freeform": {
"key": "theme" "key": "theme"
}, },
"render": { "render": {
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>" "en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>",
"de": "Geändert mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
} }
}, },
{ {
@ -74,19 +92,27 @@
"key": "locale" "key": "locale"
}, },
"question": { "question": {
"en": "What locale (language) was this change made in?" "en": "What locale (language) was this change made in?",
"de": "In welcher Sprache wurde diese Änderung vorgenommen?",
"nl": "In welke locale (taal) werd deze wijziging gemaakt?"
}, },
"render": { "render": {
"en": "User locale is {locale}" "en": "User locale is {locale}",
"de": "Usersprache ist {locale}",
"nl": "De gebruikerstaal is {locale}"
} }
}, },
{ {
"id": "host", "id": "host",
"render": { "render": {
"en": "Change with with <a href='{host}'>{host}</a>" "en": "Change made with <a href='{host}'>{host}</a>",
"de": "Änderung vorgenommen mit <a href='{host}'>{host}</a>",
"nl": "Wijziging gemaakt met <a href='{host}'>{host}</a>"
}, },
"question": { "question": {
"en": "What host (website) was this change made with?" "en": "What host (website) was this change made with?",
"de": "Mit welchem Host / welcher Website wurde diese Änderung gemacht?",
"nl": "Met welke host (website) werd deze wijziging gemaakt?"
}, },
"freeform": { "freeform": {
"key": "host" "key": "host"
@ -107,10 +133,12 @@
{ {
"id": "version", "id": "version",
"question": { "question": {
"en": "What version of MapComplete was used to make this change?" "en": "What version of MapComplete was used to make this change?",
"de": "Mit welcher Version von MapComplete wurde diese Änderung gemacht?"
}, },
"render": { "render": {
"en": "Made with {editor}" "en": "Made with {editor}",
"de": "Erstellt mit {editor}"
}, },
"freeform": { "freeform": {
"key": "editor" "key": "editor"
@ -452,7 +480,9 @@
} }
], ],
"question": { "question": {
"en": "Themename contains {search}" "en": "Theme name contains {search}",
"de": "Themenname enthält {search}",
"nl": "Themenaam bevat {search}"
} }
} }
] ]
@ -468,7 +498,9 @@
} }
], ],
"question": { "question": {
"en": "Made by contributor {search}" "en": "Made by contributor {search}",
"de": "Erstellt von {search}",
"nl": "Gemaakt door bijdrager {search}"
} }
} }
] ]
@ -484,7 +516,9 @@
} }
], ],
"question": { "question": {
"en": "<b>Not</b> made by contributor {search}" "en": "<b>Not</b> made by contributor {search}",
"de": "<b>Nicht</b> erstellt von {search}",
"nl": "<b>Niet</b> gemaakt door bijdrager {search}"
} }
} }
] ]
@ -501,7 +535,9 @@
} }
], ],
"question": { "question": {
"en": "Made before {search}" "en": "Made before {search}",
"de": "Erstellt vor {search}",
"nl": "Gemaakt voor {search}"
} }
} }
] ]
@ -518,7 +554,9 @@
} }
], ],
"question": { "question": {
"en": "Made after {search}" "en": "Made after {search}",
"de": "Erstellt nach {search}",
"nl": "Gemaakt na {search}"
} }
} }
] ]
@ -534,7 +572,9 @@
} }
], ],
"question": { "question": {
"en": "User language (iso-code) {search}" "en": "User language (iso-code) {search}",
"de": "Benutzersprache (ISO-Code) {search}",
"nl": "De taal van de bijdrager is {search}"
} }
} }
] ]
@ -550,7 +590,9 @@
} }
], ],
"question": { "question": {
"en": "Made with host {search}" "en": "Made with host {search}",
"de": "Erstellt mit Host {search}",
"nl": "Gemaakt met host {search}"
} }
} }
] ]
@ -561,7 +603,9 @@
{ {
"osmTags": "add-image>0", "osmTags": "add-image>0",
"question": { "question": {
"en": "Changeset added at least one image" "en": "Changeset added at least one image",
"de": "Changeset fügte mindestens ein Bild hinzu",
"nl": "Changeset bevat minstens één afbeelding"
} }
} }
] ]
@ -576,7 +620,8 @@
{ {
"id": "link_to_more", "id": "link_to_more",
"render": { "render": {
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>" "en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>",
"de": "Mehr Statistiken gibt es <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>"
} }
}, },
{ {

View file

@ -9400,6 +9400,17 @@
} }
} }
}, },
"fixate-north": {
"mappings": {
"0": {
"then": "Allow to rotate the map"
},
"1": {
"then": "Always keep north pointing up"
}
},
"question": "Should north always be up?"
},
"inbox": { "inbox": {
"mappings": { "mappings": {
"0": { "0": {

View file

@ -635,6 +635,9 @@
"render": "It costs {charge} to press a penny." "render": "It costs {charge} to press a penny."
}, },
"coin": { "coin": {
"freeform": {
"placeholder": "Coin type (e.g. 10cent)"
},
"mappings": { "mappings": {
"0": { "0": {
"then": "This penny press uses a 2 cent coin for pressing." "then": "This penny press uses a 2 cent coin for pressing."
@ -644,9 +647,16 @@
}, },
"2": { "2": {
"then": "This penny press uses a 10 cent coin for pressing." "then": "This penny press uses a 10 cent coin for pressing."
},
"3": {
"then": "This penny press uses a 25 cent coin for pressing."
},
"4": {
"then": "This penny press uses a 50 cent coin for pressing."
} }
}, },
"question": "What coin is used for pressing?" "question": "What coin is used for pressing?",
"render": "This penny press uses a {coin:type} coin for pressing."
}, },
"designs": { "designs": {
"freeform": { "freeform": {

View file

@ -590,11 +590,13 @@ export default class SimpleMetaTaggers {
doc: "Adds the currency valid for the object, based on country or explicit tagging. Can be a single currency or a semicolon-separated list of currencies. Empty if no currency is found.", doc: "Adds the currency valid for the object, based on country or explicit tagging. Can be a single currency or a semicolon-separated list of currencies. Empty if no currency is found.",
isLazy: true, isLazy: true,
}, },
(feature) => { (feature: Feature, layer: LayerConfig, tagsStore: UIEventSource<OsmTags>) => {
Utils.AddLazyProperty(feature.properties, "_currency", () => { Utils.AddLazyPropertyAsync(feature.properties, "_currency", async () => {
// Wait until _country is actually set
await tagsStore.AsPromise((tags) => !!tags._country)
// Initialize a list of currencies // Initialize a list of currencies
const currencies = {} const currencies = {}
// Check if there are any currency:XXX tags, add them to the map // Check if there are any currency:XXX tags, add them to the map
for (const key in feature.properties) { for (const key in feature.properties) {
if (key.startsWith("currency:")) { if (key.startsWith("currency:")) {