fix(app): every window follows the reading direction; live regions and left-to-right text

Windows created after the language was applied (the main window at start, every
dialog) now take FlowDirection from the current culture when they load, so an
Arabic or Hebrew UI stays mirrored after a restart and in dialogs. Adds
LiveRegion.Text (announces status changes to screen readers) and
Formatting.LeftToRight (keeps paths, addresses and fingerprints in order inside
right-to-left text).

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-03 17:23:33 +00:00
1 parent 6e01995f7e
commit baf3c6bddd
3 files changed
+48 -2

No files matched your search

+10 -2
View File
@@ -7,6 +7,15 @@ namespace Titano.App.Infrastructure;
/// <summary>Switches the UI language at run time without restart (BRIEF §16), mirroring right-to-left languages.</summary>
public static class UiLanguage
{
static UiLanguage()
{
// Windows created later (the main window at start, every dialog) take the reading direction when they load.
EventManager.RegisterClassHandler(typeof(Window), FrameworkElement.LoadedEvent, new RoutedEventHandler((sender, _) => ((Window)sender).FlowDirection = Direction));
}
/// <summary>The reading direction of the current language.</summary>
public static FlowDirection Direction => Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
/// <summary>Applies <paramref name="code"/> (or the OS language when null) and returns the culture in use.</summary>
public static CultureInfo Apply(string? code)
{
@@ -25,8 +34,7 @@ public static class UiLanguage
Loc.SetCulture(culture);
if (Application.Current is { } app)
{
foreach (Window window in app.Windows)
window.FlowDirection = Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
foreach (Window window in app.Windows) window.FlowDirection = Direction;
}
return culture;
}