From 92c6e70c8f9d5ec2f84029c2d6e7e147893e5dd6 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sun, 1 May 2022 22:58:59 +0200 Subject: [PATCH] Fix translation links in import notes --- .../Conversion/CreateNoteImportLayer.ts | 25 ++++++++++++++----- UI/i18n/Translation.ts | 7 +++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Models/ThemeConfig/Conversion/CreateNoteImportLayer.ts b/Models/ThemeConfig/Conversion/CreateNoteImportLayer.ts index 14bf636886..93dfd02ea4 100644 --- a/Models/ThemeConfig/Conversion/CreateNoteImportLayer.ts +++ b/Models/ThemeConfig/Conversion/CreateNoteImportLayer.ts @@ -3,7 +3,7 @@ import LayerConfig from "../LayerConfig"; import {LayerConfigJson} from "../Json/LayerConfigJson"; import Translations from "../../../UI/i18n/Translations"; import PointRenderingConfigJson from "../Json/PointRenderingConfigJson"; -import {Translation} from "../../../UI/i18n/Translation"; +import {Translation, TypedTranslation} from "../../../UI/i18n/Translation"; export default class CreateNoteImportLayer extends Conversion { /** @@ -50,9 +50,13 @@ export default class CreateNoteImportLayer extends Conversion(translation: TypedTranslation, subs: T) : object{ + return {...translation.Subs(subs).translations, "_context": translation.context} + } const result: LayerConfigJson = { "id": "note_import_" + layer.id, // By disabling the name, the import-layers won't pollute the filter view "name": t.layerName.Subs({title: layer.title.render}).translations, - "description": t.description.Subs({title: layer.title.render}).translations, + "description": trs(t.description , {title: layer.title.render}), "source": { "osmTags": { "and": [ @@ -80,7 +93,7 @@ export default class CreateNoteImportLayer extends Conversion extends Translation { * subbed.textFor("nl") // => "Volledige zin met onderdeel" */ Subs(text: T, context?: string): Translation { - return this.OnEveryLanguage((template, lang) => Utils.SubstituteKeys(template, text, lang), context) + return this.OnEveryLanguage((template, lang) => { + if(lang === "_context"){ + return template + } + return Utils.SubstituteKeys(template, text, lang); + }, context) } } \ No newline at end of file