Skip to content

Latest commit

 

History

History
89 lines (69 loc) · 4.3 KB

translating.md

File metadata and controls

89 lines (69 loc) · 4.3 KB

Translating USBGuardGUI

The interface uses GNU gettext. Every translation is one file, po/<language>.po, and you need no Rust knowledge to write one.

English is the source language; Italian, French and Brazilian Portuguese catalogues are provided. The initial French catalogue, and the strings added to the Italian and French catalogues in 0.2.1, were prepared with AI assistance; fluent-speaker improvements are welcome through the usual review process.

What is translated, and what is not

  • Translated: every text in the window, the notifications, the status icon menu, the application's menu entry (.desktop), and its software-store description (AppStream metainfo).
  • Not translated, on purpose:
    • rule-language keywords — allow, block, reject, with-interface, label, one-of, … — are syntax: a translated keyword would be a syntax error;
    • the command-line output (usbguard-gui --diagnose and friends), which is pasted into bug reports and must be readable by everyone;
    • the application name, USBGuardGUI, which appears in the strings as {app}.

To try the supplied French catalogue from a development build, run LANGUAGE=fr cargo run.

Start a new language

You need gettext (sudo dnf install gettext, sudo apt install gettext, or sudo pacman -S gettext).

git clone https://github.com/onyks-os/USBGuardGUI.git && cd USBGuardGUI
make i18n-pot                                   # refresh po/usbguard-gui.pot
msginit -i po/usbguard-gui.pot -o po/es.po -l es_ES.UTF-8
echo es >> po/LINGUAS

Then translate po/es.po with any editor — Poedit, GNOME Translation Editor, Lokalize, or a plain text editor. po/it.po is a complete example.

Rules for each string

  • Keep every {placeholder} exactly as written, but move it wherever your grammar needs it: Rejected “{device}” permanently may become “{device}” rifiutato permanentemente. make i18n rejects dropped, added or renamed placeholders using a compiled-catalogue checker even on gettext versions that do not understand the Rust format flag.
  • Keep the underscore in menu entries (_Preferences): it marks the keyboard access key. Put it before a letter of your translation.
  • Read the #. Translators: comments above a string: they say what it refers to.
  • translator-credits is not a sentence: replace it with your name, to be credited in the About dialog.
  • Plural forms (msgstr[0], msgstr[1], …) follow your language's rule, which msginit writes into the header.

Check and try it

msgfmt --check --statistics -o /dev/null po/es.po    # must report no error
make i18n                                            # regenerates data/*.desktop and metainfo
LANGUAGE=es cargo run                                # the window, in Spanish

To see the window with invented devices instead of your own, run cargo run --example demo-bridge in another terminal and start the window with LANGUAGE=es USBGUARD_GUI_BUS=session cargo run.

Submit

Add po/<lang>.po, the new line in po/LINGUAS, the regenerated data/*.desktop and data/*.metainfo.xml, and one packaging line for your language in Cargo.toml (copy the it lines under [package.metadata.deb] and [package.metadata.generate-rpm]). Open a pull request; every commit needs a DCO Signed-off-by line (git commit -s). See CONTRIBUTING.md.

Keeping a translation current

When the interface changes, a maintainer runs make i18n-update, which merges new strings into every .po file and marks changed ones fuzzy. Translate the new and fuzzy entries, remove the #, fuzzy marker, and submit again.

make test-i18n, included in make verify, checks compiled catalogue behavior, French completeness/plurals, format-placeholder rejection, localized desktop/store metadata and native package declarations for every language in po/LINGUAS. make i18n-check runs these tests in CI. Arch and Flatpak packaging already iterate over that list; the reproducible worker does too. The installed Flatpak verifier requires every registered catalogue before it writes a passing runtime report.