fix(i18n): texts kept by view models follow a language switch; right-to-left meta lines keep their fields

A language switch re-read computed properties only: the job bar of a running job,
the Jobs rows, the editor's chart legends and summaries, Auto chips, markers and
info line, the Archive figures and the Import session table kept the old language
until their next change. LocalizedViewModel gains OnLanguageChanged, where each of
them makes those texts again.

Meta lines joined their fields with a plain " · ": in Arabic or Hebrew a number
after a Latin field ("Canon EOS R5 · 2 h") joined the Latin run and split its own
field. Loc.Separator puts right-to-left marks around the dot in right-to-left
languages and is used for every such line. Desktop file sizes use the Common.Size
formats, as the Setup and the Uploader do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-11 23:47:03 +00:00
1 parent 3d225da40e
commit 0a513fb213
46 files changed
+191 -58

No files matched your search

@@ -258,7 +258,8 @@ public sealed class ArchiveLogicTests
try
{
Loc.SetCulture(CultureInfo.GetCultureInfo("he"));
Assert.Equal(Loc.L("Tooltips.Archive.YearRowRtl", "2026 · " + year.Detail), year.RowToolTip, "the arrow keys of a mirrored tree");
Assert.Equal(Loc.L("Tooltips.Archive.YearRowRtl", "2026" + Loc.Separator + year.Detail), year.RowToolTip, "the arrow keys of a mirrored tree");
Assert.Contains("‏", year.RowToolTip, "right-to-left marks keep the year and its figures apart");
}
finally
{
@@ -126,7 +126,7 @@ public sealed class ArchiveScreenSmokeTests
await ArchiveScenes.ShowAsync(app.Shell, "overview");
Assert.Equal(12.ToString("N0", Loc.Culture), archive.MonthLabels[^1], "Arabic month names have no initials: the columns are numbered");
var year = archive.TreeRows[1];
Assert.Equal(Loc.L("Tooltips.Archive.YearRowRtl", year.Title + " · " + year.Detail), year.RowToolTip, "the tooltip names the mirrored arrow keys");
Assert.Equal(Loc.L("Tooltips.Archive.YearRowRtl", year.Title + Loc.Separator + year.Detail), year.RowToolTip, "the tooltip names the mirrored arrow keys");
await app.ExpectAsync<ArchiveView>("archive-overview-ar");
// The dialogs' templates exist once they are laid out: render first, then look inside.
@@ -142,6 +142,21 @@ public sealed class EditorSmokeTests
Assert.Equal(editor.Session.Content.SourceWidth, ((BitmapSource)editor.PreviewImage!).PixelWidth, "1:1 shows source pixels");
editor.ZoomMode = PreviewZoomMode.Fit;
// A language switch makes again what the tabs keep in objects: the chart legend and the Auto chips follow at once.
var chip = editor.Exposure.Rows.OfType<AutoSwitchRow>().First();
var english = chip.AutoText;
UiLanguage.Apply("it");
try
{
Assert.True(editor.Exposure.Legend.Any(i => i.Text == "luminanza misurata"), "the legend follows the language");
Assert.Equal(Loc.L("Common.Auto") + Loc.Separator + Loc.L(chip.IsOn ? "Editor.Value.On" : "Editor.Value.Off"), chip.AutoText);
Assert.NotEqual(english, chip.AutoText);
}
finally
{
UiLanguage.Apply("en");
}
// An edit through the session is undone and redone (Ctrl+Z / Ctrl+Y run the same commands).
ThemeManager.Apply(AppTheme.Dark);
var before = editor.Session.Project.Exposure.ExposureOffsetEv;
@@ -3,6 +3,7 @@ using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Titano.App.Infrastructure;
using Titano.App.Jobs;
using Titano.App.Sections;
using Titano.App.Shell;
@@ -70,6 +71,20 @@ public sealed class JobsScreenSmokeTests
}
var actionColumns = rows.Select(r => Left(Descendants<ItemsControl>(r.Item).Last())).ToList();
Assert.True(actionColumns.Max() - actionColumns.Min() < 1, "the actions column starts at the same x in every row");
// A language switch reaches the job bar at once, not at the job's next progress report.
var bar = shell.JobText;
Assert.True(shell.IsJobActive, "the sample runs a job");
UiLanguage.Apply("it");
try
{
Assert.NotEqual(bar, shell.JobText, "the job bar follows the language");
}
finally
{
UiLanguage.Apply("en");
}
Assert.Equal(bar, shell.JobText);
});
private static TextBlock Text(ScreenSmokeTests.SampleApp app, string text) => app.FindAll<TextBlock>().First(t => t.Text == text && t.IsVisible);