MapComplete/src/UI/Base/Tr.svelte

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
700 B
Svelte
Raw Normal View History

2023-03-29 17:21:20 +02:00
<script lang="ts">
/**
* Properly renders a translation
*/
import { Translation } from "../i18n/Translation"
import WeblateLink from "./WeblateLink.svelte"
import { Store } from "../../Logic/UIEventSource"
import FromHtml from "./FromHtml.svelte"
import { Utils } from "../../Utils"
2023-03-29 17:21:20 +02:00
export let t: Translation
2023-05-14 03:24:13 +02:00
export let cls: string = ""
2023-03-29 17:21:20 +02:00
// Text for the current language
2023-12-13 00:53:31 +01:00
let txt: Store<string | undefined> = t?.current
let lang = t?.currentLang
2023-12-30 15:24:30 +01:00
$: {
txt = t?.current
lang = t?.currentLang
2023-12-30 15:24:30 +01:00
}
2023-03-29 17:21:20 +02:00
</script>
{#if $txt}
<span class={cls}>
<span lang={$lang}>
{@html Utils.purify($txt)}
</span>
<WeblateLink context={t?.context} />
2023-04-07 02:45:34 +02:00
</span>
{/if}