跳转至主要内容
Docs menuStrings / Connect GitHub or the CLI
On this page
  1. GitHub
  2. CLI
  3. In CI

Connect GitHub or the CLI

Bring your app's strings into Lefine from a GitHub repo, or push and pull them with the CLI.

Pick one when you create the app. You can change it later in the app's Sync tab.

GitHub

Lefine reads your locale files and opens a pull request when you press the button. Nothing is written to your repo until you open that pull request yourself, after you see the diff.

  1. In the app, open Sync and press Connect GitHub. This installs the Lefine GitHub App once per workspace.
  2. Pick the repo: choose the Repository and the branch to Read translations from.
  3. Press Scan for locale files, check the list, then press Confirm these files.

Settings on the same form:

SettingValues
Path patternfor example src/i18n/{locale}.json
Key formatNested objects, or Flat keys (a.b.c)
Open pull requests againsta branch
DirectionTwo-way · Repo to Lefine only · Lefine to repo only

The GitHub App asks for contents and pull requests (read and write) and metadata (read). It never pushes to your default branch.

CLI

Terminal
npx lefine loginnpx lefine strings push -p app_…npx lefine strings pull -p app_…

-p takes the app_… from Settings → General. Without -p, the CLI reads it from the lefine.ts that npx lefine init wrote. login prints a code and a link, and opens your browser. It works over SSH too. push reads your source file, { "namespace": { "key": "text" } }, shows the diff and asks before it changes anything. pull writes the published translations to ./locales (-o to change it).

npx lefine strings check -p app_… checks placeholders, ICU plurals and markup, and finds keys your code uses that are missing from the source file.

In CI

Do not run login in CI. Create a key in Settings → API keys, save it as the secret LEFINE_TOKEN, and pass --yes:

yaml
- run: npx lefine strings push -p app_… --yes  env:    LEFINE_TOKEN: ${{ secrets.LEFINE_TOKEN }}

Give the key only what the job needs: Read to check and pull, Read and write to push.

Next step · StringsUpload files
Was this page helpful?