mirror of
https://github.com/whekin/household-bot.git
synced 2026-04-01 02:04:03 +00:00
feat(locale): persist household and member preferences
This commit is contained in:
14
packages/domain/src/locale.ts
Normal file
14
packages/domain/src/locale.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user