mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 22:34:03 +00:00
15 lines
425 B
TypeScript
15 lines
425 B
TypeScript
export const SUPPORTED_LOCALES = ['en', 'ru'] as const
|
|
|
|
export type SupportedLocale = (typeof SUPPORTED_LOCALES)[number]
|
|
|
|
export function normalizeSupportedLocale(value?: string | null): SupportedLocale | null {
|
|
const normalized = value?.trim().toLowerCase()
|
|
if (!normalized) {
|
|
return null
|
|
}
|
|
|
|
return (SUPPORTED_LOCALES as readonly string[]).includes(normalized)
|
|
? (normalized as SupportedLocale)
|
|
: null
|
|
}
|