The product is Voelin (app id io.github.faumaray.Voelin), everywhere: - crates tsc-* -> voelin-* (and voelin-fuzz), the desktop binary tsc-desktop -> voelin, the development CLI tsctl -> voelinctl; - the Android app: applicationId, Kotlin package io.github.faumaray.voelin, VoelinApp, libvoelin_android.so (JNI class names follow); - TSC_* environment variables -> VOELIN_*, Gradle properties tsc.* -> voelin.*, signing secrets VOELIN_SIGNING_*; - the data/config/cache/state folder tsc -> voelin, the keyring service, thread names, the dev compose project; - desktop file, metainfo, icon, Flatpak manifest, NSIS installer, docs. The gateway keeps its name: bin tsgw (crate voelin-gateway), TSGW_* env vars, the tsgw.v1+json protocol, the tsgw image. The window title and the About page show "Voelin <version>" from voelin_platform::APP_NAME. Packages (scripts/package.sh): the app only (voelin, voelin.exe, APKs, Flatpak). voelinctl is a development tool and in no package. tsgw is for servers and now its own Linux package, tsgw_<v>_amd64.deb and tsgw-<v>-linux-x86_64.tar.gz, with a sandboxed systemd unit (packaging/linux/tsgw.service; /etc/tsgw config, /var/lib/tsgw state) and dependencies of its own (no GUI libraries). docs/gateway-admin.md has an Install section. Fixes: - package-windows: makensis on Windows found no file through "D:/a/..." paths; pass Windows paths (cygpath -w). - StartupWMClass is the app id, which the app sets as its X11 WM_CLASS (it was the binary name, so desktops could not match the window). - Gradle wrapper download timeout 10 s -> 60 s (slow proxies). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
5.4 KiB
Translations
The UI is translated with Slint's gettext-based translations: strings in
.slint files are marked with @tr(...), extracted into a .pot template,
translated in .po files, and compiled into the binary (Slint's bundled
translations). Nothing is loaded at runtime, so there is no dependency on
GNU gettext (LGPL) and it works the same on Linux, Windows and Android.
Marking strings
In .slint files every user-visible string goes through @tr:
Button { text: @tr("Connect"); }
Text { text: @tr("Connected to {}", server-name); } // arguments: {} or {0} {1}
Text { text: @tr("{n} user online" | "{n} users online" % count); } // plurals
Text { text: @tr("menu" => "Quit"); } // explicit context
- Whole sentences with placeholders, never concatenated fragments: word
order differs between languages. Use
{0},{1}when there are several arguments, so translators can reorder them. - Plurals always with the
|/%form, even if English only needs two forms; other languages have more. - Not translated: nicknames, channel and server names, chat text, protocol identifiers, the product name, log messages.
- By default the context of a string is the name of the component it is in,
so the same English word can be translated differently in different
places. Renaming a component therefore invalidates its translations until
they are merged again (
msgmergekeeps them as fuzzy).
Strings produced in Rust (error messages, notification texts, status lines)
cannot use @tr. Keep the wording in Slint: an exported global with pure
functions that the Rust code calls, e.g.
export global Strings {
pure public function connection-lost(reason: string) -> string {
return @tr("Connection lost: {}", reason);
}
}
let text = window.global::<Strings>().invoke_connection_lost(reason.into());
Errors from lower layers (protocol, IO) are shown as details after a translated sentence; they stay in English.
Files
crates/voelin-ui/lang/
voelin-ui.pot template, generated
de/LC_MESSAGES/voelin-ui.po one directory per language (gettext locale name)
pt_BR/LC_MESSAGES/voelin-ui.po
The file name is the translation domain, which is the crate name
(voelin-ui); Slint's build looks for lang/<lang>/LC_MESSAGES/<crate>.po.
Workflow
Tools (developer machines only): cargo install slint-tr-extractor, and
GNU gettext for msgmerge / msginit (gettext package; on Windows from
MSYS2 or Git for Windows' bundled tools).
# 1. Extract the template after changing strings
slint-tr-extractor --package-name voelin-ui crates/voelin-ui/ui/*.slint -o crates/voelin-ui/lang/voelin-ui.pot
# 2. Update every translation (new strings empty, changed ones fuzzy)
for po in crates/voelin-ui/lang/*/LC_MESSAGES/voelin-ui.po; do
msgmerge --update --backup=none "$po" crates/voelin-ui/lang/voelin-ui.pot
done
# 3. Start a new language
mkdir -p crates/voelin-ui/lang/de/LC_MESSAGES
msginit --no-translator --locale=de --input=crates/voelin-ui/lang/voelin-ui.pot \
--output-file=crates/voelin-ui/lang/de/LC_MESSAGES/voelin-ui.po
Translators edit the .po files (Poedit, Lokalize, or a hosted service
such as Weblate pointed at crates/voelin-ui/lang). Fuzzy and untranslated
entries fall back to English. Run the extraction when strings change and
before each release (string freeze, see release.md). The
template carries a creation date and source line numbers, so CI does not
compare it exactly; a stale template only means new strings are not
translatable yet.
Bundling and language selection
crates/voelin-ui/build.rs compiles the translations into the binary:
slint_build::compile_with_config(
"ui/app.slint",
slint_build::CompilerConfiguration::new()
.with_style("fluent-dark".into())
.with_bundled_translations("lang"),
)
slint-build tracks the .po files, so edits rebuild. It fails ("No
translations found") while lang/ has no .po file yet, so enable it
together with the first language.
At startup Slint picks the translation matching the system locale (exact
match such as pt_BR first, then the language pt), English otherwise. A
language setting in the app (stored in the settings, "System" by default)
calls slint::select_bundled_translation("de") after the window has been
created; "" or "en" selects English. Changing it takes effect
immediately for all @tr strings.
The desktop app (voelin-ui) and the Android app share the .slint files and
therefore the translations. Texts outside Slint need their own mechanism:
- Android system texts (foreground service notification, permission
rationale): Android string resources in
android/app/src/main/res/values-<lang>/. - Desktop file and AppStream metainfo: translated with
itstool/msgfmt --desktop/msgfmt --xmlfrom.pofiles when there are translations for the app itself.
Checks
- A pseudo-translation catches unmarked strings and truncation: create a
test language (e.g.
lang/eo/) withmsgenfrom the template, replace the texts with longer accented versions, and select it with the language setting (orLANG=eo.UTF-8on Linux). - Test at least one language with longer words (German) and one with a different script (Russian) on every screen before a release (manual matrix row GE7).
- Dates and numbers are formatted in Rust; use unambiguous formats (ISO dates, 24-hour times) until there is locale-aware formatting.