Skip to page
LocaleasySecurity

CLI

localeasy pushes the source texts in your repository to Localeasy and pulls the translations back into your files. lz is a short name for the same command.

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 --version

The 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:

  1. --token.
  2. LOCALEASY_TOKEN. In CI, set it to an API key from Settings › API keys.
  3. In a GitHub Actions job with id-token: write, the job's OIDC token, for a repository with CI access. See CI.
  4. The sign-in localeasy login kept 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

The CLI's commands
CommandWhat it does
initWrites localeasy.json for the translation files in this directory.
loginSigns you in through the browser and keeps the sign-in in the OS keychain.
logoutEnds the sign-in localeasy login kept for this server.
pushSends changed source files to the server. Translation files go too with a flag.
pullWrites the server's translations into the translation files.
statusShows how much of each language is translated, approved and fresh.
checkChecks the local files without the network.
extractAdds 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.
typesWrites 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.
doctorChecks the config, the lockfile, the token, the network and the Node.js version.
branch listLists the project's open and merging branches.
branch createOpens a branch. A push to a branch the server has not seen opens it too.
branch showShows a branch's status, the branch it was opened from, its head and where it was opened.
branch closeCloses a branch without merging it. A branch others are open from can't be closed until they are merged or closed.
mergeMerges a branch into main, or into the branch it was opened from. A conflict writes nothing and exits 4.
mvRenames a key on the server. It keeps its translations, statuses and history.
import lokaliseImports 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 crowdinImports 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 phraseImports 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 verifyChecks 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.

Flags of localeasy init
FlagWhat it does
--source <pattern>The source files, such as locales/en/{namespace}.json. Without it, the translation pattern with the source language filled in.
--translation <pattern>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>The language of the source files. Without it, en when the files found have it, else the first language found.
--locales <tags>The translation languages, comma-separated. Without it, the languages found.
--server <url>A server to write into the config. Left out, the config names none and the CLI uses https://localeasy.app.
--create <slug>Create the project on the server under this slug and write its id.
--jurisdiction <where>Where a created project's data is stored: global, eu or us. It must be the organisation's, which is also the default.
--yesAsk nothing; use the flags and what was found.
--forceReplace 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 4bf92f3577b34da6a3ce929d0e0e4736

localeasy 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.

Flags of localeasy push
FlagWhat it does
--dry-runShow what would change. Nothing is written.
--translationsAlso push translation files, each compared three-way against the copy the last pull left.
--strategy <strategy>overwrite sends translation files that have no pulled copy to compare with, as they are. It needs --force.
--remove-missingOn 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.
--forceConfirms --strategy overwrite. In a push without --strategy overwrite, it lets --remove-missing remove more than 20% of a namespace's keys.
--allow-downgradeLet the files replace approved translations, which then lose Approved.
--no-translateSkip the project's automatic translation for this push. New source texts stay untranslated until someone translates them.
--from <branch>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-downgrade is 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.lock then vouches for the file. To send it, remove its entry from localeasy.lock and 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 --project leaves 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, --force confirms 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-run compares every source file and lists what would be renamed and removed. A --dry-run without the flag counts those keys on the main line only, and only in the source files changed since localeasy.lock last 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 main if 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.lock says 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.

Flags of localeasy pull
FlagWhat it does
--state <state>all (the default) writes every translation. approved writes only approved translations whose source text has not changed since.
--frozenWrite nothing, and exit 3 if a file would change. A gate for files you commit.
--min-seq <n>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.
--forceOverwrite files that have local changes you never pushed.
--watchKeep 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>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 says not in localeasy.lock, and the summary counts the files kept. If the lockfile was deleted or not committed, pull --force takes 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-seq takes a position in the project's history. push prints the one it left the project at, as head on the workspace's line, and push --json has it as head_seq. With several projects each has a head of its own, in workspaces.
  • On a branch, a file the branch changed is main's file with the branch's changes applied.
  • A language with fallbacks (fallbacks in 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 approved the first approved one whose source text hasn't changed, or the source. Gettext and XLIFF files aren't filled. push --translations sends only what changed since the pull, so the filled texts aren't sent; with --strategy overwrite they 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-3

localeasy status

Shows how much of each language is translated, approved and fresh.

Flags of localeasy status
FlagWhat it does
--fail-under <percent>Exit 3 when a language's fresh share is below this percentage, 0 to 100.
--state <state>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-3

localeasy check

Checks the local files without the network.

Flags of localeasy check
FlagWhat it does
--reporter <reporter>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:

What check reports
RuleSeverityWhat it found
parse-errorErrorThe file cannot be parsed, or holds the same key twice.
invalid-messageErrorA message is not valid in its dialect.
placeholder-mismatchErrorA translation's placeholders differ from its source text's.
unknown-keyWarningA 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-3

localeasy 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.

Flags of localeasy extract
FlagWhat it does
--checkWrite 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.

Flags of localeasy types
FlagWhat it does
--checkWrite 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 4bf92f3577b34da6a3ce929d0e0e4736

localeasy 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.

Flags of localeasy branch create
FlagWhat it does
--from <branch>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 4bf92f3577b34da6a3ce929d0e0e4736

localeasy 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.

Flags of localeasy merge
FlagWhat it does
--dry-runShow what would merge. Nothing is written.
--strategy <side>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>Settle one language's conflicts, such as sv=branch. Repeatable.
--strategy-key <key=side>Settle one key's conflicts, such as app:checkout.pay=main. Repeatable.
--strategy-text <key@locale=side>Settle one key's conflict in one language, such as app:checkout.pay@sv=branch. Repeatable.
--strategy-part <key@part=side>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>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>Refuse the merge if the branch changed since this head, which branch show prints. One project only.
--git-sha <sha>The merge commit, recorded with the merge.
--pr-url <url>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.

Flags of localeasy mv
FlagWhat it does
--namespace <name>The key's namespace. Needed when the source files hold more than one.
--to-namespace <name>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.

Flags of localeasy import lokalise
FlagWhat it does
--source-project <id>Required. The Lokalise project's id.
--token-env <name>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>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>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-runRead the project and count its keys, plurals and texts by status. Nothing is sent to Localeasy, and localeasy.json is not read.
--no-translateSkip the project's automatic translation for this import.
--namespace <name>The namespace the keys go to. Without it, default.
--platform <platform>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.

Flags of localeasy import crowdin
FlagWhat it does
--source-project <id>Required. The Crowdin project's id.
--token-env <name>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>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>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-runRead the project and count its keys, plurals and texts by status. Nothing is sent to Localeasy, and localeasy.json is not read.
--no-translateSkip the project's automatic translation for this import.
--namespace <name>The namespace of strings in no file. Without it, default.
--org <name>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.

Flags of localeasy import phrase
FlagWhat it does
--source-project <id>Required. The Phrase project's id.
--token-env <name>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>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>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-runRead the project and count its keys, plurals and texts by status. Nothing is sent to Localeasy, and localeasy.json is not read.
--no-translateSkip the project's automatic translation for this import.
--namespace <name>The namespace the keys go to. Without it, default.
--region <region>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.

Flags of localeasy audit verify
FlagWhat it does
--org <id>The organisation whose log the file is. Needed with a file; with --fetch, the credential's.
--fetchDownload 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.

Flags every command takes
FlagWhat it does
--config <path>Use this localeasy.json instead of the nearest one in the directory or above it.
--cwd <dir>Run as if started in this directory.
--project <id>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>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>The server to talk to. Without it: LOCALEASY_URL, then server in localeasy.json, then https://localeasy.app.
--token <token>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.
--jsonPrint one JSON object instead of lines. LOCALEASY_OUTPUT=json does the same.
--quietPrint only results, warnings and errors.
--no-colorNo colour, whatever the terminal.
--versionPrint the CLI's version.
--helpList 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:

  1. --branch, or merge's argument.
  2. LOCALEASY_BRANCH.
  3. The branch your CI builds. On a GitHub pull request that is the pull request's branch.
  4. 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-64

With --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

Environment variables the CLI reads
VariableWhat it does
LOCALEASY_TOKENAn 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_TOKENSet 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_URLThe server, when it is not https://localeasy.app.
LOCALEASY_BRANCHThe branch, when --branch is not given.
LOCALEASY_OUTPUTjson prints JSON, as --json does.
LOCALEASY_STAGE_BYTESThe 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_COLORAny value turns colour off.
FORCE_COLORTurns colour on outside a terminal; 0 turns it off. NO_COLOR wins over it.
XDG_CONFIG_HOMEWhere audit verify keeps the checkpoints it has seen, under localeasy/checkpoints/. Without it, ~/.config.
LC_ALL, LC_CTYPE, LANGA 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.

The CLI's exit codes
CodeNameWhenWhat to do
0OKThe command did what it said. Warnings, such as an approved translation kept back, do not change the code.Nothing.
3Findingscheck 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.Fix the findings, run the command without the gate flag and commit, or translate more.
4ConflictsA 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.Settle the conflicts with a strategy flag or in the app, then run again.
64UsageA flag or argument is unknown, invalid or missing.Fix the flag the error names. localeasy help <command> lists them.
65Invalid dataA 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.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.
66Not foundlocaleasy.json named by --config is missing, or the project, branch or key does not exist or the token cannot see it.Check the path, the project in localeasy.json, and the token's organisation.
69UnavailableThe server's host name does not resolve, the server could not be reached after three retries, or it answered with a server error.Check the network and the server address, then run again. localeasy doctor tests both.
70InternalA bug in the CLI. doctor also uses it for a Node.js older than 22.12.Report the run id.
73Cannot writeinit 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.Edit the file, or pass --force to replace it. Split a namespace that is too large.
74I/O errorThe sign-in could not be saved to the OS keychain.Set LOCALEASY_TOKEN to an API key instead.
75Try again laterThe server kept answering 429 or 503 through three retries, or a merge stopped before it was written.Wait a few minutes and run again.
76ProtocolThe server's answer was not understood.Check that the server address is a Localeasy server, and that the CLI is not older than it.
77No permissionNo token, or it expired or was revoked. Or the role, scope or language grant behind it does not allow the action.Run localeasy login or set LOCALEASY_TOKEN. Or ask an owner or admin for the role.
78ConfigNo 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.Fix the file and field the error names, install the extractor, or run localeasy init.