import { DEFAULT_LOCALE, LOCALE_CONFIG, SUPPORTED_LOCALES, type Locale } from "./locales"; export function getSaleorLocale(locale: Locale): string { return LOCALE_CONFIG[locale].saleorLocale; } export function getLocaleLabel(locale: Locale): string { return LOCALE_CONFIG[locale].label; } export function isDefaultLocale(locale: string): boolean { return locale === DEFAULT_LOCALE; } export function getLocaleFromParams(params: { locale: string }): Locale { const { locale } = params; if (SUPPORTED_LOCALES.includes(locale as Locale)) { return locale as Locale; } return DEFAULT_LOCALE; } export function getProductLocale(locale: Locale): string { return getSaleorLocale(locale); } export function buildHreflangAlternates(baseUrl: string): Record { const alternates: Record = {}; for (const loc of SUPPORTED_LOCALES) { if (loc === DEFAULT_LOCALE) { alternates[loc] = baseUrl; } else { alternates[loc] = `${baseUrl}/${loc}`; } } return alternates; }