From e28f4aeaf7cadcfb0beebd2ed092a93c26334fc1 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 27 May 2024 10:21:34 +0200 Subject: [PATCH] Fix build --- .../mapcomplete-changes.json | 87 +++++++------------ .../ThemeConfig/Conversion/PrepareTheme.ts | 1 + .../ThemeConfig/Conversion/Validation.ts | 4 +- src/UI/i18n/Translation.ts | 4 +- src/Utils.ts | 2 +- 5 files changed, 35 insertions(+), 63 deletions(-) diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index 2ebfce4ba..9e119e077 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -1,16 +1,13 @@ { "id": "mapcomplete-changes", "title": { - "en": "Changes made with MapComplete", - "de": "Änderungen mit MapComplete" + "en": "Changes made with MapComplete" }, "shortDescription": { - "en": "Shows changes made by MapComplete", - "de": "Änderungen von MapComplete anzeigen" + "en": "Shows changes made by MapComplete" }, "description": { - "en": "This maps shows all the changes made with MapComplete", - "de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen" + "en": "This maps shows all the changes made with MapComplete" }, "icon": "./assets/svg/logo.svg", "hideFromOverview": true, @@ -21,8 +18,7 @@ { "id": "mapcomplete-changes", "name": { - "en": "Changeset centers", - "de": "Zentrum der Änderungssätze" + "en": "Changeset centers" }, "minzoom": 0, "source": { @@ -32,48 +28,41 @@ }, "title": { "render": { - "en": "Changeset for {theme}", - "de": "Änderungssatz für {theme}" + "en": "Changeset for {theme}" } }, "description": { - "en": "Shows all MapComplete changes", - "de": "Alle MapComplete-Änderungen anzeigen" + "en": "Shows all MapComplete changes" }, "tagRenderings": [ { "id": "show_changeset_id", "render": { - "en": "Changeset {id}", - "de": "Änderungssatz {id}" + "en": "Changeset {id}" } }, { "id": "contributor", "question": { - "en": "What contributor did make this change?", - "de": "Welcher Mitwirkende hat diese Änderung vorgenommen?" + "en": "What contributor did make this change?" }, "freeform": { "key": "user" }, "render": { - "en": "Change made by {user}", - "de": "Änderung vorgenommen von {user}" + "en": "Change made by {user}" } }, { "id": "theme-id", "question": { - "en": "What theme was used to make this change?", - "de": "Welches Thema wurde für die Änderung verwendet?" + "en": "What theme was used to make this change?" }, "freeform": { "key": "theme" }, "render": { - "en": "Change with theme {theme}", - "de": "Geändert mit Thema {theme}" + "en": "Change with theme {theme}" } }, { @@ -82,23 +71,19 @@ "key": "locale" }, "question": { - "en": "What locale (language) was this change made in?", - "de": "In welcher Benutzersprache wurde die Änderung vorgenommen?" + "en": "What locale (language) was this change made in?" }, "render": { - "en": "User locale is {locale}", - "de": "Benutzersprache {locale}" + "en": "User locale is {locale}" } }, { "id": "host", "render": { - "en": "Change with with {host}", - "de": "Änderung über {host}" + "en": "Change with with {host}" }, "question": { - "en": "What host (website) was this change made with?", - "de": "Über welchen Host (Webseite) wurde diese Änderung vorgenommen?" + "en": "What host (website) was this change made with?" }, "freeform": { "key": "host" @@ -119,12 +104,10 @@ { "id": "version", "question": { - "en": "What version of MapComplete was used to make this change?", - "de": "Mit welcher MapComplete Version wurde die Änderung vorgenommen?" + "en": "What version of MapComplete was used to make this change?" }, "render": { - "en": "Made with {editor}", - "de": "Erstellt mit {editor}" + "en": "Made with {editor}" }, "freeform": { "key": "editor" @@ -506,8 +489,7 @@ } ], "question": { - "en": "Themename contains {search}", - "de": "Themenname enthält {search}" + "en": "Themename contains {search}" } } ] @@ -523,8 +505,7 @@ } ], "question": { - "en": "Themename does not contain {search}", - "de": "Themename enthält not {search}" + "en": "Themename does not contain {search}" } } ] @@ -540,8 +521,7 @@ } ], "question": { - "en": "Made by contributor {search}", - "de": "Erstellt vom Mitwirkenden {search}" + "en": "Made by contributor {search}" } } ] @@ -557,8 +537,7 @@ } ], "question": { - "en": "Not made by contributor {search}", - "de": "Nicht erstellt von Mitwirkendem {search}" + "en": "Not made by contributor {search}" } } ] @@ -575,8 +554,7 @@ } ], "question": { - "en": "Made before {search}", - "de": "Erstellt vor {search}" + "en": "Made before {search}" } } ] @@ -593,8 +571,7 @@ } ], "question": { - "en": "Made after {search}", - "de": "Erstellt nach {search}" + "en": "Made after {search}" } } ] @@ -610,8 +587,7 @@ } ], "question": { - "en": "User language (iso-code) {search}", - "de": "Benutzersprache (ISO-Code) {search}" + "en": "User language (iso-code) {search}" } } ] @@ -627,8 +603,7 @@ } ], "question": { - "en": "Made with host {search}", - "de": "Erstellt mit Host {search}" + "en": "Made with host {search}" } } ] @@ -639,8 +614,7 @@ { "osmTags": "add-image>0", "question": { - "en": "Changeset added at least one image", - "de": "Änderungssatz hat mindestens ein Bild hinzugefügt" + "en": "Changeset added at least one image" } } ] @@ -651,8 +625,7 @@ { "osmTags": "theme!=grb", "question": { - "en": "Exclude GRB theme", - "de": "GRB-Thema ausschließen" + "en": "Exclude GRB theme" } } ] @@ -663,8 +636,7 @@ { "osmTags": "theme!=etymology", "question": { - "en": "Exclude etymology theme", - "de": "Etymologie-Thema ausschließen" + "en": "Exclude etymology theme" } } ] @@ -679,8 +651,7 @@ { "id": "link_to_more", "render": { - "en": "More statistics can be found here", - "de": "Weitere Statistiken gibt es hier" + "en": "More statistics can be found here" } }, { diff --git a/src/Models/ThemeConfig/Conversion/PrepareTheme.ts b/src/Models/ThemeConfig/Conversion/PrepareTheme.ts index 656e33479..a634944c3 100644 --- a/src/Models/ThemeConfig/Conversion/PrepareTheme.ts +++ b/src/Models/ThemeConfig/Conversion/PrepareTheme.ts @@ -269,6 +269,7 @@ class AddImportLayers extends DesugaringStep { json.layers.push(importLayerResult) } } catch (e) { + console.error("Error", e) context.err("Could not generate an import-layer for " + layer.id + " due to " + e) } } diff --git a/src/Models/ThemeConfig/Conversion/Validation.ts b/src/Models/ThemeConfig/Conversion/Validation.ts index c6e198fa8..b4a9e1caa 100644 --- a/src/Models/ThemeConfig/Conversion/Validation.ts +++ b/src/Models/ThemeConfig/Conversion/Validation.ts @@ -1890,7 +1890,7 @@ export class DetectDuplicatePresets extends DesugaringStep { ) const layerIds = layersWithDup.map((l) => l.id) context.err( - `This themes has multiple presets which are named:${dups}, namely layers ${layerIds.join( + `This theme has multiple presets which are named:${dups}, namely layers ${layerIds.join( ", " )} this is confusing for contributors and is probably the result of reusing the same layer multiple times. Use \`{"override": {"=presets": []}}\` to remove some presets` ) @@ -1911,7 +1911,7 @@ export class DetectDuplicatePresets extends DesugaringStep { ) ) { context.err( - `This themes has multiple presets with the same tags: ${presetATags.asHumanString( + `This theme has multiple presets with the same tags: ${presetATags.asHumanString( false, false, {} diff --git a/src/UI/i18n/Translation.ts b/src/UI/i18n/Translation.ts index 620058069..b0d06b034 100644 --- a/src/UI/i18n/Translation.ts +++ b/src/UI/i18n/Translation.ts @@ -174,10 +174,10 @@ export class Translation extends BaseUIElement { return "en" } for (const i in this.translations) { - return this.translations[i] // Return a random language + return i // Return a random language } console.error("Missing language ", Locale.language.data, "for", this.translations) - return "" + return undefined } public textFor(language: string): string | undefined { return this.translations[this.actualLanguage(language)] diff --git a/src/Utils.ts b/src/Utils.ts index 21b6512a5..44b9af83c 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -523,7 +523,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be v = v.translations[useLang] ?? v.translations["*"] ?? - (v.textFor !== undefined ? v.textFor(useLang) : v) + (v?.textFor(useLang) ?? v) } if (v.InnerConstructElement !== undefined) {