feat(web): render component in notifications (#10990)

This commit is contained in:
Michel Heusschen 2024-07-10 16:05:04 +02:00 committed by GitHub
parent 1dd1d36120
commit 59aa347912
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 88 additions and 30 deletions

View file

@ -0,0 +1,13 @@
<script lang="ts">
import FormatMessage from '$lib/components/i18n/format-message.svelte';
import type { InterpolationValues } from '$lib/components/i18n/format-message.svelte';
export let key: string;
export let values: InterpolationValues = {};
</script>
<FormatMessage {key} {values} let:message let:tag>
{#if tag === 'b'}
<b>{message}</b>
{/if}
</FormatMessage>

View file

@ -1,5 +1,10 @@
<script lang="ts" context="module">
import type { FormatXMLElementFn, PrimitiveType } from 'intl-messageformat';
export type InterpolationValues = Record<string, PrimitiveType | FormatXMLElementFn<unknown>>;
</script>
<script lang="ts">
import { IntlMessageFormat, type FormatXMLElementFn, type PrimitiveType } from 'intl-messageformat';
import { IntlMessageFormat } from 'intl-messageformat';
import {
TYPE,
type MessageFormatElement,
@ -8,8 +13,6 @@
} from '@formatjs/icu-messageformat-parser';
import { locale as i18nLocale, json } from 'svelte-i18n';
type InterpolationValues = Record<string, PrimitiveType | FormatXMLElementFn<unknown>>;
type MessagePart = {
message: string;
tag?: string;