export const DEFAULT_APP_LOCALE = 'en' as const;

export const SUPPORTED_APP_LOCALES = [DEFAULT_APP_LOCALE] as const;

export type AppLocale = (typeof SUPPORTED_APP_LOCALES)[number];

export function resolveAppLocale(candidate: string | null | undefined): AppLocale {
  if (candidate && SUPPORTED_APP_LOCALES.includes(candidate as AppLocale)) {
    return candidate as AppLocale;
  }

  return DEFAULT_APP_LOCALE;
}
