mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 09:15:35 +03:00
fix(web): i18n race condition in load function (#10693)
This commit is contained in:
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);
|
||||
}
|
||||
Reference in New Issue
Block a user