22 lines
833 B
TypeScript
22 lines
833 B
TypeScript
/**
|
|
* The app is translated into a few languages, one Lingui catalogue each under
|
|
* `locales/`. This module lists them once for every reader: `lingui.config.ts`
|
|
* extracts and compiles a catalogue per locale, the client picks one per
|
|
* browser, and the server writes its emails in `GERBEUR_EMAIL_LOCALE`.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
/** Lists the locales the app is translated into. */
|
|
export const LOCALES = ["en", "fr"] as const;
|
|
/** One of the {@link LOCALES}. */
|
|
export type Locale = typeof LOCALES[number];
|
|
/** The locale the messages are written in, and the fallback for any other. */
|
|
export const SOURCE_LOCALE: Locale = "en";
|
|
|
|
/** Checks whether `value` is a {@link Locale}. */
|
|
export function isLocale(value: unknown): value is Locale {
|
|
return typeof value === "string" &&
|
|
(LOCALES as readonly string[]).includes(value);
|
|
}
|