i18n.ts
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.
Parameters
-
rootstring -
extractTranslationKeys(source: string, filePath: string, functionNames?: string[]) => Array -
optionsResolvedI18nOptions
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.
Parameters
-
resolvedOptionsResolvedOptions
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.
Parameters
-
objRecord -
prefixstring -
resultRecord
Returns
void
fngenerateI18nModule(options: ResolvedI18nOptions, root: string): stringGenerates the virtual module for i18n configuration.
Generates the virtual module for i18n configuration.
Parameters
-
optionsResolvedI18nOptions -
rootstring
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.
Parameters
-
optionsResolvedI18nOptions -
dictDirstring
Returns
Record
fnresolveI18nOptions(options: I18nOptions | false | undefined): ResolvedI18nOptions | falseResolves i18n options with defaults.
Resolves i18n options with defaults.
Parameters
-
optionsI18nOptions | 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.
Parameters
-
dirstring -
patternRegExp -
callback(filePath: string) => void
Returns
void