Skip to content

Commit ef9edc8

Browse files
authored
fix(i18n): fallback to server locale for "Default" user lang in notifs (#3190)
1 parent 0a1f703 commit ef9edc8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

server/i18n/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createIntl, createIntlCache } from '@formatjs/intl';
2+
import { getSettings } from '@server/lib/settings';
23
import type { AvailableLocale } from '@server/types/languages';
34
import { availableLocales } from '@server/types/languages';
45
import fs from 'fs';
@@ -38,7 +39,10 @@ export function initI18n(): void {
3839
}
3940

4041
export function getIntl(locale?: AvailableLocale): IntlInstance {
41-
return intls.get(locale ?? 'en') || intls.get('en')!;
42+
// "Default" stores a falsy locale, so fall back to the server language, then English
43+
const serverLocale = getSettings().main.locale as AvailableLocale;
44+
const resolved = locale || serverLocale || 'en';
45+
return intls.get(resolved) || intls.get('en')!;
4246
}
4347

4448
type MessageDescriptorMap<T extends Record<string, string>> = {

0 commit comments

Comments
 (0)