The command line tool connects a repository to a project: on a laptop one command signs you in through your browser and runs the first translation, and in CI it reads a project token from TRANSGLOT_TOKEN.
Who this is for
Developers, and the owners and admins who connect their repositories. Connecting a repository creates a project token, so the login that approves it in the browser must be an admin of the workspace or an owner of the account it belongs to. A developer who approves sees Connecting the CLI creates a project token, which needs an admin of the workspace, with the names of the people who can.
What happens next
On a laptop, run npx transglot@latest init in your repository. It needs Node.js 22 or later.
It finds your locale files and works out the source language. Nothing is sent yet.
It prints a link and a code, and opens the link in your browser. The page is titled Connect the CLI. Sign in or sign up there.
Under Connect this terminal?, check that the code matches the one in your terminal, then select Approve. If you did not run the command yourself just now, select Decline.
When your browser and the terminal are on different networks, the page shows Type this number in your terminal. Type the two digits into the terminal.
If you have no workspace yet, the page asks you to name one under Create your workspace. The plan is the account's, so if the plan of the workspace's account does not include the command line tool, the page offers the account's owners and billing members Start the free trial, or a paid plan when the account cannot have a trial, after a company or billing name for the invoices. Once the account's plan includes it, every workspace of the account does.
Under Choose the project for this repository, connect an existing project or create the one the terminal proposed from your files.
The page then says Your terminal is connected, and the terminal carries on: it writes transglot.json, uploads your source strings and the translations you already have, shows how many words the first translation needs, asks once, translates, and writes the files back. A file that holds strings the server does not have is kept, and the terminal says so.
The project token is stored on that machine only, never in the repository, and it appears with the project's other tokens under Developer, where deleting it disconnects the terminal. In that folder, push, pull and status use it without any setup.
The commands:
init: set up this repository, as above. In a repository that already has
transglot.json, it signs you in and links the folder on this machine instead, and uploads nothing.push: send your source strings up. With
--waitit waits for the translations.pull: bring translations down into your files.
status: see the project and where its runs stand.
cancel: stop a running translation.
In CI, create a deploy token under Developer and store it as the TRANSGLOT_TOKEN secret. While it is set it always wins over a token stored on the machine, and the command line tool never opens a browser. The Command line (CLI) snippet on a project's Releases page is already filled in with that project's details.
Run it as npx transglot@latest: in a repository that lists an older transglot as a development dependency, npx would otherwise run that older version.
If it doesn't work
This code has expired: run the command in your terminal again for a new code.
Nothing was connected: the request was declined, or the terminal typed the wrong number twice. Run the command again for a new code.
"Browser sign-in does not run in CI.": store a deploy token as the
TRANSGLOT_TOKENsecret instead."TRANSGLOT_TOKEN is not set.": this folder is not linked on this machine. Run
npx transglot@latest initto sign in and link it.
Related
Create a deploy token
The GitHub Action
The public API
