UNPKG

auto-translate-json-library

Version:

Automatically translates JSON language files to other languages using Google Translate,AWS,Azure,DeepL,OpenAI or local OpenAI compatible server

21 lines (20 loc) 903 B
import type { TranslationFile } from "./translate.interface"; export interface IFiles { sourceLocale: string; targetLocales: Array<string>; loadJsonFromLocale(locale: string): Promise<TranslationFile>; saveJsonToLocale(locale: string, file: TranslationFile): void; } export declare const readFileAsync: (filename: string) => Promise<string>; export declare const loadJsonFromLocale: (fileName: string) => Promise<TranslationFile>; export declare const saveJsonToLocale: (filename: string, file: TranslationFile) => void; export declare class Files implements IFiles { folderPath: string; sourceLocale: string; targetLocales: Array<string>; constructor(filePath: string); private getLocaleFromFilename; private getTargetLocales; loadJsonFromLocale(locale: string): Promise<TranslationFile>; saveJsonToLocale(locale: string, file: TranslationFile): void; }