useTranslator @astryx-svelte/core v0.3.0 · i18n

Usage

Returns a translator function that resolves keys against the current locale, provider overrides, and the shipped English fallback catalog. Call inside a component; the returned function can be used anywhere within that component's scope.
ts
import { i18n } from '@astryx-svelte/core';

Returns

FieldTypeDefaultDescription
value (key: string, values?: Record<string, string | number | Date>) => stringA stable translator function bound to the current InternationalizationProvider context. Call it with a message key and optional ICU MessageFormat values to get the formatted string in the active locale. Safe to use in render, event handlers, effects, or any code that runs during the parent component's lifecycle.

useTranslator() returns the translator itself — TranslatorFn, i.e. (key: string, values?: Record<string, unknown>) => string. Upstream returns it the same way; the name labels the single return value rather than a member.