Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -1,8 +1,26 @@
|
||||
import type { InitOptions } from "i18next";
|
||||
|
||||
export const defaultLocale = "de";
|
||||
export const supportedLocales = ["de", "en"];
|
||||
export type SupportedLocale = (typeof supportedLocales)[number];
|
||||
import { catalogReadyLocales, fallbackLng, supportedLocales } from "./locales.js";
|
||||
|
||||
export {
|
||||
EnabledLocalesConfigError,
|
||||
catalogReadyLocales,
|
||||
defaultEnabledLocales,
|
||||
defaultLocale,
|
||||
fallbackLng,
|
||||
formalLngs,
|
||||
isSupportedLocale,
|
||||
localeReleaseStages,
|
||||
normalizeLocaleCandidate,
|
||||
parseEnabledLocales,
|
||||
resolveEnabledLocale,
|
||||
supportedLocales,
|
||||
type EnabledLocalesIssue,
|
||||
type EnabledLocalesIssueCode,
|
||||
type FormalLocale,
|
||||
type ResolveEnabledLocaleInput,
|
||||
type SupportedLocale,
|
||||
} from "./locales.js";
|
||||
|
||||
// Namespace order:
|
||||
// - `translations` is the legacy single-file namespace that still holds the
|
||||
@@ -16,34 +34,37 @@ export const i18nNamespaces = ["translations", "errors", "mail", "common", "sett
|
||||
export type I18nNamespace = (typeof i18nNamespaces)[number];
|
||||
|
||||
export const i18nConfig = {
|
||||
supportedLngs: supportedLocales,
|
||||
fallbackLng: defaultLocale,
|
||||
supportedLngs: catalogReadyLocales,
|
||||
fallbackLng,
|
||||
defaultNS: "translations",
|
||||
ns: [...i18nNamespaces],
|
||||
interpolation: {
|
||||
// React escapes every text node it renders, so i18next must not escape
|
||||
// interpolated values a second time. With i18next's default
|
||||
// (`escapeValue: true`) any value containing HTML-relevant characters is
|
||||
// turned into entities that React then renders literally — a time zone
|
||||
// interpolates as `Europe/Berlin` and a URL as `https://…`.
|
||||
// Values that legitimately reach `dangerouslySetInnerHTML` are sanitized
|
||||
// explicitly at those call sites (see `app/utils/html-sanitizer.ts`).
|
||||
escapeValue: false,
|
||||
},
|
||||
react: {
|
||||
useSuspense: false,
|
||||
},
|
||||
} satisfies InitOptions;
|
||||
|
||||
export function isSupportedLocale(locale: string | undefined): locale is SupportedLocale {
|
||||
return Boolean(locale && supportedLocales.includes(locale));
|
||||
}
|
||||
|
||||
// Formality (Anrede) axis — orthogonal to locale. "du" is the base language
|
||||
// (existing keys), "sie" resolves to the "<locale>-formal" i18next variant
|
||||
// which holds only the formal overrides and falls back to the base locale via
|
||||
// the existing `fallbackLng` ("de"). This keeps the change purely additive:
|
||||
// (existing keys), "sie" resolves to the "<locale>-formal" i18next variant.
|
||||
// Sparse overrides fall back through the matching informal locale before
|
||||
// German. This keeps the change purely additive:
|
||||
// with the default "du" the effective language is the plain locale, so existing
|
||||
// behaviour is byte-identical. Toggling a tenant to "sie" switches the
|
||||
// effective language to "de-formal"/"en-formal"; any key without a formal
|
||||
// override transparently falls back to the informal text.
|
||||
// effective language to "<locale>-formal"; any key without a formal override
|
||||
// transparently falls back to the matching informal text.
|
||||
export const anredeVariants = ["du", "sie"] as const;
|
||||
export type Anrede = (typeof anredeVariants)[number];
|
||||
export const defaultAnrede: Anrede = "du";
|
||||
|
||||
/** Formal language variants for every supported locale ("de-formal", "en-formal"). */
|
||||
export const formalLngs = supportedLocales.map((locale) => `${locale}-formal`);
|
||||
|
||||
export function isAnrede(value: string | undefined): value is Anrede {
|
||||
return Boolean(value && (anredeVariants as readonly string[]).includes(value));
|
||||
}
|
||||
@@ -53,7 +74,7 @@ export function effectiveLng(locale: string, anrede: Anrede = defaultAnrede): st
|
||||
return anrede === "sie" ? `${locale}-formal` : locale;
|
||||
}
|
||||
|
||||
const ltrLocales = new Set<string>(["de", "en"]);
|
||||
const ltrLocales = new Set<string>(supportedLocales);
|
||||
const rtlLocales = new Set<string>(["ar", "he", "fa", "ur"]);
|
||||
|
||||
export type TextDirection = "ltr" | "rtl";
|
||||
@@ -79,10 +100,12 @@ export {
|
||||
formatPercent,
|
||||
formatCompactNumber,
|
||||
formatCurrency,
|
||||
formatCurrencyAmount,
|
||||
formatDate,
|
||||
formatRelativeTime,
|
||||
formatList,
|
||||
type FormatNumberOptions,
|
||||
type CurrencyAmount,
|
||||
type FormatCurrencyOptions,
|
||||
type FormatDateOptions,
|
||||
type FormatRelativeTimeOptions,
|
||||
|
||||
Reference in new issue
Block a user