Translate glimpse
All binaries share one gettext domain, glimpse, with the template and catalogs in po/. You need gettext, ripgrep and python3; the just recipes below call xgettext, msgmerge and msgfmt through scripts. Testing the result also needs the packages from Build glimpse from source.
Add a language
A new language is three edits, shown here for German (de):
- Add the language code to
po/LINGUAS, one per line. - Create
po/de.po. Copypo/glimpse.potas the starting point, fill in the header and translate eachmsgstr. Keep every{placeholder}exactly as written: the code fills them in by name, and a renamed placeholder leaves the sentence with a hole. Where a message has a plural form, translate everymsgstr[N]. - Add one asset line for the compiled catalog to each of the three lists in
crates/glimpse-package/Cargo.toml(deb, rpm and the openSUSE rpm variant), next to the existing per-language lines. The first form goes in the deb list, the second in both rpm lists:
["../../target/locale/de/LC_MESSAGES/glimpse.mo", "usr/share/locale/de/LC_MESSAGES/", "644"],{ source = "target/locale/de/LC_MESSAGES/glimpse.mo", dest = "/usr/share/locale/de/LC_MESSAGES/glimpse.mo", mode = "644" },Update the strings
just update-po rewrites po/glimpse.pot from every translation marker in the tree and merges it into each catalog named in po/LINGUAS, so run it first and translate what is new or marked fuzzy:
just update-poBuild and test
just build-translationsThis compiles the catalogs into target/locale/<lang>/LC_MESSAGES/glimpse.mo. glimpse loads catalogs from the installed locale directory, so install your build to see the language on your own desktop (see Build glimpse from source). Then set [regional] language in ~/.config/glimpse/config.toml. If your session already sets the LANGUAGE environment variable, that wins over the setting. A language change does not apply live: restart the running components to pick it up.
Check your work
just check-stringsIt fails on a stale template, a catalog msgfmt rejects, or a quoted string the extractor cannot read, and it is part of just verify, so a green run is what CI will see.