/* ============================================================================ ROUTE LOCALE ---------------------------------------------------------------------------- `:lang` is already validated by the locale layout - an unknown segment 404s before a page loader ever runs - so this only narrows `string` to `Locale` for the type system, with the default locale as an unreachable fallback. ========================================================================= */ import { DEFAULT_LOCALE, isLocale, type Locale } from "~/i18n"; export function routeLocale(params: { readonly lang?: string }): Locale { return isLocale(params.lang) ? params.lang : DEFAULT_LOCALE; }