diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-15 12:37:41 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-15 12:37:41 +0200 |
| commit | 5a3f827a01d1902a0dadc5debb4200138d4af885 (patch) | |
| tree | 5b00207aefccf625a54ac4b928a05561d1a0fff1 /README.md | |
| parent | 8e7208dc771bc9344f583442ad58cdd5b4178233 (diff) | |
| download | qtmaildir-5a3f827a01d1902a0dadc5debb4200138d4af885.tar.gz qtmaildir-5a3f827a01d1902a0dadc5debb4200138d4af885.zip | |
feat(i18n): wire translations and ship an Italian one (item 22)
Nothing loaded a translation before this: no QTranslator, no .ts file and
no build rule, so every string was English whatever the locale said. The
language now comes from the environment, LANG=it_IT.UTF-8, and any other
locale runs in English as before.
The audit found that the tr() discipline was largely holding, and found
eight strings that could never be translated into any language. kFields[]
in tagrulesdialog.cpp declared the rule-builder field labels with
QT_TR_NOOP inside an anonymous namespace, where lupdate reports "tr()
cannot be called without context" and extracts nothing, while the use site
calls TagRulesDialog::tr() on them at runtime. From, To, Cc, Subject, Tag,
Folder, Attachment and Date: the whole vocabulary of the rule builder,
absent from every translation file that could ever exist. The source
compiles and reads correctly; only lupdate reveals it.
Q_DECLARE_TR_FUNCTIONS is not the fix for that case, though it is the fix
for a free function calling tr(). Measured against lupdate: a class
carrying the macro beside the array still extracts 0 strings, because the
context must be attached to the literal itself. QT_TRANSLATE_NOOP names it
explicitly and matches the tr() that already reads them, so the use site
needed no change.
Twenty configuration and keybinding warnings were not translatable either.
They are user-facing, reaching the status label and the "Configuration
problems" dialog. Config already had the tr() macro; KeyMap needed it.
Translating the filter labels then broke startup_query, found in hand
testing: a filter's name is a translated label, so `startup_query = Inbox`
matched nothing where the filter shows as "In arrivo". The application
opened a different view and reported the user's own working config as
invalid. Resolution matches the generator as well now, which is stored in
queries.json and identical in every locale; the translated name still
works. The regression test installs a real QTranslator rather than a stub,
since the bug lives in the gap between the stored string and the displayed
one, and it writes a queries.json because the warning it asserts on is
guarded by a non-empty saved-query list: without one the branch never runs
and the test passes against a broken check.
main.cpp's --help and --version stay bare printf, as they run before
QApplication exists and no translator could serve them.
Verified per the backlog's own standard, that lupdate output is the
evidence rather than reading: 355 strings extracted with zero context
warnings, where before there were 327 with eight; lrelease reporting 355
finished and 0 unfinished; the built .qm loaded in a standalone probe
printing "From -> Da" and both Italian plural forms; and the install rule
placing it where main.cpp looks. test_translations guards it and was
mutation checked, failing on an emptied translation and naming the defect
when QT_TRANSLATE_NOOP is reverted.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -67,6 +67,33 @@ to produce nothing that ships: cmake -S . -B build -DQTMAILDIR_BUILD_TESTS=OFF ``` +### Translations + +qtmaildir ships an Italian translation. The language is taken from the +environment, so there is no configuration key of its own: + +```bash +LANG=it_IT.UTF-8 qtmaildir +``` + +Any other locale runs the application in English, which is also what happens +when the compiled translation is missing. + +`translations/qtmaildir_it_IT.ts` is tracked in git; the `.qm` it compiles to +is generated at build time and is not. Building needs Qt6's `LinguistTools`, +and a build without them is English-only rather than broken. + +Adding a language means copying the `.ts`, translating it, and adding it to +`src/CMakeLists.txt` beside the Italian one. After changing any user-facing +string, refresh the `.ts` so the new string is there to translate: + +```bash +lupdate-qt6 src/ -ts translations/qtmaildir_it_IT.ts -no-obsolete -locations none +``` + +`ctest -R translations` fails on a string that is missing a translation, and on +one that `lupdate` cannot extract at all. + ### Slackware package `assets/slackbuild/` holds a SlackBuild. It follows SBo conventions, with two @@ -277,6 +304,11 @@ would have meant hand-rolling a parser. They now follow the file. filters, so it can name either; yours wins if both carry the same name. A name matching neither falls back to the **Unread** filter. +A built-in filter can be named either by its English name (`Inbox`) or by the +name shown in your own language (`In arrivo`). The English one is the safer +choice: it is the filter's identity rather than its label, so a config written +that way keeps working whatever `LANG` is set to. + ### Sent mail A **Sent** button appears beside the saved queries once at least one account |
