mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-20 06:02:14 +03:00
Release v3.8.33 — full CHANGELOG in the PR body. Blocking gates green (Build, Lint, Unit Tests 8/8, Package Artifact, Quality Gates, Quality Ratchet, Docs Sync, PR Test Policy, test-vitest). Admin-merged over a Node 26 future-compat timer flake (1/4) + an E2E UI flake (3/9) — both verified non-deterministic; full test:unit validated locally (16936 pass).
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
// SOURCE OF TRUTH: `config/i18n.json` (also consumed by the docs translation
|
|
// pipeline in `scripts/i18n/run-translation.mjs`). Keep this file as a thin
|
|
// typed adapter — do NOT add hand-maintained locale lists here.
|
|
|
|
import i18nConfig from "../../config/i18n.json" with { type: "json" };
|
|
|
|
type RawLocaleEntry = {
|
|
code: string;
|
|
label: string;
|
|
name: string;
|
|
native?: string;
|
|
english?: string;
|
|
flag: string;
|
|
};
|
|
|
|
type RawI18nConfig = {
|
|
default: string;
|
|
rtl: readonly string[];
|
|
uiOnly?: readonly string[];
|
|
docsExcluded?: readonly string[];
|
|
locales: readonly RawLocaleEntry[];
|
|
};
|
|
|
|
const config = i18nConfig as RawI18nConfig;
|
|
|
|
export const LOCALES = config.locales.map((l) => l.code) as readonly string[];
|
|
export type Locale = (typeof LOCALES)[number];
|
|
export const DEFAULT_LOCALE: Locale = config.default as Locale;
|
|
|
|
/**
|
|
* Display metadata for every locale, kept in the same shape the codebase has
|
|
* historically consumed (`code`, `label`, `name`, `flag`). We additionally
|
|
* expose `native` and `english` as aliases for new call sites that want a
|
|
* stable field name regardless of the underlying display string.
|
|
*/
|
|
export const LANGUAGES: readonly {
|
|
code: Locale;
|
|
label: string;
|
|
name: string;
|
|
native: string;
|
|
english: string;
|
|
flag: string;
|
|
}[] = config.locales.map((entry) => ({
|
|
code: entry.code as Locale,
|
|
label: entry.label,
|
|
name: entry.name,
|
|
native: entry.native ?? entry.name,
|
|
english: entry.english ?? entry.name,
|
|
flag: entry.flag,
|
|
}));
|
|
|
|
export const RTL_LOCALES: readonly Locale[] = config.rtl as readonly Locale[];
|
|
|
|
export const LOCALE_COOKIE = "NEXT_LOCALE";
|