From 2e9b1016de43ad0a1f294ea0d92ada7c429303f8 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 7 Apr 2023 02:45:34 +0200 Subject: [PATCH] refactoring: fix translation links --- UI/Base/Tr.svelte | 22 +++++++++------ UI/Base/WeblateLink.svelte | 27 +++++++++++++++++++ .../TagRendering/SpecialTranslation.svelte | 10 ++++--- UI/i18n/Translation.ts | 2 +- css/index-tailwind-output.css | 25 +++++++++-------- 5 files changed, 63 insertions(+), 23 deletions(-) create mode 100644 UI/Base/WeblateLink.svelte diff --git a/UI/Base/Tr.svelte b/UI/Base/Tr.svelte index 35ec819e43..adbb54a6af 100644 --- a/UI/Base/Tr.svelte +++ b/UI/Base/Tr.svelte @@ -7,6 +7,7 @@ import Locale from "../i18n/Locale"; import { Utils } from "../../Utils"; import FromHtml from "./FromHtml.svelte"; + import WeblateLink from "./WeblateLink.svelte"; export let t: Translation; export let tags: Record | undefined = undefined; @@ -14,17 +15,22 @@ let txt: string | undefined; $: onDestroy(Locale.language.addCallbackAndRunD(l => { - const translation = t?.textFor(l) - if(translation === undefined){ - return + const translation = t?.textFor(l); + if (translation === undefined) { + return; } - if(tags){ - txt = Utils.SubstituteKeys(txt, tags) - }else{ - txt = translation + if (tags) { + txt = Utils.SubstituteKeys(txt, tags); + } else { + txt = translation; } })); - +{#if t} + + + + +{/if} diff --git a/UI/Base/WeblateLink.svelte b/UI/Base/WeblateLink.svelte new file mode 100644 index 0000000000..289aba990d --- /dev/null +++ b/UI/Base/WeblateLink.svelte @@ -0,0 +1,27 @@ + + + +{#if context} + {#if $linkOnMobile} + + + + {:else if $linkToWeblate} + + + + {/if} +{/if} diff --git a/UI/Popup/TagRendering/SpecialTranslation.svelte b/UI/Popup/TagRendering/SpecialTranslation.svelte index c4908cde9a..3cea541166 100644 --- a/UI/Popup/TagRendering/SpecialTranslation.svelte +++ b/UI/Popup/TagRendering/SpecialTranslation.svelte @@ -8,8 +8,9 @@ import type { Feature } from "geojson"; import { UIEventSource } from "../../../Logic/UIEventSource.js"; import ToSvelte from "../../Base/ToSvelte.svelte"; - import FromHtml from "../../Base/FromHtml.svelte"; import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"; + import WeblateLink from "../../Base/WeblateLink.svelte"; + import FromHtml from "../../Base/FromHtml.svelte"; /** * The 'specialTranslation' renders a `Translation`-object, but interprets the special values as well @@ -33,8 +34,11 @@ {#each specs as specpart} - {#if typeof specpart === "string"} - + {#if typeof specpart === "string"} + + + + {:else if $tags !== undefined } {/if} diff --git a/UI/i18n/Translation.ts b/UI/i18n/Translation.ts index 3c0a57d87e..f934ade060 100644 --- a/UI/i18n/Translation.ts +++ b/UI/i18n/Translation.ts @@ -7,7 +7,7 @@ export class Translation extends BaseUIElement { public static forcedLanguage = undefined public readonly translations: Record - context?: string + public readonly context?: string constructor(translations: Record, context?: string) { super() diff --git a/css/index-tailwind-output.css b/css/index-tailwind-output.css index 9ab4f27b5d..45090b5bfe 100644 --- a/css/index-tailwind-output.css +++ b/css/index-tailwind-output.css @@ -762,8 +762,12 @@ video { top: 1rem; } -.bottom-2 { - bottom: 0.5rem; +.right-1 { + right: 0.25rem; +} + +.bottom-1 { + bottom: 0.25rem; } .left-1\/2 { @@ -1039,6 +1043,10 @@ video { height: 3rem; } +.h-6 { + height: 1.5rem; +} + .h-screen { height: 100vh; } @@ -1047,10 +1055,6 @@ video { height: 1rem; } -.h-6 { - height: 1.5rem; -} - .h-1\/2 { height: 50%; } @@ -1170,11 +1174,6 @@ video { width: 24rem; } -.w-min { - width: -webkit-min-content; - width: min-content; -} - .w-24 { width: 6rem; } @@ -1455,6 +1454,10 @@ video { border-style: solid; } +.border-dashed { + border-style: dashed; +} + .border-dotted { border-style: dotted; }