Files
Rental-operations-platform/contracts/phase9/implementation/localization-config_v1.0.ts
T

21 lines
806 B
TypeScript

export const locales = ['en', 'fr', 'ar'] as const;
export type Locale = (typeof locales)[number];
export const defaultLocale: Locale = 'en';
export const directionByLocale: Record<Locale, 'ltr' | 'rtl'> = { en: 'ltr', fr: 'ltr', ar: 'rtl' };
export const localeCookie = 'hpc-locale';
export const localeStorageKey = 'hpc.locale';
export const campaignQueryAllowlist = [
'utm_source',
'utm_medium',
'utm_campaign',
'utm_content',
'gclid',
] as const;
export const rootDetectionOrder = ['cookie', 'accept-language', 'default-en'] as const;
export function isLocale(value: unknown): value is Locale {
return typeof value === 'string' && (locales as readonly string[]).includes(value);
}
export function isolateLtr(value: string): { dir: 'ltr'; value: string } {
return { dir: 'ltr', value };
}