/** * The UI locales that actually ship — regional BCP 47 tags, per docs/localization.md D2. This is the * one list `I18nBridge` merges catalogs for and `Languages.tsx` offers for UI localization; it is * deliberately separate from the broader "languages you speak" / "translate to" lists, which are a * different feature (see the doc's open question 4) and are not limited to locales with a catalog. */ export type ShippedLocale = { code: string; label: string }; /** * The label is an AUTONYM — each language named in its own language, so "Português" reads as Portuguese * whichever locale the UI is currently in. That is the convention for a language picker and it is the * useful behaviour: somebody who cannot read the current language still has to find theirs. * * Computed rather than written down, for the same reason the spoken-language list is (see Languages.tsx): * `Intl` already knows every language's name in every locale, including its own. */ const autonym = (code: string): string => { const name = new Intl.DisplayNames([code], { type: 'language', fallback: 'code' }).of(code) ?? code; return name.charAt(0).toUpperCase() + name.slice(1); }; export const SHIPPED_LOCALES: ShippedLocale[] = ['en-GB', 'pt-PT'].map((code) => ({ code, label: autonym(code), })); export const FALLBACK_LOCALE = 'en-GB';