-
Notifications
You must be signed in to change notification settings - Fork 10
Upload translations
Upload command takes your local files and uploads them to SimpleLocalize. It works similarly to the download command
simplelocalize upload
--apiKey PROJECT_API_KEY
--uploadPath INPUT_FILE
--uploadFormat FILE_FORMATThe command uploads file with English translations.
simplelocalize upload
--apiKey PROJECT_API_KEY
--uploadPath ./locales/my-messages.json
--uploadFormat single-language-json
--uploadLanguageKey en
Choose which file(s) should be uploaded using --uploadPath, for example:
# one file
--uploadPath ./locales/messages.json
# translations with namespaces
--uploadPath ./locales/{ns}/messages_en.json
# all translations with namespaces (not recommended)
--uploadPath ./locales/{ns}/messages_{lang}.json
Available placeholders for upload path:
-
{lang}- language key -
{ns}- namespace
You can use the placeholders as a part of a directory name, or a file name.
It's not recommended to push translations for every language on upload, as it's unnecessary extends the upload process. Read a step-by-step localization workflow for tips and recommendations
Change the exported translations format using --uploadFormat parameter, for example:
--uploadFormat java-properties
See list of available file formats
Determine into which language the translations should be assigned using --uploadLanguageKey parameter, for example:
--uploadLanguageKey en
Whenever you upload translations please make sure you set the language key using --uploadLanguageKey, otherwise the system will import only translation keys without the actual content.
You can test the upload command using --dryRun parameter that will list files to upload without uploading them, for example:
simplelocalize upload
--uploadPath ./locales/{ns}/messages_{lang}.json
--uploadFormat single-language-json
--dryRun # <-- add thisBy default, only empty translations are updated with the values from the upload, you can update existing values using --overwrite parameter, for example:
simplelocalize upload
--uploadPath ./locales/messages.json
--uploadFormat multi-language-json
--overwrite # <-- add thisNote:
--overwriteis a shorthand for--uploadOptions REPLACE_TRANSLATION_IF_FOUNDand it will update all existing translations with the values from the upload.
You can preview changes before the upload command using --preview parameter that will list files to upload without importing them, for example:
simplelocalize upload
--uploadPath ./locales/{ns}/messages_{lang}.json
--uploadFormat single-language-json
--preview # <-- add thisYou can assign tags during the upload using --uploadTags (or simply --tags)
simplelocalize upload
--uploadPath ./messages_{lang}.json
--uploadFormat single-language-json
--uploadTags Premium,Development
Use _none to clear tags.
Customize import using options using --uploadOptions, for example:
--uploadOptions UPDATE_ORDER,MARK_AS_ACCEPTED
See list of all available upload options
.
└── locales
└── messages.jsonCommand:
simplelocalize upload
--apiKey <PROJECT_API_KEY>
--uploadPath ./locales/messages.json
--uploadFormat multi-language-json
In this example we upload only source translations from ./en/messages.json and uses --uploadLanguageKey en-GB to specify language key for the uploaded file for the Translation Editor.
It's a recommended way to upload source translations.
.
├── ca
│ └── messages.json
├── en
│ └── messages.json
└── es
└── messages.jsonCommand:
simplelocalize upload
--apiKey <PROJECT_API_KEY>
--uploadPath ./en/index.json
--uploadLanguageKey en-GB
--uploadFormat single-language-json
In this example we use {lang} placeholder to upload many files at once and specify language key for each file.
It's not a recommended way to upload source translations, as it uploads more files than necessary.
.
├── ca
│ └── index.json
├── en
│ └── index.json
└── es
└── index.jsonCommand:
simplelocalize upload
--apiKey <PROJECT_API_KEY>
--uploadPath /{lang}/index.json
--uploadFormat single-language-json
In this example we use {ns} placeholder to upload many files at once for the English language. We used --uploadLanguageKey en-GB to specify language key for the uploaded file for the Translation Editor.
.
├── italian
│ ├── common.json
│ └── home.json
├── english
│ ├── common.json
│ └── home.json
└── spanish
├── common.json
└── home.jsonCommand:
simplelocalize upload
--apiKey <PROJECT_API_KEY>
--uploadPath /english/{ns}.json
--uploadLanguageKey en-GB
--uploadFormat single-language-json
This option is only available with a Business plan.
.
└── locales
└── ikea-translations.jsonsimplelocalize upload \
--apiKey MY_API_KEY \
--uploadPath ./locales/ikea-translations.json \
--uploadCustomerId ikea \
--uploadFormat multi-language-json- Installation
- Upload translations
- Download translations
- Auto-translate
- Configuration file
- Translation Hosting
- Other commands
- Troubleshooting
- GitHub issues - bug reports
- Discord - community
- Email - support
- Changelog - product updates
- YouTube - how-to tutorials