File format value
module-exports
CommonJS uses module.exports
syntax to load various data. One of them are localization files. File format looks
very similar to the standard JSON file, but it starts with module.exports =
and it's saved as JavaScript
with .js
extension.
File format example
module.exports = {
"HELLO_WORLD": "Hello world!",
"TRANSLATION_KEY": "This is my translated text!"
}
Upload with CLI
simplelocalize upload --apiKey <PROJECT_KEY> \
--uploadFormat module-exports \
--uploadPath ./messages_{lang}.js
Learn more about SimpleLocalize CLI and translations upload feature.
Download with CLI
simplelocalize download --apiKey <PROJECT_KEY> \
--downloadFormat module-exports \
--downloadPath ./messages_{lang}.js
Learn more about SimpleLocalize CLI and translations download feature.
Import with API
curl
--request POST \
--url 'https://api.simplelocalize.io/api/v2/import?uploadFormat=module-exports&languageKey=en' \
--header 'x-simplelocalize-token: <API_KEY>' \
--form file=@/path/to/your/file.js
Learn more about importing translations with API
Export with API
curl
--request GET \
--url https://api.simplelocalize.io/api/v3/export?downloadFormat=module-exports \
--header 'x-simplelocalize-token: <API_KEY>'
Learn more about exporting translations with API
Was this helpful?