diff --git a/frontend/app/src/components/App.svelte b/frontend/app/src/components/App.svelte index df33df7c04..bfe9058a3d 100644 --- a/frontend/app/src/components/App.svelte +++ b/frontend/app/src/components/App.svelte @@ -45,6 +45,7 @@ import IncomingCall from "./home/video/IncomingCall.svelte"; import InstallPrompt from "./home/InstallPrompt.svelte"; import NotificationsBar from "./home/NotificationsBar.svelte"; + import { reviewingTranslations } from "../i18n/i18n"; overrideItemIdKeyNameBeforeInitialisingDndZones("_id"); @@ -428,7 +429,7 @@ {:else if $identityState.kind === "upgrading_user" || $identityState.kind === "upgrade_user"} {:else if $identityState.kind === "anon" || $identityState.kind === "logging_in" || $identityState.kind === "registering" || $identityState.kind === "logged_in" || $identityState.kind === "loading_user" || $identityState.kind === "challenging"} - {#if !$isLoading} + {#if !$isLoading || $reviewingTranslations} ("client"); @@ -35,12 +35,15 @@ $: formattedBalance = client.formatTokens(chatBalance, 8); onMount(async () => { + reviewingTranslations.set(true); await client.getProposedTranslationCorrections().then(async (res) => { corrections = await loadRequiredLocales(flattenCorrections(res)); }); refreshBalance(); }); + onDestroy(() => reviewingTranslations.set(false)); + // Since the locales are lazy loaded, we need to determine the locales for which we have corrections // and trigger the loading of the current translations for each of those locales. async function loadRequiredLocales( @@ -51,9 +54,9 @@ all.add(c.locale); return all; }, new Set()); - await [...locales].reduce((p, l) => { - return p.then(() => locale.set(l)); - }, Promise.resolve()); + for (const l of locales) { + await locale.set(l); + } await locale.set(currentLocale); return corrections; } diff --git a/frontend/app/src/i18n/i18n.ts b/frontend/app/src/i18n/i18n.ts index a2653cf71c..7e754498f2 100644 --- a/frontend/app/src/i18n/i18n.ts +++ b/frontend/app/src/i18n/i18n.ts @@ -154,6 +154,7 @@ export function interpolate( export const editmode = writable(false); export const editingLabel = writable(undefined); +export const reviewingTranslations = writable(false); export function i18nKey( key: string,