Automated translation of i18n JSON files. Supports DeepL API and free MyMemory service with duplicate caching.

Methods

(async, inner) translateFile(sourceLang, targetLang, optionsopt) → {Promise.<TranslateResult>}

Translates a JSON language file using DeepL or MyMemory

Parameters:
NameTypeAttributesDescription
sourceLangstring

Source language code (e.g., 'en')

targetLangstring

Target language code (e.g., 'fr')

optionsTranslateOptions<optional>
Returns:
Type: 
Promise.<TranslateResult>
Example
await translateFile('en', 'fr', { i18nDir: './src/i18n', provider: deepLProvider });