Automated translation of i18n JSON files. Supports DeepL API and free MyMemory service with duplicate caching.
- Source
Methods
(async, inner) translateFile(sourceLang, targetLang, optionsopt) → {Promise.<TranslateResult>}
Translates a JSON language file using DeepL or MyMemory
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
sourceLang | string | Source language code (e.g., 'en') | |
targetLang | string | Target language code (e.g., 'fr') | |
options | TranslateOptions | <optional> |
- Source
Returns:
- Type:
- Promise.<TranslateResult>
Example
await translateFile('en', 'fr', { i18nDir: './src/i18n', provider: deepLProvider });