Skip to content

@i18n-micro/node

15 exports across 1 entry point. Generated from the API snapshot that pnpm run api:surface checks against the TypeScript sources.

@i18n-micro/node

ts
import { /* … */ } from '@i18n-micro/node'
ExportKindSignature
CleanTranslationtypestring | number | boolean | Translations | PluralTranslations | null
createI18nfunction(options: I18nOptions) => I18n
FormatServiceclass19 members
Gettertype(key: TranslationKey, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown
I18nclass46 members
I18nOptionsinterface7 members
interpolatefunction(template: string, params: Params) => string
LoadedTranslationsinterface2 members
loadRootTranslationsfunction(dir: string, disablePageLocales?: boolean) => Promise<Record<string, Translations>>
loadTranslationsfunction(dir: string, disablePageLocales?: boolean) => Promise<LoadedTranslations>
Localeinterface11 members
LocaleCodetypestring
ParamstypeRecord<string, string | number | boolean>
PluralFunctype(key: TranslationKey, count: number, params: Params, locale: string, getter: Getter) => string | null
Translationsinterface1 members

FormatService — 19 members, identical to FormatService.

I18n — 46 members
MemberType
addRouteTranslations(locale: string, routeName: string, translations: Translations, merge?: boolean) => void
addTranslations(locale: string, translations: Translations, merge?: boolean) => void
clear() => void
clearCache() => void
currentRoutestring
disablePageLocalesprivate boolean
fallbackLocalestring
formatterFormatService
getCustomMissingHandler?(() => MissingHandler | null) | undefined
getFallbackLocale() => string
getLocale() => string
getMissingContextprotected (routeContext?: unknown) => { locale: string; routeName: string; }
getRoute() => string
has(key: TranslationKey, routeContext?: unknown) => boolean
hasTranslation(key: TranslationKey) => 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
loadTranslations(dir?: string) => Promise<void>
loadTranslationsCore(locale: string, translations: Translations, merge: boolean, routeName?: string) => void
localestring
missingHandler?((locale: string, key: string, routeName: string) => void) | undefined
missingWarnboolean
new(options: I18nOptions): I18n
onTranslationsChangedprotected () => void
pluralFuncPluralFunc
reload() => Promise<void>
resolveDateTimeFormatArgsprivate any
resolveHasprotected (key: TranslationKey, routeContext?: unknown) => boolean
resolveLookupprotected (key: TranslationKey, routeContext?: unknown) => unknown | null
resolveNumberFormatArgsprivate any
resolveRouteNameprotected (routeContext?: unknown) => string
resolveTranslations(routeContext?: unknown) => Translations
resolveTranslationTreeprotected (lower: Record<string, unknown>, upper: Record<string, unknown>) => Translations
setRoute(routeName: string) => void
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
translationDir?string | undefined
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
I18nOptions — 7 members
MemberType
disablePageLocales?boolean | undefined
fallbackLocale?string | undefined
localestring
missingHandler?((locale: string, key: string, routeName: string) => void) | undefined
missingWarn?boolean | undefined
plural?PluralFunc | undefined
translationDir?string | undefined
LoadedTranslations — 2 members, identical to [`LoadedTranslations`](/api/packages/astro). Locale — 11 members, identical to [`Locale`](/api/packages/types). Translations — 1 members, identical to [`Translations`](/api/packages/types).

Back to all packages · Integration guides

Released under the MIT License.