Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -29,6 +29,30 @@ export function isSupportedLocale(locale: string | undefined): locale is Support
|
||||
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:
|
||||
// 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.
|
||||
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));
|
||||
}
|
||||
|
||||
/** Maps (locale, anrede) → effective i18next language. "sie" → "<locale>-formal", "du" → locale. */
|
||||
export function effectiveLng(locale: string, anrede: Anrede = defaultAnrede): string {
|
||||
return anrede === "sie" ? `${locale}-formal` : locale;
|
||||
}
|
||||
|
||||
const ltrLocales = new Set<string>(["de", "en"]);
|
||||
const rtlLocales = new Set<string>(["ar", "he", "fa", "ur"]);
|
||||
|
||||
@@ -48,7 +72,7 @@ export function isRTL(locale: string | undefined): boolean {
|
||||
// Foundation extensions (#72 i18n-foundation). Exports are namespaced via
|
||||
// `./intl` and `./icu` subpaths in `package.json#exports`, but we also
|
||||
// re-export the helpers here so callers can `import { formatCurrency } from
|
||||
// "@toolctrl/i18n"` without juggling subpaths.
|
||||
// "@hivegrid/i18n"` without juggling subpaths.
|
||||
|
||||
export {
|
||||
formatNumber,
|
||||
|
||||
Reference in new issue
Block a user