Install
The CLI is a pre-release, 0.1.0-alpha.0, and is not on npm yet. Commands and flags may still change. Until it is published, it is built from Localeasy's own repository and run from the packed file:
pnpm --filter @localeasy/cli build
npm pack ./packages/cli/dist
npx --package ./localeasy-0.1.0-alpha.0.tgz -- localeasy --versionThe CLI needs Node.js 22.12 or newer. Once it is published, the package is localeasy, and npx localeasy runs it without an install. The examples on these pages write localeasy for whichever way you run it.
Sign in
The CLI looks for a credential in this order:
--token.LOCALEASY_TOKEN. In CI, set it to an API key from Settings › API keys.- In a GitHub Actions job with
id-token: write, the job's OIDC token, for a repository with CI access. See CI. - The sign-in
localeasy loginkept for this server.
login keeps its sign-in in the operating system's keychain, one per server, and never in a file. It lasts 7 days and is extended while you use it. logout ends it on the server and removes it from the keychain.
An API key starts with lk_. The CLI exchanges it for an access token that lasts 15 minutes, once per run, and again if the token expires during the run. A key needs the write scope to push, merge or rename, and read to pull or read status. Its role, project and branch pattern limit it further.
Commands
| Command | What it does |
|---|---|
init | What it does: Writes localeasy.json for the translation files in this directory. |
login | What it does: Signs you in through the browser and keeps the sign-in in the OS keychain. |
logout | What it does: Ends the sign-in localeasy login kept for this server. |
push | What it does: Sends changed source files to the server. Translation files go too with a flag. |
pull | What it does: Writes the server's translations into the translation files. |
status | What it does: Shows how much of each language is translated, approved and fresh. |
check | What it does: Checks the local files without the network. |
extract | What it does: Adds the keys the code uses to the source files, with the code's default text or an empty one. Needs extract in localeasy.json and the extractor installed in the project. |
types | What it does: Writes TypeScript declarations of the source files' keys and each message's arguments to the file types names in localeasy.json. A file that would not change is not written. |
doctor | What it does: Checks the config, the lockfile, the token, the network and the Node.js version. |
branch list | What it does: Lists the project's open and merging branches. |
branch create | What it does: Opens a branch. A push to a branch the server has not seen opens it too. |
branch show | What it does: Shows a branch's status, the branch it was opened from, its head and where it was opened. |
branch close | What it does: Closes a branch without merging it. A branch others are open from can't be closed until they are merged or closed. |
merge | What it does: Merges a branch into main, or into the branch it was opened from. A conflict writes nothing and exits 4. |
mv | What it does: Renames a key on the server. It keeps its translations, statuses and history. |
import lokalise | What it does: Imports a Lokalise project: its keys with their descriptions, length limits and tags, and every language's translations. Reviewed is Approved, unverified is Needs review. It goes to the project of localeasy.json on the main line, as one push: the source language first, then the others. A run again writes only what changed. The token is sent to Lokalise only, never to Localeasy. |
import crowdin | What it does: Imports a Crowdin project: each file is a namespace named after it, in the format its extension says (JSON for a Markdown file), with its strings, their context as the description, length limits and labels as tags, and every language's translations. An approved translation is Approved. It goes to the project of localeasy.json on the main line, as one push: the source language first, then the others. A run again writes only what changed. The token is sent to Crowdin only, never to Localeasy. |
import phrase | What it does: Imports a Phrase Strings project: its keys with their descriptions, length limits and tags, and every locale's translations. The default locale is the source. Reviewed is Approved, unverified is Needs review. It goes to the project of localeasy.json on the main line, as one push: the source language first, then the others. A run again writes only what changed. The token is sent to Phrase only, never to Localeasy. |
audit verify | What it does: Checks an NDJSON export of the audit log on this machine: it recomputes each row's hash and checks the chain against the organisation's checkpoints and their signatures, which anyone can read. A row that was changed, or a checkpoint that doesn't match or whose signature doesn't verify, exits 65 and names the rows. Seqs missing from the export are a warning. A row is vouched for only by a checkpoint at or after it with no seq missing between: rows just before a gap, which could be changed with the rows after them left out, and a checkpoint whose row the export lacks are warnings too. The summary counts the rows a checkpoint vouches for. It keeps the checkpoints it has seen and warns when the server later lists one differently. |
The examples below are output from a test server, where every run has the same id and takes no time.
localeasy init
Writes localeasy.json for the translation files in this directory.
| Flag | What it does |
|---|---|
--source <pattern> | What it does: The source files, such as locales/en/{namespace}.json. Without it, the translation pattern with the source language filled in. |
--translation <pattern> | What it does: The translation files, such as locales/{locale}/{namespace}.json. Without it, init takes the layout with the most languages among the files here, and lists any others it found. |
--source-locale <tag> | What it does: The language of the source files. Without it, en when the files found have it, else the first language found. |
--locales <tags> | What it does: The translation languages, comma-separated. Without it, the languages found. |
--server <url> | What it does: A server to write into the config. Left out, the config names none and the CLI uses https://localeasy.app. |
--create <slug> | What it does: Create the project on the server under this slug and write its id. |
--jurisdiction <where> | What it does: Where a created project's data is stored: global, eu or us. It must be the organisation's, which is also the default. |
--yes | What it does: Ask nothing; use the flags and what was found. |
--force | What it does: Replace an existing localeasy.json. |
In a terminal, init asks where the translation files are and which language the source files are in, with what it found filled in. With --yes, or outside a terminal, it asks nothing.
When the files here follow several layouts, as in a monorepo, init configures the one with the most languages and lists the others, each with the group to add to files. See One project for the whole repository.
--project storefront writes the id of the project named storefront, which the app's first-run page shows. --create storefront makes that project first. Both need the server. If you are not signed in, init signs you in through the browser first, as login does.
--server names the server and writes it into the config, so every later command goes there. Without it the config names none and the CLI uses https://localeasy.app.
$ localeasy init --yes --server http://api.test --project storefront
✓ Done Wrote localeasy.json locales/en/{namespace}.json → locales/{locale}/{namespace}.json
→ Add .localeasy/ to .gitignore: it holds the pulled copies three-way pushes compare with
· Run 4bf92f3577b34da6a3ce929d0e0e4736localeasy login
Signs you in through the browser and keeps the sign-in in the OS keychain.
It prints an address and a code. Open the address, check that the page shows the same code, pick the organisation and confirm. The CLI then works in that organisation. See Sign in.
localeasy logout
Ends the sign-in localeasy login kept for this server.
localeasy push
Sends changed source files to the server. Translation files go too with a flag.
| Flag | What it does |
|---|---|
--dry-run | What it does: Show what would change. Nothing is written. |
--translations | What it does: Also push translation files, each compared three-way against the copy the last pull left. |
--strategy <strategy> | What it does: overwrite sends translation files that have no pulled copy to compare with, as they are. It needs --force. |
--remove-missing | What it does: On the main line, also remove the server's keys the source files no longer have, and rename a key whose text moved to a new name. On a branch it only lists them. Without it a push removes nothing. |
--force | What it does: Confirms --strategy overwrite. In a push without --strategy overwrite, it lets --remove-missing remove more than 20% of a namespace's keys. |
--allow-downgrade | What it does: Let the files replace approved translations, which then lose Approved. |
--no-translate | What it does: Skip the project's automatic translation for this push. New source texts stay untranslated until someone translates them. |
--from <branch> | What it does: When the push opens its branch, open it from this open branch instead of main. A branch already open keeps the one it has. |
A file whose content matches localeasy.lock is not sent.
$ localeasy push
· on the main line 1 workspace · 3 keys in 1 file
✓ . added 3, changed 0 0.0 s · head 1
✓ Done Pushed 3 texts 0.0 s
· Lockfile updated
· Run 4bf92f3577b34da6a3ce929d0e0e4736- A push adds and changes keys. It removes none unless you pass
--remove-missing. See Removing keys below. - When a new key has the same source text as an existing one, the server copies that key's translations to it, marked needs review. The push says how many.
- Translation files are pushed only with
--translations. The conflicts page says how they are compared, and what--allow-downgradeis for. - A file or message that cannot be read stops the push before anything is sent, with exit 65.
- A changed file is compared with the server's last export, made 30 seconds after the last change and 5 minutes at most (see Limits). A source file pushed, changed back and pushed again before that export reads as unchanged: the server keeps the first push's texts, and
localeasy.lockthen vouches for the file. To send it, remove its entry fromlocaleasy.lockand push again.
Removing keys
With --remove-missing, a push also removes the keys the server has and a source file no longer does. A key whose text moved to a new name is renamed instead, and keeps its translations, statuses and history.
$ localeasy push --remove-missing
· on the main line 1 workspace · 5 keys in 1 file
✓ . added 0, changed 0, renamed 1, removed 1 0.0 s · head 2
farewell → goodbye renamed, same text
old_banner removed, not in locales/en/app.json
✓ Done Pushed 0 texts, renamed 1 key, removed 1 key 0.0 s
· Lockfile updated
· Run 4bf92f3577b34da6a3ce929d0e0e4736- Only the namespaces whose source file the run read are compared. A source file that is deleted, or a workspace
--projectleaves out, loses no key. To remove a whole namespace's keys, use the app. - Removing more than 20% of a namespace's keys in one push is refused with exit 65, before anything is written, unless you add
--force. With--strategy overwrite,--forceconfirms the overwrite only, and the limit holds. An emptied source file stops there. A file that does not parse stops the push before that, as it does for any push. --remove-missing --dry-runcompares every source file and lists what would be renamed and removed. A--dry-runwithout the flag counts those keys on the main line only, and only in the source files changed sincelocaleasy.locklast recorded them.- A changed Markdown source file is compared on the main line without the flag too. A block deleted from it stays on the server, and in every language's document, until a push with the flag removes it. The push that finds it warns.
- Keys are removed on the main line only. A branch opens on the server at its first push, not where git branched, so a key the branch deleted cannot be told from one main got later. On a branch the flag removes nothing: the push lists main's keys that the source files lack and goes on. The first push to main with the flag after the merge removes them.
- A key renamed in a source file on a branch is a new key there, without the old key's translations. To carry them, rename the key on the branch with mv before you push the file.
- The flag compares with the files it is given. A push to main from an older commit, such as a re-run of an old CI job, removes the keys main got after that commit; only the 20% limit stops it. With git's HEAD detached and no branch named, the flag removes nothing: add
--branch mainif the commit is main's newest. - A removed key comes back with its translations if a later push has it again. To rename one key by hand, use mv.
- With the flag, every source file is compared with the server on each push, including a file that
localeasy.locksays is unchanged. A file that differs is compared key by key with the server's file as it is at that moment. - A namespace of more than 5,000 keys is exported later, in the background. Until its file is current, the push says it could not compare the source file, and removes nothing from that namespace. Run the push again a few minutes later.
- When two source files hold the same namespace of one project, nothing is removed from it, and the push says so. Every workspace of the root counts, also when the push runs inside one package or with
--project.
localeasy pull
Writes the server's translations into the translation files.
| Flag | What it does |
|---|---|
--state <state> | What it does: all (the default) writes every translation. approved writes only approved translations whose source text has not changed since. |
--frozen | What it does: Write nothing, and exit 3 if a file would change. A gate for files you commit. |
--min-seq <n> | What it does: Only accept exports at least this fresh. A file that changed since its last export is exported at once instead of after the usual wait. |
--force | What it does: Overwrite files that have local changes you never pushed. |
--watch | What it does: Keep running and pull again whenever the server has new translations, until Ctrl-C. A check that finds nothing new prints nothing. When the server cannot be reached, it warns and tries again at the next check; if the first check fails, it stops as pull does. A translator's save reaches the files after the usual export wait, about 30 s. Not with --frozen, --min-seq or --json. |
--interval <seconds> | What it does: With --watch, the seconds between checks: 10 by default, from 2 to 86400. |
pull writes one file per namespace and language, for the languages in locales, or every language the project has. It does not write source files.
- A translation file you changed and never pushed is kept, with a warning. Push it with
push --translations, or overwrite it with--force. - So is a translation file that was in the repository before Localeasy and differs from the server's. Import it with
push --translations --strategy overwrite --force, or overwrite it with--force. - The CLI tells such a file by its missing entry in
localeasy.lock, so without the lockfile a translation file that differs from the server's and from its pulled copy in.localeasy/base/, or has none, is kept: the warning saysnot in localeasy.lock, and the summary counts the files kept. If the lockfile was deleted or not committed,pull --forcetakes the server's translations. - The server exports a file some seconds after its last change (see Limits), so a pull right after a change can come back without it.
--min-seqtakes a position in the project's history.pushprints the one it left the project at, asheadon the workspace's line, andpush --jsonhas it ashead_seq. With several projects each has a head of its own, inworkspaces. - On a branch, a file the branch changed is main's file with the branch's changes applied.
- A language with fallbacks (
fallbacksin the project's settings) is written with its fallbacks' texts where it has none of its own: the first that has one, and with--state approvedthe first approved one whose source text hasn't changed, or the source. Gettext and XLIFF files aren't filled.push --translationssends only what changed since the pull, so the filled texts aren't sent; with--strategy overwritethey would be, as that language's translations. A filled text you edit goes up as that language's own. - JSON files are written with two spaces of indentation and a final newline, whatever the file had before. A file that differs from the server's only in indentation or line ends is not rewritten: it counts as unchanged, also for
--frozen. - If a formatter re-indents a pulled file, the next pull that brings new translations writes it with two spaces again. That needs the pulled copy in
.localeasy/to compare with. In a checkout without it, such as a CI job's, the re-indented file is kept as a local change until a pull with--force.
$ localeasy pull --frozen
· . 1 language · 1 file
✗ Error 1 file would change
locales/sv/app.json the server has newer translations
→ Run localeasy pull and commit the result
· Exit 3 · Run 4bf92f3577b34da6a3ce929d0e0e4736 · http://api.test/docs/cli/exit-3localeasy status
Shows how much of each language is translated, approved and fresh.
| Flag | What it does |
|---|---|
--fail-under <percent> | What it does: Exit 3 when a language's fresh share is below this percentage, 0 to 100. |
--state <state> | What it does: What counts as fresh for the gate: all (the default) is any translation whose source text has not changed since; approved is only approved ones. |
Translated and approved are shares of the project's keys, rounded down. Fresh leaves out translations whose source text changed after they were written.
$ localeasy status --fail-under 90
· . 3 keys · fresh = translated, source unchanged since
Language Translated Approved Fresh
✗ Swedish (sv) 66% 0% 66% under 90
✗ Error 1 of 1 language is under 90% fresh
→ Translate and approve in the app, or lower --fail-under
· Exit 3 · Run 4bf92f3577b34da6a3ce929d0e0e4736 · http://api.test/docs/cli/exit-3localeasy check
Checks the local files without the network.
| Flag | What it does |
|---|---|
--reporter <reporter> | What it does: text (the default), or github to also print one workflow annotation per finding. |
check needs no token. It reads the source and translation files and reports:
| Rule | Severity | What it found |
|---|---|---|
parse-error | Severity: Error | What it found: The file cannot be parsed, or holds the same key twice. |
invalid-message | Severity: Error | What it found: A message is not valid in its dialect. |
placeholder-mismatch | Severity: Error | What it found: A translation's placeholders differ from its source text's. |
unknown-key | Severity: Warning | What it found: A translation file has a key the source files do not. |
Errors exit 3. Warnings alone exit 0.
$ localeasy check --reporter github
· 3 keys 1 language
✗ 1 error
locales/sv/app.json greeting
Placeholders differ from the source text (placeholder-mismatch)
! 1 warning
locales/sv/app.json old
The source files have no such key (unknown-key)
::error file=locales/sv/app.json,title=greeting (placeholder-mismatch)::Placeholders differ from the source text
::warning file=locales/sv/app.json,title=old (unknown-key)::The source files have no such key
✗ Error 1 error and 1 warning in 1 file
→ Fix the texts listed above, then run localeasy check again
· Exit 3 · Run 4bf92f3577b34da6a3ce929d0e0e4736 · http://api.test/docs/cli/exit-3localeasy extract
Adds the keys the code uses to the source files, with the code's default text or an empty one. Needs extract in localeasy.json and the extractor installed in the project.
| Flag | What it does |
|---|---|
--check | What it does: Write nothing. Exit 3 when the code uses a key the source files lack, naming the key and where the code uses it. |
localeasy types
Writes TypeScript declarations of the source files' keys and each message's arguments to the file types names in localeasy.json. A file that would not change is not written.
| Flag | What it does |
|---|---|
--check | What it does: Write nothing. Exit 3 when the declarations would change. |
localeasy doctor
Checks the config, the lockfile, the token, the network and the Node.js version.
Five checks. The first one that fails sets the exit code. A missing lockfile is a warning: the first push or pull creates it.
$ localeasy doctor
✓ Config localeasy.json · version 2 · 1 workspace · 1 source file
✓ Lockfile localeasy.lock · 2 files
✓ Token LOCALEASY_TOKEN
✓ Network api.test · 0 ms
✓ Runtime localeasy 0.1.0-alpha.0 · Node 26.10.0
✓ Done 5 checks passed 0.0 s
· Run 4bf92f3577b34da6a3ce929d0e0e4736localeasy branch list
Lists the project's open and merging branches.
localeasy branch create <name>
Opens a branch. A push to a branch the server has not seen opens it too.
| Flag | What it does |
|---|---|
--from <branch> | What it does: Open it from this open branch instead of main. It shows that branch's texts where it has none of its own, and merges into it. A branch opened from another can't have branches opened from it. |
localeasy branch show <name>
Shows a branch's status, the branch it was opened from, its head and where it was opened.
$ localeasy branch show feature/checkout
· storefront · feature/checkout
Status open
Head 5
Opened at head 3 by api_key:key-1
✓ Done feature/checkout is open
· Run 4bf92f3577b34da6a3ce929d0e0e4736localeasy branch close <name>
Closes a branch without merging it. A branch others are open from can't be closed until they are merged or closed.
localeasy merge [branch]
Merges a branch into main, or into the branch it was opened from. A conflict writes nothing and exits 4.
| Flag | What it does |
|---|---|
--dry-run | What it does: Show what would merge. Nothing is written. |
--strategy <side> | What it does: Settle every conflict one way: main keeps main's side, branch takes the branch's, newest takes the side changed last. fail, the default, leaves them. |
--strategy-locale <locale=side> | What it does: Settle one language's conflicts, such as sv=branch. Repeatable. |
--strategy-key <key=side> | What it does: Settle one key's conflicts, such as app:checkout.pay=main. Repeatable. |
--strategy-text <key@locale=side> | What it does: Settle one key's conflict in one language, such as app:checkout.pay@sv=branch. Repeatable. |
--strategy-part <key@part=side> | What it does: Settle a conflict on the key itself and none of its texts. The part is key (a deletion), name or meta (description, placeholders, length limit), as in app:checkout.pay@name=main. Repeatable. |
--on-deleted-key <what> | What it does: For a key main deleted and the branch changed: drop keeps it deleted, recreate brings it back as the branch has it. |
--expect-head <n> | What it does: Refuse the merge if the branch changed since this head, which branch show prints. One project only. |
--git-sha <sha> | What it does: The merge commit, recorded with the merge. |
--pr-url <url> | What it does: The pull request, recorded with the merge. |
Without an argument, merge merges the branch the run is on (see Branches). The conflicts page says what counts as a conflict and which flag settles which.
- In a strategy flag a key is written
namespace:key, with(context)after a key that has one. The language or part follows the last@, so a key may contain@. - With several workspaces, each project is checked first, and they merge only when every one is free of conflicts. A project the branch was never pushed to is left out. The projects are merged one after another, not as one change.
- A large merge is written in the background. The CLI waits and prints a line every 30 seconds until it is done.
localeasy mv <from> <to>
Renames a key on the server. It keeps its translations, statuses and history.
| Flag | What it does |
|---|---|
--namespace <name> | What it does: The key's namespace. Needed when the source files hold more than one. |
--to-namespace <name> | What it does: Move the key to this namespace. |
mv renames the key on the server, on the branch the run is on or on the main line. It does not edit your files: rename the key there too, then push. It works on one project, so in a monorepo pick it with --project.
localeasy import lokalise
Imports a Lokalise project: its keys with their descriptions, length limits and tags, and every language's translations. Reviewed is Approved, unverified is Needs review. It goes to the project of localeasy.json on the main line, as one push: the source language first, then the others. A run again writes only what changed. The token is sent to Lokalise only, never to Localeasy.
| Flag | What it does |
|---|---|
--source-project <id> | What it does: Required. The Lokalise project's id. |
--token-env <name> | What it does: The environment variable that holds the Lokalise API token, which needs read access to the project. Without it, LOKALISE_API_TOKEN. There is no flag for the token itself, so it stays out of your shell's history. |
--format <id> | What it does: The format of the namespaces it makes, as format in localeasy.json takes it. Without it, json, or for Crowdin the file's. |
--dialect <dialect> | What it does: How the texts write placeholders, as dialect in localeasy.json takes it. Without it, the format's. A plural goes as an ICU plural on count where the format has no plural forms of its own. |
--dry-run | What it does: Read the project and count its keys, plurals and texts by status. Nothing is sent to Localeasy, and localeasy.json is not read. |
--no-translate | What it does: Skip the project's automatic translation for this import. |
--namespace <name> | What it does: The namespace the keys go to. Without it, default. |
--platform <platform> | What it does: Whose key names to take, and only the keys on that platform: ios, android, web or other. Without it, web. |
localeasy import crowdin
Imports a Crowdin project: each file is a namespace named after it, in the format its extension says (JSON for a Markdown file), with its strings, their context as the description, length limits and labels as tags, and every language's translations. An approved translation is Approved. It goes to the project of localeasy.json on the main line, as one push: the source language first, then the others. A run again writes only what changed. The token is sent to Crowdin only, never to Localeasy.
| Flag | What it does |
|---|---|
--source-project <id> | What it does: Required. The Crowdin project's id. |
--token-env <name> | What it does: The environment variable that holds the Crowdin API token, which needs read access to the project. Without it, CROWDIN_PERSONAL_TOKEN. There is no flag for the token itself, so it stays out of your shell's history. |
--format <id> | What it does: The format of the namespaces it makes, as format in localeasy.json takes it. Without it, json, or for Crowdin the file's. |
--dialect <dialect> | What it does: How the texts write placeholders, as dialect in localeasy.json takes it. Without it, the format's. A plural goes as an ICU plural on count where the format has no plural forms of its own. |
--dry-run | What it does: Read the project and count its keys, plurals and texts by status. Nothing is sent to Localeasy, and localeasy.json is not read. |
--no-translate | What it does: Skip the project's automatic translation for this import. |
--namespace <name> | What it does: The namespace of strings in no file. Without it, default. |
--org <name> | What it does: Read from Crowdin Enterprise, the organisation at {org}.crowdin.com. |
localeasy import phrase
Imports a Phrase Strings project: its keys with their descriptions, length limits and tags, and every locale's translations. The default locale is the source. Reviewed is Approved, unverified is Needs review. It goes to the project of localeasy.json on the main line, as one push: the source language first, then the others. A run again writes only what changed. The token is sent to Phrase only, never to Localeasy.
| Flag | What it does |
|---|---|
--source-project <id> | What it does: Required. The Phrase project's id. |
--token-env <name> | What it does: The environment variable that holds the Phrase API token, which needs read access to the project. Without it, PHRASE_ACCESS_TOKEN. There is no flag for the token itself, so it stays out of your shell's history. |
--format <id> | What it does: The format of the namespaces it makes, as format in localeasy.json takes it. Without it, json, or for Crowdin the file's. |
--dialect <dialect> | What it does: How the texts write placeholders, as dialect in localeasy.json takes it. Without it, the format's. A plural goes as an ICU plural on count where the format has no plural forms of its own. |
--dry-run | What it does: Read the project and count its keys, plurals and texts by status. Nothing is sent to Localeasy, and localeasy.json is not read. |
--no-translate | What it does: Skip the project's automatic translation for this import. |
--namespace <name> | What it does: The namespace the keys go to. Without it, default. |
--region <region> | What it does: The data centre the account is in: eu or us. Without it, eu. |
localeasy audit verify [file]
Checks an NDJSON export of the audit log on this machine: it recomputes each row's hash and checks the chain against the organisation's checkpoints and their signatures, which anyone can read. A row that was changed, or a checkpoint that doesn't match or whose signature doesn't verify, exits 65 and names the rows. Seqs missing from the export are a warning. A row is vouched for only by a checkpoint at or after it with no seq missing between: rows just before a gap, which could be changed with the rows after them left out, and a checkpoint whose row the export lacks are warnings too. The summary counts the rows a checkpoint vouches for. It keeps the checkpoints it has seen and warns when the server later lists one differently.
| Flag | What it does |
|---|---|
--org <id> | What it does: The organisation whose log the file is. Needed with a file; with --fetch, the credential's. |
--fetch | What it does: Download the whole export with the credential, an owner's or admin's, instead of reading a file. |
Global flags
These go before or after any command.
| Flag | What it does |
|---|---|
--config <path> | What it does: Use this localeasy.json instead of the nearest one in the directory or above it. |
--cwd <dir> | What it does: Run as if started in this directory. |
--project <id> | What it does: Only the workspace with this project id. all, or no flag, is every workspace. init also takes a project's name here and writes its id. |
--branch <name> | What it does: The branch to push to, pull from, merge or rename on. Without it: LOCALEASY_BRANCH, then the branch your CI builds, then the one git has checked out. main and master are the main line. |
--api-url <url> | What it does: The server to talk to. Without it: LOCALEASY_URL, then server in localeasy.json, then https://localeasy.app. |
--token <token> | What it does: An API key. Without it: LOCALEASY_TOKEN, then a GitHub Actions job's OIDC token, then the sign-in localeasy login kept. A token is never written to a file. |
--json | What it does: Print one JSON object instead of lines. LOCALEASY_OUTPUT=json does the same. |
--quiet | What it does: Print only results, warnings and errors. |
--no-color | What it does: No colour, whatever the terminal. |
--version | What it does: Print the CLI's version. |
--help | What it does: List the commands, or one command's flags. |
Branches
push, pull, merge and mv work on a branch. The CLI takes the first of these that names one:
--branch, ormerge's argument.LOCALEASY_BRANCH.- The branch your CI builds. On a GitHub pull request that is the pull request's branch.
- The branch git has checked out.
main and master are the main line, which on the server is no branch. With no branch found, the run is on the main line too. A push to a branch the server has not seen opens it.
A branch cannot add a namespace or a language. A project's first push, the first push of a new source file and the import of a new language go to main: from a git branch, add --branch main to the command. Outside CI, the CLI stops such a push before it opens the branch git has checked out, and names the command to run.
Any other push from a git branch, outside CI, goes to that branch, and the push that opens it prints a warning, because the texts are then on that branch and not on main. localeasy merge with the branch's name moves them to main.
If the repository's default branch has another name, such as develop or trunk, push from it with --branch main, or set LOCALEASY_BRANCH=main in the job that builds it. Without one of them its pushes go to a branch of that name and never reach the main line.
Output
Results go to standard output. An error goes to standard error, in four parts: what failed, where, how to fix it, and a line with the exit code, the run id and a link to the exit code on this page. The link is on the server the run talks to, here the test server.
$ localeasy push --translations
· on the main line 1 workspace · 3 keys in 1 file · source and translation files
✗ Error Translation files have no pulled base to compare with
locales/sv/app.json
→ Import them with localeasy push --translations --strategy overwrite --force, which replaces the server's translations; or run localeasy pull --force to replace the files with the server's
· Exit 64 · Run 4bf92f3577b34da6a3ce929d0e0e4736 · http://api.test/docs/cli/exit-64With --json a command prints one JSON object and no lines. It has command, run_id, the command's own fields and exit_code. A failed command's object also has error, with message, where, fix and docs.
$ localeasy status --json
{"command":"status","run_id":"4bf92f3577b34da6a3ce929d0e0e4736","state":"all","fail_under":null,"languages":[{"project":"0192f5e4-7b1a-7c3d-8e9f-000000000001","locale":"sv","keys":3,"translated":66,"approved":0,"fresh":66,"under":false}],"exit_code":0}Colour is on in a terminal, in GitHub Actions and in GitLab CI. --no-color, NO_COLOR and FORCE_COLOR decide before that, in that order.
A request that fails on the network, or that the server answers with 429 or 503, is tried again up to three times: after 5, 15 and 45 seconds, or after the time the server asks for. Each retry prints a warning. A server whose host name does not resolve is not tried again: the run ends at once with exit 69. Once the server has answered in a run, a name that stops resolving is retried like any other network failure.
Environment
| Variable | What it does |
|---|---|
LOCALEASY_TOKEN | What it does: An API key (lk_…). The CLI exchanges it for a short-lived access token on each run. |
ACTIONS_ID_TOKEN_REQUEST_URL, ACTIONS_ID_TOKEN_REQUEST_TOKEN | What it does: Set by GitHub Actions in a job with id-token: write. Without LOCALEASY_TOKEN, the CLI signs in with the job's OIDC token, for a repository with CI access. |
LOCALEASY_URL | What it does: The server, when it is not https://localeasy.app. |
LOCALEASY_BRANCH | What it does: The branch, when --branch is not given. |
LOCALEASY_OUTPUT | What it does: json prints JSON, as --json does. |
LOCALEASY_STAGE_BYTES | What it does: The size above which a push is uploaded as one staged file. The default is 8 MB; a lower value tries the staged path on a small project. |
NO_COLOR | What it does: Any value turns colour off. |
FORCE_COLOR | What it does: Turns colour on outside a terminal; 0 turns it off. NO_COLOR wins over it. |
XDG_CONFIG_HOME | What it does: Where audit verify keeps the checkpoints it has seen, under localeasy/checkpoints/. Without it, ~/.config. |
LC_ALL, LC_CTYPE, LANG | What it does: A locale that is not UTF-8 switches the symbols to ASCII: + for the check, x for the cross. |
Exit codes
The codes are stable, so a pipeline can branch on them. 3 and 4 mean the command worked and found something. 64 and above follow the BSD sysexits numbers.
| Code | Name | When | What to do |
|---|---|---|---|
| 0 | Name: OK | When: The command did what it said. Warnings, such as an approved translation kept back, do not change the code. | What to do: Nothing. |
| 3 | Name: Findings | When: check found errors, pull --frozen found files that would change, extract --check found keys the source files lack, types --check found declarations that would change, or a language is under status --fail-under. Nothing is broken; the gate held. | What to do: Fix the findings, run the command without the gate flag and commit, or translate more. |
| 4 | Name: Conflicts | When: A merge, or a push of translation files, met texts changed on both sides. Also a branch that moved past --expect-head, a merge already being written, a project or branch name already in use, and a project at its limit of open branches. Nothing was written. | What to do: Settle the conflicts with a strategy flag or in the app, then run again. |
| 64 | Name: Usage | When: A flag or argument is unknown, invalid or missing. | What to do: Fix the flag the error names. localeasy help <command> lists them. |
| 65 | Name: Invalid data | When: A file cannot be parsed, a message is not valid in its dialect, or the server rejected the input. Also a push --remove-missing that would remove more than 20% of a namespace's keys, and an audit log export that audit verify found changed. | What to do: Fix the file and key the error names. For the removal, check that the source files are whole, then add --force. For the audit log, keep the export and compare it with an earlier one. |
| 66 | Name: Not found | When: localeasy.json named by --config is missing, or the project, branch or key does not exist or the token cannot see it. | What to do: Check the path, the project in localeasy.json, and the token's organisation. |
| 69 | Name: Unavailable | When: The server's host name does not resolve, the server could not be reached after three retries, or it answered with a server error. | What to do: Check the network and the server address, then run again. localeasy doctor tests both. |
| 70 | Name: Internal | When: A bug in the CLI. doctor also uses it for a Node.js older than 22.12. | What to do: Report the run id. |
| 73 | Name: Cannot write | When: init found a localeasy.json already there, pull met a file of more than 100,000 keys, which cannot be exported yet, or push would have taken a file past 100,000 keys. | What to do: Edit the file, or pass --force to replace it. Split a namespace that is too large. |
| 74 | Name: I/O error | When: The sign-in could not be saved to the OS keychain. | What to do: Set LOCALEASY_TOKEN to an API key instead. |
| 75 | Name: Try again later | When: The server kept answering 429 or 503 through three retries, or a merge stopped before it was written. | What to do: Wait a few minutes and run again. |
| 76 | Name: Protocol | When: The server's answer was not understood. | What to do: Check that the server address is a Localeasy server, and that the CLI is not older than it. |
| 77 | Name: No permission | When: No token, or it expired or was revoked. Or the role, scope or language grant behind it does not allow the action. | What to do: Run localeasy login or set LOCALEASY_TOKEN. Or ask an owner or admin for the role. |
| 78 | Name: Config | When: No localeasy.json was found, it or localeasy.lock is invalid, or it names no project or source language. Also extract or types without its field in localeasy.json, and an extractor the project does not have installed. | What to do: Fix the file and field the error names, install the extractor, or run localeasy init. |