Migrate from CLI v0 to the GitHub App
Replace the lingodotdev/lingo.dev GitHub Action with the Lingo.dev GitHub App, which opens a pull request with translations after each push to your default branch.
You end with the Lingo.dev GitHub App opening a translation pull request after each push to your default branch, and no translation workflow in your CI.
Before you begin
- A Lingo.dev organization with a localization engine
- The project's
i18n.lock, committed. If it is missing, restore it from git: without it, v0 cannot tell outdated translations from current ones, and--frozenpasses even when they are outdated. - Node.js and npm
- Admin rights on the GitHub organization, to install the App
Migrate #
Finish with v0#
Run v0 one last timeThe new CLI does not fill keys that are missing from target files that already exist, so let v0 bring every target file up to date first.
Translate what is pending with the
lingo.devversion in yourpackage.json, or the latest 0.138.x:Terminalnpx lingo.dev@0.138 runThen check that nothing is left:
Terminalnpx lingo.dev@0.138 run --frozenIt fails with "Target file is missing translations" while any target file lacks a key, and also when a source changed since
i18n.lockor a target has keys the source no longer has. Fix what it reports and run it again until it passes.Commit the source files, the target files and
i18n.lock. Do not edit source files until the migration is done.Install the new CLI and sign in#
Both packages install a
lingocommand, so remove a global v0 first:Terminalnpm uninstall --global lingo.dev npm install --global @lingo.dev/cli lingo --version lingo loginlingo --versionprintslingo v1.26.0or newer. In a project that keepslingo.devas a dependency, runnpx @lingo.dev/cliin place oflingo.Convert i18n.json#
On a new branch, from the folder that holds
i18n.json, run:Terminallingo migrateIt writes
.lingo/config.jsonbesidei18n.jsonand changes no other file. If it prints settings under "Not converted", look each one up in Convert i18n.json. If the repository has more than onei18n.json, see Several i18n.json files.Link the project#
Link the project to your organization and engine. If
lingo migrateprinted a command such aslingo link --engine eng_abc123, run that one instead, because it names the engine v0 used:Terminallingo linkCommit
.lingo/config.json.Connect the GitHub App#
In Lingo.dev, open Settings → Integrations and select Connect for GitHub.
On GitHub, give the App access to this repository.
Add a
githubblock to.lingo/config.json. It sets when the App translates: after each push to the default branch, and, if you turn it on, inside open pull requests.
.lingo/config.json{ "github": { "workflows": { "onPushToDefaultBranch": { "enabled": true }, "onPullRequest": { "enabled": false } } } }The App reads only the
.lingo/config.jsonat the repository root, and it needs no API key or lockfile, so do not commit.lingo/lock.json. If your repository has a config per package, or generates source files in CI, use CLI in your pipeline instead. GitHub App covers every setting.Delete the old workflow#
On the same branch, delete the workflow that uses
lingodotdev/lingo.dev, so v0 and the App do not both translate.Merge into the default branch#
Merge the branch. From then on, each push to the default branch starts a run that translates the source files it changed. The App opens or updates a pull request from
lingo/translations/<default-branch>and never commits to the default branch. Your existing translations stay as they are.To translate inside pull requests too, set
onPullRequest.enabledtotruein the default branch's config.Fill missing target files#
The App translates only the files each push changes, so it does not create target files that are missing now. Create them with the CLI:
Terminallingo push --backfill-missing --waitCommit the target files it writes, then delete
.lingo/lock.jsonwithout committing it:Terminalrm .lingo/lock.jsonRemove v0#
Once the config is on the default branch, remove what is left of v0. Delete the v0 config and lockfile:
Terminalgit rm i18n.json i18n.lockRemove the
LINGODOTDEV_API_KEYsecret and any provider keys that only v0 used. Removelingo.devfrom your dependencies unless the application importslingo.dev/sdk:Terminalnpm uninstall lingo.devThen search for what is left of v0:
Terminalgit grep -nE 'lingo\.dev (run|i18n|ci)|lingodotdev/lingo\.dev@|LINGODOTDEV_API_KEY'Replace each match, such as an npm script that runs
lingo.dev run, with its equivalent from Map v0 commands and flags.
Check it worked #
lingo whoamishows your organization and engine.- A commit to the default branch that changes one source string gets a translation pull request with the new translation in every target file.
lingo checkexits 0. Without.lingo/lock.jsonit only checks that every target file exists.
If something fails, see Troubleshooting.
Used --target-locale, --file, your own model key, several i18n.json files or another uncommon setup? See Uncommon setups. If a step does not fit your setup, email support@lingo.dev.