Fix build

This commit is contained in:
Pieter Vander Vennet 2024-05-27 10:21:34 +02:00
parent 12a200c54d
commit e28f4aeaf7
5 changed files with 35 additions and 63 deletions

View file

@ -269,6 +269,7 @@ class AddImportLayers extends DesugaringStep<LayoutConfigJson> {
json.layers.push(importLayerResult)
}
} catch (e) {
console.error("Error", e)
context.err("Could not generate an import-layer for " + layer.id + " due to " + e)
}
}

View file

@ -1890,7 +1890,7 @@ export class DetectDuplicatePresets extends DesugaringStep<LayoutConfig> {
)
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<LayoutConfig> {
)
) {
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,
{}

View file

@ -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)]

View file

@ -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) {