mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(web): i18n race condition in load function (#10693)
This commit is contained in:
parent
24c1855899
commit
8f553ddb39
31 changed files with 74 additions and 89 deletions
13
web/src/lib/utils/i18n.ts
Normal file
13
web/src/lib/utils/i18n.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { locale, t, waitLocale } from 'svelte-i18n';
|
||||
import { get, type Unsubscriber } from 'svelte/store';
|
||||
|
||||
export async function getFormatter() {
|
||||
let unsubscribe: Unsubscriber | undefined;
|
||||
await new Promise((resolve) => {
|
||||
unsubscribe = locale.subscribe((value) => value && resolve(value));
|
||||
});
|
||||
unsubscribe?.();
|
||||
|
||||
await waitLocale();
|
||||
return get(t);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue