i18n.ts

Source

7 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.

Reference

fncollectKeysFromSource(root: string, extractTranslationKeys: ( source: string, filePath: string, functionNames?: string[], ) => Array<{ key: string }>, options: ResolvedI18nOptions): string[]Collects translation keys from source files using NAPI extractTranslationKeys.

Collects translation keys from source files using NAPI extractTranslationKeys.

View source

Parameters

  • root string
  • extractTranslationKeys (source: string, filePath: string, functionNames?: string[]) => Array
  • options ResolvedI18nOptions

Returns

string[]
fncreateI18nPlugin(resolvedOptions: ResolvedOptions): PluginCreates the i18n sub-plugin for the Vite plugin array.

Creates the i18n sub-plugin for the Vite plugin array.

View source

Parameters

  • resolvedOptions ResolvedOptions

Returns

Plugin
fnflattenObject(obj: Record<string, unknown>, prefix: string, result: Record<string, string>): voidFlattens a nested object into dot-separated keys.

Flattens a nested object into dot-separated keys.

View source

Parameters

  • obj Record
  • prefix string
  • result Record

Returns

void
fngenerateI18nModule(options: ResolvedI18nOptions, root: string): stringGenerates the virtual module for i18n configuration.

Generates the virtual module for i18n configuration.

View source

Parameters

  • options ResolvedI18nOptions
  • root string

Returns

string
fnloadDictionariesFallback(options: ResolvedI18nOptions, dictDir: string): Record<string, Record<string, string>>Fallback dictionary loading using TS-based JSON file reading.

Fallback dictionary loading using TS-based JSON file reading.

View source

Parameters

  • options ResolvedI18nOptions
  • dictDir string

Returns

Record
fnresolveI18nOptions(options: I18nOptions | false | undefined): ResolvedI18nOptions | falseResolves i18n options with defaults.

Resolves i18n options with defaults.

View source

Parameters

  • options I18nOptions | false | undefined

Returns

ResolvedI18nOptions | false
fnwalkDir(dir: string, pattern: RegExp, callback: (filePath: string) => void): voidRecursively walks a directory, calling the callback for files matching the patt…

Recursively walks a directory, calling the callback for files matching the pattern.

View source

Parameters

  • dir string
  • pattern RegExp
  • callback (filePath: string) => void

Returns

void