Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion server/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createIntl, createIntlCache } from '@formatjs/intl';
import { getSettings } from '@server/lib/settings';
import type { AvailableLocale } from '@server/types/languages';
import { availableLocales } from '@server/types/languages';
import fs from 'fs';
Expand Down Expand Up @@ -38,7 +39,10 @@ export function initI18n(): void {
}

export function getIntl(locale?: AvailableLocale): IntlInstance {
return intls.get(locale ?? 'en') || intls.get('en')!;
// "Default" stores a falsy locale, so fall back to the server language, then English
const serverLocale = getSettings().main.locale as AvailableLocale;
const resolved = locale || serverLocale || 'en';
return intls.get(resolved) || intls.get('en')!;
Comment thread
fallenbagel marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

type MessageDescriptorMap<T extends Record<string, string>> = {
Expand Down
Loading