Repository navigation
Move Chardonnay UI text into a resource file for translation - #2166
Open
Dominik-O22 wants to merge 11 commits into
Open
Dominik-O22 wants to merge 11 commits into
Dominik-O22 wants to merge 11 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.Strings.resxwith a generatedStringsclass. XAML reads{x:Static res:Strings.Key}and C# readsStrings.Key. A translation is aStrings.<culture>.resxnext to it.[Description]attributes.SettingsTextreads translated copies fromStrings, and a test keeps their English equal to the attributes. The status bar line and counts like "3 books" now come fromStringstoo.Main, so an interrupted upgrade still reaches the ISSUE: LIBATION START UP CRASH #2001 recovery.docs/development/translations.mdexplains 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:
Reviewed with review-loop: 6 rounds with Claude Opus. Verdict: approved
🤖 Generated with Claude Code