Skip to content

@i18n-micro/core

42 exports across 2 entry points. Generated from the API snapshot that pnpm run api:surface checks against the TypeScript sources.

@i18n-micro/core

ts
import { /* … */ } from '@i18n-micro/core'
ExportKindSignature
BaseI18nclass34 members
BaseI18nOptionsinterface7 members
collectTranslationPathsfunction(obj: Record<string, unknown>, paths: Set<string>, prefix?: string) => void
createReactiveI18nStorefunction(options: ReactiveI18nStoreOptions) => ReactiveI18nStore
DateTimeFormatsConfigtypeRecord<string, Record<string, Intl.DateTimeFormatOptions>>
defaultPluralconstPluralFunc
FormatServiceclass19 members
FormatServiceOptionsinterface2 members
getByPathfunction(obj: Record<string, unknown> | null | undefined, path: string) => unknown
hasTranslationValuefunction(obj: Record<string, unknown> | null | undefined, key: string) => boolean
interpolatefunction(template: string, params: Params) => string
isNoPrefixStrategyfunction(strategy: Strategies) => strategy is "no_prefix"
isPrefixAndDefaultStrategyfunction(strategy: Strategies) => strategy is "prefix_and_default"
isPrefixExceptDefaultStrategyfunction(strategy: Strategies) => strategy is "prefix_except_default"
isPrefixStrategyfunction(strategy: Strategies) => strategy is "prefix"
mergeTranslationChunkfunction(existing: Record<string, unknown>, incoming: Record<string, unknown>, options?: MergeTranslationChunkOptions) => Record<string, unknown>
MergeTranslationChunkOptionsinterface1 members
mergeTranslationLayersfunction(lower: Record<string, unknown>, upper: Record<string, unknown>) => Record<string, unknown>
NumberFormatsConfigtypeRecord<string, Record<string, Intl.NumberFormatOptions>>
ReactiveI18nStoreinterface9 members
resolveTranslationfunction(obj: Record<string, unknown> | null | undefined, key: string) => unknown | null
setTranslationAtKeyfunction(tree: Record<string, unknown>, key: string, value: unknown) => Record<string, unknown>
translationCacheKeyfunction(locale: string, routeName?: string) => string
TranslationStorageinterface1 members
useTranslationHelperfunction(storage?: TranslationStorage) => { hasCache(locale: string, page: string): boolean; getCache(locale: string, routeName: string): Translations | undefined; setCache(_locale: string, _routeName: string, _cache: Map<string, unknown>): void; hasTranslation(locale: string, key: string): boolean; hasPageTranslation(locale: string, routeName: string): boolean; getTranslation<T = unknown>(locale: string, routeName: string, key: string): T | null; loadTranslations(locale: string, data: Translations, routeName?: string): void; setTranslations(locale: string, data: Translations, routeName?: string): void; loadPageTranslations(locale: string, routeName: string, data: Translations): void; mergeTranslation(locale: string, routeName: string, newTranslations: Translations, _force?: boolean): void; clearCache(): void; }
withPrefixStrategyfunction(strategy: Strategies) => strategy is "prefix" | "prefix_and_default"
BaseI18n — 34 members
MemberType
clearCache() => void
formatterFormatService
getCustomMissingHandler?(() => MissingHandler | null) | undefined
getFallbackLocale() => string
getLocale() => string
getMissingContextprotected (routeContext?: unknown) => { locale: string; routeName: string; }
getRoute() => string
has(key: TranslationKey, routeContext?: unknown) => boolean
helper{ hasCache(locale: string, page: string): boolean; getCache(locale: string, routeName: string): Translations | undefined; setCache(_locale: string, _routeName: string, _cache: Map<string, unknown>): void; hasTranslation(locale: string, key: string): boolean; hasPageTranslation(locale: string, routeName: string): boolean; getTranslation<T = unknown>(locale: string, routeName: string, key: string): T | null; loadTranslations(locale: string, data: Translations, routeName?: string): void; setTranslations(locale: string, data: Translations, routeName?: string): void; loadPageTranslations(locale: string, routeName: string, data: Translations): void; mergeTranslation(locale: string, routeName: string, newTranslations: Translations, _force?: boolean): void; clearCache(): void; }
loadRouteTranslationsCore(locale: string, routeName: string, translations: Translations, merge: boolean) => void
loadTranslationsCore(locale: string, translations: Translations, merge: boolean, routeName?: string) => void
missingHandler?((locale: string, key: string, routeName: string) => void) | undefined
missingWarnboolean
newabstract (options?: BaseI18nOptions): BaseI18n
onTranslationsChangedprotected () => void
pluralFuncPluralFunc
resolveDateTimeFormatArgsprivate (keyOrOptions?: string | Intl.DateTimeFormatOptions, localeOrOverrides?: string | Intl.DateTimeFormatOptions, overrides?: Intl.DateTimeFormatOptions) => { locale: string; options: Intl.DateTimeFormatOptions | undefined; }
resolveHasprotected (key: TranslationKey, routeContext?: unknown) => boolean
resolveLookupprotected (key: TranslationKey, routeContext?: unknown) => unknown | null
resolveNumberFormatArgsprivate (keyOrOptions?: string | Intl.NumberFormatOptions, localeOrOverrides?: string | Intl.NumberFormatOptions, overrides?: Intl.NumberFormatOptions) => { locale: string; options: Intl.NumberFormatOptions | undefined; }
resolveRouteNameprotected (routeContext?: unknown) => string
resolveTranslations(routeContext?: unknown) => Translations
resolveTranslationTreeprotected (lower: Record<string, unknown>, upper: Record<string, unknown>) => Translations
setTranslation(key: TranslationKey, value: unknown) => void
t(key: TranslationKey, params?: Params, defaultValue?: string | null, routeContext?: unknown) => CleanTranslation
tc(key: TranslationKey, count: number | Params, defaultValue?: string) => string
td{ (value: Date | number | string, options?: Intl.DateTimeFormatOptions): string; (value: Date | number | string, key: string, overrides?: Intl.DateTimeFormatOptions): string; (value: Date | number | string, key: string, locale: string, overrides?: Intl.DateTimeFormatOptions): string; }
tdr(value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string
tn{ (value: number, options?: Intl.NumberFormatOptions): string; (value: number, key: string, overrides?: Intl.NumberFormatOptions): string; (value: number, key: string, locale: string, overrides?: Intl.NumberFormatOptions): string; }
touchprotected () => void
ts(key: TranslationKey, params?: Params, defaultValue?: string, routeContext?: unknown) => string
warnDevprotected (message: string) => void
warnMissingprotected (key: TranslationKey, routeContext?: unknown) => void
warnMissingFormatprotected (kind: "number" | "datetime", key: string, locale: string) => void
BaseI18nOptions — 7 members
MemberType
datetimeFormats?DateTimeFormatsConfig | undefined
getCustomMissingHandler?(() => MissingHandler | null) | undefined
missingHandler?((locale: string, key: string, routeName: string) => void) | undefined
missingWarn?boolean | undefined
numberFormats?NumberFormatsConfig | undefined
plural?PluralFunc | undefined
storage?TranslationStorage | undefined
FormatService — 19 members
MemberType
clearCache() => void
dateCacheprivate Map<string, Intl.DateTimeFormat>
datetimeFormatsprivate DateTimeFormatsConfig
formatDate(value: Date | number | string, locale: string, options?: Intl.DateTimeFormatOptions) => string
formatNumber(value: number, locale: string, options?: Intl.NumberFormatOptions) => string
formatRelativeTime(value: Date | number | string, locale: string, options?: Intl.RelativeTimeFormatOptions) => string
getDateTimeFormats() => DateTimeFormatsConfig
getDateTimeFormatter(locale: string, options?: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat
getNumberFormats() => NumberFormatsConfig
getNumberFormatter(locale: string, options?: Intl.NumberFormatOptions) => Intl.NumberFormat
getRelativeTimeFormatter(locale: string, options?: Intl.RelativeTimeFormatOptions) => Intl.RelativeTimeFormat
new(options?: FormatServiceOptions): FormatService
numberCacheprivate Map<string, Intl.NumberFormat>
numberFormatsprivate NumberFormatsConfig
relativeCacheprivate Map<string, Intl.RelativeTimeFormat>
resolveDateTimeFormat(locale: string, key: string) => Intl.DateTimeFormatOptions | undefined
resolveNumberFormat(locale: string, key: string) => Intl.NumberFormatOptions | undefined
setDateTimeFormats(formats: DateTimeFormatsConfig) => void
setNumberFormats(formats: NumberFormatsConfig) => void
FormatServiceOptions — 2 members
MemberType
datetimeFormats?DateTimeFormatsConfig | undefined
numberFormats?NumberFormatsConfig | undefined
MergeTranslationChunkOptions — 1 members
MemberType
preserveExisting?boolean | undefined
ReactiveI18nStore — 9 members
MemberType
getFallbackLocale() => string
getLocale() => string
getRoute() => string
getSnapshot() => string
notify() => void
setFallbackLocale(locale: string) => void
setLocale(locale: string) => void
setRoute(routeName: string) => void
subscribe(listener: () => void) => () => void
TranslationStorage — 1 members
MemberType
translationsMap<string, Translations>
## `@i18n-micro/core/helpers`
ts
import { /* … */ } from '@i18n-micro/core/helpers'
ExportKindSignature
collectTranslationPathsfunction(obj: Record<string, unknown>, paths: Set<string>, prefix?: string) => void
defaultPluralconstPluralFunc
getByPathfunction(obj: Record<string, unknown> | null | undefined, path: string) => unknown
hasTranslationValuefunction(obj: Record<string, unknown> | null | undefined, key: string) => boolean
interpolatefunction(template: string, params: Params) => string
isNoPrefixStrategyfunction(strategy: Strategies) => strategy is "no_prefix"
isPrefixAndDefaultStrategyfunction(strategy: Strategies) => strategy is "prefix_and_default"
isPrefixExceptDefaultStrategyfunction(strategy: Strategies) => strategy is "prefix_except_default"
isPrefixStrategyfunction(strategy: Strategies) => strategy is "prefix"
mergeTranslationChunkfunction(existing: Record<string, unknown>, incoming: Record<string, unknown>, options?: MergeTranslationChunkOptions) => Record<string, unknown>
MergeTranslationChunkOptionsinterface1 members
mergeTranslationLayersfunction(lower: Record<string, unknown>, upper: Record<string, unknown>) => Record<string, unknown>
resolveTranslationfunction(obj: Record<string, unknown> | null | undefined, key: string) => unknown | null
setTranslationAtKeyfunction(tree: Record<string, unknown>, key: string, value: unknown) => Record<string, unknown>
translationCacheKeyfunction(locale: string, routeName?: string) => string
withPrefixStrategyfunction(strategy: Strategies) => strategy is "prefix" | "prefix_and_default"

MergeTranslationChunkOptions — 1 members, identical to MergeTranslationChunkOptions above.

Back to all packages · Integration guides

Released under the MIT License.