lokex-cli is a focused CLI built specifically for file exchange with Lokalise on top of lokex.
It is intentionally narrow in scope, so you can only upload and download files. This tool is meant to be a fast, optimized workflow for import/export operations.
If you need a broader Lokalise command set, use the official CLI instead.
There are several ways to install lokex-cli, depending on your
environment.
Download the latest release for your OS and architecture from the Releases page.
curl -fsSL https://raw.githubusercontent.com/bodrovis/lokex-cli/master/install.sh | shInstall a specific version:
VERSION=0.2.0 curl -fsSL https://raw.githubusercontent.com/bodrovis/lokex-cli/master/install.sh | shInstall to a custom directory:
INSTALL_DIR="$HOME/.local/bin" curl -fsSL https://raw.githubusercontent.com/bodrovis/lokex-cli/master/install.sh | sh$script = "$env:TEMP\install-lokex.ps1"
Invoke-WebRequest "https://raw.githubusercontent.com/bodrovis/lokex-cli/master/install.ps1" -OutFile $script
powershell -ExecutionPolicy Bypass -File $scriptInstall a specific version:
powershell -ExecutionPolicy Bypass -File $script -Version 0.2.0Install to a custom directory:
powershell -ExecutionPolicy Bypass -File $script -InstallDir "$env:LOCALAPPDATA\Programs\lokex-cli\bin"Install lokex-cli in workflows using the install-lokex-cli action.
Example:
steps:
- uses: bodrovis/install-lokex-cli@v1
- run: lokex-cli versionDetailed command docs are generated in:
Those files list all supported flags and API-related parameters for each command.
These flags are shared by both upload and download.
These two flags are always required:
--token--project-id
Example:
lokex-cli download \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--format jsonlokex-cli download \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--format json
This downloads files from Lokalise and extracts them into ./locales by default.
lokex-cli download \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--format json \
--out ./tmp/locales
lokex-cli download \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--format json \
--async
lokex-cli download \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--format json \
--original-filenames \
--filter-langs en,fr,de \
--include-tags mobile,release
lokex-cli upload \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--filename locales/en.json \
--lang-iso en
lokex-cli upload \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--filename en.json \
--lang-iso en \
--poll
lokex-cli upload \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--filename en.json \
--lang-iso en \
--replace-modified \
--convert-placeholders \
--tags backend,release
The upload command supports batch uploads using a JSON manifest file:
lokex upload --manifest path/to/manifest.json
When --manifest is provided:
- Upload parameters are taken from the manifest file
- CLI upload flags (e.g.
--filename,--lang-iso, etc.) are ignored - Global options
--tokenand--project-idare still used (and can be read from ENV or YAML file)
The manifest is a JSON file with the following structure:
{
"items": [
{
"params": {
"filename": "locales/en.json",
"lang_iso": "en"
}
},
{
"params": {
"filename": "locales/%LANG_ISO%.json",
"lang_iso": "de"
},
"src_path": "./de.json"
}
]
}Fields:
items— list of upload entries
Each item contains:
params(required) — key-value map of upload parameters (same as single upload API)- Must include at least:
filenamelang_iso
- Must include at least:
src_path(optional) — local file path to read file contents from
- If
src_pathis provided:- File contents are read from this path
- If
src_pathis not provided:- The uploader attempts to read file contents from
params.filename
- The uploader attempts to read file contents from
Note on relative raths:
src_pathis resolved relative to the directory of the manifest file- Absolute paths are used as-is
Example:
/configs/batch/manifest.json
/configs/batch/de.json
{
"src_path": "de.json"
}Will resolve to:
/configs/batch/de.json
- All uploads are started in parallel (up to parallel 6 requests)
- If
--pollis enabled:- The command waits for all uploads to complete
- If
--pollis disabled:- The command returns immediately after starting uploads
Each item produces its own result:
- Success:
Upload startedorUpload completed
- Failure:
Upload failedwith error details
At the end, a summary is printed:
Batch summary: total=N success=X failed=Y
- Errors are reported per item
- The command does not fail on partial errors
- Only fatal batch-level errors (e.g. invalid manifest, request failure) cause the command to exit with error
For most uploads, you only need --filename.
Example:
lokex-cli upload \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--filename ./locales/en.json \
--lang-iso enThat is totally fine.
If needed, you can also set --src-path explicitly to tell the CLI where to read the local file from, while keeping a different filename for Lokalise:
lokex-cli upload \
--token YOUR_TOKEN \
--project-id YOUR_PROJECT_ID \
--filename en.json \
--src-path ./locales/en.json \
--lang-iso en
The upload API supports a data field.
You can pass it with:
--data BASE64_ENCODED_CONTENT
But in normal usage you usually do not need this.
If data is not provided, lokex-cli reads the file from disk and prepares the payload for you automatically.
So the normal upload flow is:
- provide
--filename - optionally provide
--src-path - provide
--lang-iso - let the tool read and encode the file itself
Some flags accept arrays (lists of values) or structured JSON. Here is how to pass them in a shell.
Flags like --filter-langs, --include-tags, etc. accept multiple values.
You can pass them in two ways:
lokex-cli download \
--format=json \
--filter-langs=en,fr,de \
--include-tags=mobile,web
lokex-cli download \
--format=json \
--filter-langs=en \
--filter-langs=fr \
--filter-langs=de
Some flags like --language-mapping expect structured JSON (array of objects).
Example:
lokex-cli download \
--format=json \
--language-mapping='[
{"lang_iso":"en","custom_iso":"en_US"},
{"lang_iso":"pt","custom_iso":"pt_BR"}
]'
Important notes:
- Always wrap JSON in quotes ('...') to prevent the shell from interpreting it.
- On Windows (PowerShell), you may need to use double quotes:
--language-mapping "[{\"lang_iso\":\"en\",\"custom_iso\":\"en_US\"}]"
In addition to CLI flags, lokex-cli can also read command defaults from:
- environment variables
- an optional YAML config file
Config file can be provided explicitly:
lokex-cli --config path/to/config.yaml <command>
If --config is not set, lokex-cli will try to automatically find a config file named lokex.yaml in the following locations:
- current working directory (
./lokex.yaml) - user config directory:
~/.config/lokex-cli/lokex.yaml
If no config file is found, execution continues without error.
Command-specific options must be placed under the matching namespace:
download.*forlokex-cli downloadupload.*forlokex-cli upload
Example:
token: token
project-id: project-id
download:
format: json
out: ./tmp/locales
async: true
filter-langs:
- en
- fr
include-tags:
- mobile
- release
upload:
filename: en.json
src-path: ./locales/en.json
lang-iso: en
poll: true
replace-modified: true
tags:
- backend
- releaseEnvironment variables follow the same logical keys as the YAML config, using the LOKEX env prefix.
LOKEX_TOKEN=token
LOKEX_PROJECT_ID=project-id
LOKEX_DOWNLOAD_FORMAT=json
LOKEX_DOWNLOAD_OUT=./locales
LOKEX_UPLOAD_FILENAME=en.json
LOKEX_UPLOAD_LANG_ISO=en
LOKEX_UPLOAD_POLL=true
If you pass a value explicitly as a CLI flag, it overrides the value from YAML or environment variables.
So the effective order is:
- explicit CLI flag
- environment variable / YAML config
- built-in default
Run:
go test -count=1 ./... -shuffle=on -race
Each release includes extra verification artifacts:
*_checksums.txt— SHA256 checksums for release files*_checksums.txt.sigstore.json— Cosign signature bundle for the checksum file*.sbom.json— SBOM files generated for release archives
GitHub Artifact Attestations are available at: github.com/bodrovis/lokex-cli/attestations.
(c) Elijah S. Krukowski. Licensed under BSD 3-Clause