Getting started
Localizer works with Go CLIs in public GitHub repositories. For a Cobra CLI
(v1.8 or later), one line translates the whole command tree. Other CLIs call localizer.Init and use the
output helpers.
-
Connect your repository.
Add
.github/workflows/localizer.yml:name: Localizeron:push:branches: [main]workflow_dispatch:permissions:contents: writepull-requests: writeid-token: writejobs:translations:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v7- uses: DABH/localizer/action@v0.4.1Then turn on Settings → Actions → General → Allow GitHub Actions to create and approve pull requests, and push. See the GitHub Action guide.
Install the Localizer GitHub App on the repository. Nothing else is needed. See the GitHub App guide.
-
Merge the onboarding pull request. The first run opens Localize this CLI with Localizer, which adds:
-
.localizer.ymlwith the default settings (configuration); -
locales/embed.goand one catalog per language (locales/ja.json,locales/de.json, …); -
the one-line integration, when Localizer finds exactly one place where your root command is executed. Otherwise the pull request tells you where to add it:
localizer.Localize(root, locales.FS) // right before root.Execute()
-
-
Try it.
Terminal window go build -o yourcli .LANG=ja_JP.UTF-8 ./yourcli --helpLOCALIZER_LANG=de ./yourcli --helpLOCALIZER_LANG=qps ./yourcli --help # pseudo-localization: shows every string Localizer handles -
Hook your own messages. Help and Cobra’s errors are covered by the one line. For messages your code prints, wrap your output helpers with
localizer.T,localizer.Sprintf,localizer.Errororlocalizer.Writer. The integration guide shows how. -
Keep tests in English. Set
LOCALIZER_LANG=enwherever output is compared with golden files. See Testing.
From now on, every push that changes user-facing strings updates the Update translations pull request.
© 2026 Snizyx Software LLC