From 20d9a26a8cc8dde15ad417f916e9d90995a0f236 Mon Sep 17 00:00:00 2001 From: Abdo Date: Tue, 26 Oct 2021 13:11:25 +0300 Subject: [PATCH] Strip isolation chars from deck options warnings to fix RTL display (#1457) Co-authored-by: Damien Elmes --- ts/deck-options/Warning.svelte | 3 ++- ts/lib/i18n/utils.ts | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ts/deck-options/Warning.svelte b/ts/deck-options/Warning.svelte index e80fdb09c..36b224ccc 100644 --- a/ts/deck-options/Warning.svelte +++ b/ts/deck-options/Warning.svelte @@ -5,6 +5,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html @@ -12,7 +13,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {#if warning}
- {warning} + {withoutUnicodeIsolation(warning)}
{/if} diff --git a/ts/lib/i18n/utils.ts b/ts/lib/i18n/utils.ts index 63288d640..45b9935ad 100644 --- a/ts/lib/i18n/utils.ts +++ b/ts/lib/i18n/utils.ts @@ -62,6 +62,10 @@ export function withCollapsedWhitespace(s: string): string { return s.replace(/\s+/g, " "); } +export function withoutUnicodeIsolation(s: string): string { + return s.replace(/[\u2068-\u2069]+/g, ""); +} + export async function setupI18n(args: { modules: ModuleName[] }): Promise { const resp = await fetch("/_anki/i18nResources", { method: "POST",