@askrjs/i18n
Exports from the declarations published in @askrjs/i18n. Signatures reflect the published artifact.
Exports
This entrypoint publishes 7 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.
Catalogtype
Catalog: Readonly<Record<string, CatalogMessage>>Read-only map of message keys to typed message functions.
CatalogMessagetype
CatalogMessage: (...args: Args) => stringTyped message function in a locale catalog.
createI18ntype
createI18n: <const SourceLocale extends string, const Catalogs extends Record<SourceLocale, Catalog>>(sourceLocale: SourceLocale, catalogs: Catalogs & ValidCatalogs<Catalogs, SourceLocale>) => I18n<Catalogs>Creates an application-owned internationalization service. Catalog values are ordinary typed TypeScript functions. Locale selection is intentionally left to the application and installed lexically through Scope.
I18ntype
I18n: anyTyped internationalization service backed by aligned locale catalogs.
catalogs- Frozen catalogs supplied at creation time.
Scope- JSX scope component that installs the active locale.
text- Format a message in the active locale.
format- Format a message in an explicitly selected locale.
locale- Read the active locale.
direction- Read the active locale's text direction.
catalog- Read the active catalog identifier.
dehydrate- Serialize the active locale state for hydration.
I18nHydrationtype
I18nHydration: Readonly<{
/** Snapshot schema version. */
version: 1;
/** Active locale. */
locale: Locale;
/** Text direction for the locale. */
dir: TextDirection;
/** Catalog selected for the locale. */
catalog: Locale;
}>Serializable locale state for SSR hydration.
I18nScopePropstype
I18nScopeProps: {
locale: Locale;
dir?: TextDirection;
hydration?: never;
children?: unknown;
} | {
locale?: never;
dir?: never;
hydration: I18nHydration<Locale>;
children?: unknown;
}Props for installing locale state through the Scope component.
children- children?: unknown;
dir- dir?: TextDirection | undefined;
hydration- hydration?: Readonly<{ version: 1; locale: Locale; dir: TextDirection; catalog: Locale; }> | undefined;
locale- locale?: Locale | undefined;
TextDirectiontype
TextDirection: "ltr" | "rtl"Text direction used by a locale.