Skip to content

Move Chardonnay UI text into a resource file for translation - #2166

Open
Dominik-O22 wants to merge 11 commits into
rmcrackan:masterfrom
Dominik-O22:i18n-strings
Open

Dominik-O22 wants to merge 11 commits into
rmcrackan:masterfrom
Dominik-O22:i18n-strings

Conversation

@Dominik-O22

@Dominik-O22 Dominik-O22 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Libation's UI text is hardcoded English, so a volunteer translator has nothing to plug a translation into (#342, #2160). This moves Chardonnay's UI text into LibationUiBase/Resources/Strings.resx, as discussed in #342, for a dedicated prerelease.

  • 931 strings move into Strings.resx with a generated Strings class. XAML reads {x:Static res:Strings.Key} and C# reads Strings.Key. A translation is a Strings.<culture>.resx next to it.
  • The first commit is codemod output with no hand edits. If master moves, I regenerate it on the new master instead of rebasing.
  • Settings labels and enum names live in [Description] attributes. SettingsText reads translated copies from Strings, and a test keeps their English equal to the attributes. The status bar line and counts like "3 books" now come from Strings too.
  • Dialogs sized for English now wrap or widen instead of cutting text off or pushing buttons off the window. The settings tabs can wrap to a second row.
  • Settings > Important gets a Language picker. Classic and the CLI stay English. The crash handler keeps literal text, and the language is applied outside Main, so an interrupted upgrade still reaches the ISSUE: LIBATION START UP CRASH #2001 recovery.

docs/development/translations.md explains adding UI text and adding a language, and lists what is not translated yet: mainly messages built outside LibationUiBase, settings tooltips and the naming template tags. The RPM script now packages the per-language folders that translations add. Before, the first one would have failed the RPM build.

Behavior notes: the <ui> naming tag follows the chosen display language. A returning user who picks an existing Libation folder during setup sees their saved language from the next start.

Evidence:

  • Every rewritten call site reads back identical to the original literal, and 8 dialogs render pixel-identical to master. The layout fixes leave every window pixel-identical in English, apart from sub-pixel shifts on three labels.
  • With a pseudo-translation 1.3 to 2 times longer, an overflow check finds no cut-off text outside grid headers.
  • Both UIs and the CLI build, and all test projects pass. The app starts with the translated UI when a language is saved.

Reviewed with review-loop: 6 rounds with Claude Opus. Verdict: approved

🤖 Generated with Claude Code

Dominik-O22 and others added 11 commits November 17, 2026 10:38
User-facing text in LibationAvalonia and LibationUiBase now lives in
LibationUiBase/Resources/Strings.resx, with a generated public Strings
class. XAML reads it through {x:Static res:Strings.Key} and C# through
Strings.Key. Interpolated text becomes string.Format with the same holes.
Shared constants become get-only properties so they can read a resource.

The crash handler (Program.cs) and its dialog (MessageBoxAlertAdminDialog)
keep their literal text. After an interrupted upgrade they can run against
an older LibationUiBase.dll with no Strings class, and must still show the
error and roll back (rmcrackan#2001).

English output is unchanged. This commit is generated by a codemod and
contains no hand edits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
These strings had other strings nested inside them, or sat in XAML
element content, so they are moved by hand. Sentences built from
fragments ("this 1 book", "Book"/"Books") get one resource per form so
a translator sees whole sentences.

The walkthrough finds Chardonnay's settings tabs by their header text, so
it now looks them up through the same resources as the headers. The PDF
variant of the liberated status dialog gets its own title instead of a
string replace that would miss once the title is translated.

LibationUiBase.Tests asserts English text, so it reads the resources in
English whatever the machine's language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chardonnay follows the system language by default. Settings > Important
gets a Language picker next to Theme, listing English and every
translation shipped next to the app. The choice is applied once at
startup, so it takes effect on the next start.

Classic is not translated, so it pins the shared text to English to
match its forms.

Both run in a non-inlined helper after the upgrade recovery check, so
Main itself names no new LibationUiBase type. An interrupted upgrade that
left an older LibationUiBase.dll behind still reaches recovery (rmcrackan#2001).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both still assembled English words ("account"/"accounts", "it"/"them")
into a translated sentence. Each count now gets its own sentence. English
output is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Translations run longer than English, and several dialogs were sized for
English. With German-length text the Trash Bin's Restore button left the
window, the settings tabs wrapped over the page, Setup cut off its intro
text, and Clear Finished and Copy Log Entries were cut off in the queue.

Rows that ran off the edge now wrap (WrapPanel, TextWrapping), and two
fixed-size dialogs widen to fit their content once open. English renders
pixel-identical to before, apart from sub-pixel shifts on three labels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three kinds of Chardonnay text bypassed Strings and stayed English in
any language:

- Settings labels and enum names come from [Description] attributes in
  LibationFileManager, which can't reference LibationUiBase. They now go
  through SettingsText, which reads a Strings copy named after the
  setting or enum member and falls back to the attribute. A test keeps
  each copy's English equal to its attribute.
- Counts like "3 books" were built from English nouns. Counted words
  them from Strings, one form for exactly one and one for the rest.
- The status bar line was built in ApplicationServices. It now comes from
  LibraryStatsText in LibationUiBase, for both UIs, with tests pinning
  the English to what it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The resx reader keeps the line breaks inside a value as they are in the
file. A Windows checkout with core.autocrlf turned the file's LF into
CRLF, so every multi-line string gained a carriage return on Windows
builds, which SettingsTextTests caught on CI. Checking the branch out
with core.autocrlf=true reproduced it on Linux; with this attribute the
same checkout stays LF and the tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Translations ship as per-language folders next to the app (de/,
pt-BR/). Bundle_Redhat.sh copied files only but listed every entry in
%files, so the first such folder would have failed the RPM build with
"File not found". Folders are now copied in all three places, skipping
the build folder and BUILDROOT that RPM 4.20+ keeps there.

Checked with a fake publish folder holding de/: rpmbuild 4.18 on
Ubuntu 24.04 (what CI uses) builds and the package contains
de/LibationUiBase.resources.dll. On Fedora (RPM 6.1) both new copy steps
run; the build then stops at the same check-buildroot error master
already hits there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/development/translations.md covers adding UI text, adding a
language, and the known gaps. AGENTS.md gets a short pointer so new text
lands in Strings.resx instead of inline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review found the docs overstated two things. The crash dialog's log
paragraph does go through Strings (via CrashLogMessage, which old
installs already have), so the rule is about naming types new to
LibationUiBase, not about Strings use. SettingsTextTests only checks the
enum types it lists. The docs now say so, list settings tooltips and help
text as untranslated, and name the tab correctly. Six format strings get
the comment saying what their {0} is.

RPM 4.20+ also keeps SPECPARTS in the build folder, so the folder copy
skips it as well as BUILDROOT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI's Ubuntu 26.04 runner has RPM 6, which names the build folder after a
sanitized version (14.3.0_rc.1 for 14.3.0~rc.1), so matching
'%{name}-%{version}-build' missed it and cp tried to copy the folder into
itself. `! -samefile .` excludes it whatever it is called.

Checked in podman with version 14.3.0~rc.1 on ubuntu:26.04 (RPM 6.0.1)
and ubuntu:24.04 (RPM 4.18), each with and without a de/ folder: all four
build, and de/LibationUiBase.resources.dll is in the package when present.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant