i18n
Constants
Language codes, names, and configuration constants.
Import from @workspace/i18n/constants.
ALL_LANGUAGE_CODES
The complete list of language codes supported across the monorepo. Individual apps define subsets of these codes.
import { ALL_LANGUAGE_CODES } from '@workspace/i18n/constants';
ALL_LANGUAGE_CODES;
// ["ca", "de", "en", "es", "fr", "nl", "pl", "pt", "sv", "el"]LanguageCode
Union type derived from ALL_LANGUAGE_CODES. Use this as the base type for language-related parameters.
import type { LanguageCode } from '@workspace/i18n/constants';
// "ca" | "de" | "en" | "es" | "fr" | "nl" | "pl" | "pt" | "sv" | "el"
const lang: LanguageCode = "fr";Lang
Enum-like constant object for type-safe language references. Avoids typos when referencing language codes.
import { Lang } from '@workspace/i18n/constants';
Lang.FR; // "fr"
Lang.EN; // "en"
Lang.DE; // "de"| Key | Value |
|---|---|
Lang.CA | "ca" |
Lang.DE | "de" |
Lang.EN | "en" |
Lang.ES | "es" |
Lang.FR | "fr" |
Lang.NL | "nl" |
Lang.PL | "pl" |
Lang.PT | "pt" |
Lang.SV | "sv" |
Lang.EL | "el" |
LANGUAGE_NAMES
Maps each language code to its native name. Used for display in UI components.
import { LANGUAGE_NAMES } from '@workspace/i18n/constants';
LANGUAGE_NAMES.fr; // "Français"
LANGUAGE_NAMES.en; // "English"
LANGUAGE_NAMES.el; // "Ελληνικά"OG_LOCALES
Maps each language code to its OpenGraph locale format (language_TERRITORY). Used for meta tags and social sharing.
import { OG_LOCALES } from '@workspace/i18n/constants';
OG_LOCALES.fr; // "fr_FR"
OG_LOCALES.en; // "en_US"
OG_LOCALES.pt; // "pt_PT"STORAGE_KEY
The localStorage key used to persist the user's language preference.
import { STORAGE_KEY } from '@workspace/i18n/constants';
STORAGE_KEY; // "preferred-language"