Files
documenso/packages/lib/constants/i18n.ts
ephraimduncan 138d663c25 chore: merge main, resolve biome formatting conflicts
Merge origin/main into feat/external-2fa-codes. Resolve formatting
conflicts caused by biome rollout; preserve both feature streams:
PR's external 2FA token + signing-session 2FA proof additions plus
main's RateLimit/RecipientExpired/signingReminders/date-auto-insert.

In complete-document-with-token.ts, drop the duplicate early
field-fetching block introduced when main moved that logic later
with date auto-insert support; keep the EXTERNAL_TWO_FACTOR_AUTH
check using derivedRecipientActionAuth.
2026-05-12 11:46:11 +00:00

74 lines
1.3 KiB
TypeScript

import type { MessageDescriptor } from '@lingui/core';
import { msg } from '@lingui/core/macro';
import { SUPPORTED_LANGUAGE_CODES, type SupportedLanguageCodes } from './locales';
export * from './locales';
export type I18nLocaleData = {
/**
* The supported language extracted from the locale.
*/
lang: SupportedLanguageCodes;
/**
* The preferred locales.
*/
locales: string[];
};
type SupportedLanguage = {
short: string;
full: MessageDescriptor;
};
export const SUPPORTED_LANGUAGES: Record<string, SupportedLanguage> = {
de: {
short: 'de',
full: msg`German`,
},
en: {
short: 'en',
full: msg`English`,
},
fr: {
short: 'fr',
full: msg`French`,
},
es: {
short: 'es',
full: msg`Spanish`,
},
it: {
short: 'it',
full: msg`Italian`,
},
nl: {
short: 'nl',
full: msg`Dutch`,
},
pl: {
short: 'pl',
full: msg`Polish`,
},
'pt-BR': {
short: 'pt-BR',
full: msg`Portuguese (Brazil)`,
},
ja: {
short: 'ja',
full: msg`Japanese`,
},
ko: {
short: 'ko',
full: msg`Korean`,
},
zh: {
short: 'zh',
full: msg`Chinese`,
},
} satisfies Record<SupportedLanguageCodes, SupportedLanguage>;
export const isValidLanguageCode = (code: unknown): code is SupportedLanguageCodes =>
SUPPORTED_LANGUAGE_CODES.includes(code as SupportedLanguageCodes);