JSON
JSON is a widely used format for the exchange of localisation data. It is used for Angular (Angular CLI, ngx-translate, Transloco), React (react-i18next, react-intl/format.js), Vue.js (Vue I18n), and many other platforms.
If you use React Intl / Format.JS, please check out our dedicated React Intl / Format.JS documentation.
Features
- Any nesting of texts/groups
- Comments are used as context when provided (currently the transloco and react-intl/Format.JS comment format is supported)
- All keys that are not present or have empty/
null
values in the target file are translated - Your formatting (including JSON5-style comments) is preserved
Usage
curl https://api.doloc.io -H "Authorization: Bearer $API_TOKEN" -F source="@source.en.json" -F target="@target.de.json" -o result.de.json
You’d need to provide the source texts as the first file and the target texts as the second file!
Options
Options are passed as query parameters in the URL.
For details check the options documentation.
name | values | default | description |
---|---|---|---|
sourceLang |
any IETF BCP 47 language tag such as en-US , de-DE , etc. |
inferred from filename - e.g. translations.en-us.json infers en-us . |
This specifies the language of the source texts. |
targetLang |
any IETF BCP 47 language tag such as en-US , de-DE , etc. |
inferred from filename - e.g. translations.en-us.json infers en-us . |
This specifies the language of the target texts. |
Limitations
There are many different json formats used for translation. We work on supporting most of them, but currently the following is not supported:
- Multiple languages in the same file.
- Structured formats with objects containing meaning/description and other meta information (other than transloco/react-intl/Format.JS).
Please reach out, if you need support for these or other formats! 🚀