Skip to main content

The GitHub Action

Keep your translations in step with your code by running transglot on every push: the action sends your source strings up, waits for the batch to finish, and commits the finished locale files back to your branch.

Keep your translations in step with your code by running transglot on every push: the action sends your source strings up, waits for the batch to finish, and commits the finished locale files back to your branch.

Who this is for

Anyone who can open a project. Creating the token the action needs is an owner or admin job, so if you are a developer you may need one of them to mint it for you.

Before you start

You need three things.

A committed configuration file in the repository, naming your source and target file patterns. Running the setup command in your checkout writes one for you.

A deploy token for the project, with both the push and pull abilities. push alone lets the action send strings up but not bring translations back.

That token stored as a repository secret named TRANSGLOT_TOKEN. The token value never goes in the workflow file itself.

Steps

  1. Open the project, then Deploy.

  2. Find the GitHub Action panel. It reads: "Drop this into .github/workflows/transglot.yml and add TRANSGLOT_TOKEN to your repo secrets."

  3. Copy the snippet. It is already filled in with this project's real server address, so you do not need to edit it.

  4. Commit it to your repository as .github/workflows/transglot.yml.

  5. In your repository settings on GitHub, add a secret named TRANSGLOT_TOKEN with the token value.

  6. Push to your default branch.

What happens next

The action runs four stages in order: it pushes your source strings, waits for the translation batch to reach a final state, pulls the finished files back, and then commits them.

Three settings control it, and all three have defaults, so the copied snippet works without them:

  • wait defaults to true, which blocks until the batch is finished before pulling. Set it to false to send strings and move on without waiting.

  • commit defaults to branch, which commits the pulled files and pushes them to the branch the workflow ran on. Set it to artifact to upload them as a build artifact instead, or none to leave them in the workspace for a later step.

  • cli-version pins the version of the command line tool the action installs.

Because branch is the default, the job needs permission to write to your repository. The copied snippet already grants it. A commit only happens when files actually changed, and it is made as github-actions[bot] with the message "chore(i18n): sync translations from transglot".

The action also reports two values you can branch on in later steps: the id of the batch it queued, which is empty when nothing needed translating, and the number of files the pull rewrote.

If it doesn't work

  • A 403 when the action tries to push. The job is running with read-only permission. The snippet on the Deploy panel grants write access; if you wrote the workflow by hand, that line is what is missing.

  • The job fails and the log mentions authentication. The secret is missing, misspelled, or the token has been revoked. It must be named TRANSGLOT_TOKEN exactly.

  • The job fails on configuration. The configuration file is missing from the checkout, or a file pattern in it matches nothing.

  • The job reports the batch failed or was cancelled. Any translations that did complete are still pulled and committed first, so you keep the work that succeeded.

  • The job reports a quota problem. Your source strings were still sent; only the translation batch was held back. Check your plan's remaining allowance.

  • The job reports a timeout. The batch was still running when the wait gave up. It usually finishes on its own, and the next run pulls the results.

  • It succeeds but commits nothing. Either nothing changed since the last run, or the files it pulled are excluded by your repository's ignore rules. The run is reported as a success in both cases.

  • A setting you added is ignored. The action accepts only the settings listed above. Anything else is silently discarded by GitHub rather than reported as an error, so check the spelling against the panel's snippet.

Related

  • The command line tool

  • Create a deploy token

  • The deploy screen

Did this answer your question?