mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 12:04:02 +00:00
feat(locale): persist household and member preferences
This commit is contained in:
@@ -2,6 +2,7 @@ export { BillingPeriod } from './billing-period'
|
||||
export { DOMAIN_ERROR_CODE, DomainError } from './errors'
|
||||
export { BillingCycleId, HouseholdId, MemberId, PurchaseEntryId } from './ids'
|
||||
export { CURRENCIES, Money } from './money'
|
||||
export { normalizeSupportedLocale, SUPPORTED_LOCALES } from './locale'
|
||||
export {
|
||||
Temporal,
|
||||
instantFromDatabaseValue,
|
||||
@@ -13,6 +14,7 @@ export {
|
||||
nowInstant
|
||||
} from './time'
|
||||
export type { CurrencyCode } from './money'
|
||||
export type { SupportedLocale } from './locale'
|
||||
export type { Instant } from './time'
|
||||
export type {
|
||||
SettlementInput,
|
||||
|
||||
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