fix(rtl): the preview's frame data keeps its fields in order; charts keep European digits
The right-to-left separator broke the frame data over the preview, a left-to-right
island: after the localized time ("6:03:41 م") the shutter's number read as part
of the previous field and swapped places with the dot. Fields shown in such an
island now use Loc.IslandSeparator, with left-to-right marks in right-to-left
languages. Charts formatted text with the UI culture's digit substitution, so a
number after Arabic words came out in Arabic-Indic digits there only; they now
draw European digits like every text block. The direction marks in source are
written as escapes instead of invisible characters.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
11 files changed
+39
-16
No files matched your search
@@ -199,7 +199,9 @@ run as server jobs whose progress comes from the events.
|
||||
islands on the smallest element holding them; directional icons mirror by themselves (`IconData.IsDirectional`,
|
||||
overridden per subtree with `Bidi.IsDirectional`); left-to-right fragments inside a right-to-left sentence go
|
||||
through `BidiText`. Fields of a meta line are joined with `Loc.Separator`, never a literal " · ": in a
|
||||
right-to-left language it holds right-to-left marks, so a number after a Latin field keeps to its own field.
|
||||
right-to-left language it holds right-to-left marks, so a number after a Latin field keeps to its own field. Fields
|
||||
shown inside a left-to-right island (the frame data over the preview) use `Loc.IslandSeparator`, which holds
|
||||
left-to-right marks instead. Charts draw digits as European ones, like every text block.
|
||||
- The language switches without restart: computed properties re-read through `LocalizedViewModel`, and a view model
|
||||
that keeps texts in objects (chart series and legends, rows, cached sentences) makes them again in
|
||||
`OnLanguageChanged`.
|
||||
|
||||
+2
-1
@@ -122,7 +122,8 @@ commits follow Conventional Commits (release notes are generated from them by `T
|
||||
the Jobs rows, the editor's chart legends and summaries, Auto chips and info line, the Archive figures and the
|
||||
Import session table now follow at once.
|
||||
- Right-to-left: in meta lines a number after a Latin field ("Canon EOS R5 · 2 h") joined the Latin run and split
|
||||
its own field; fields are now separated with right-to-left marks. Desktop file sizes use the language's units.
|
||||
its own field; fields are now separated with right-to-left marks (left-to-right ones in the preview's frame data).
|
||||
Charts no longer switch to Arabic-Indic digits after Arabic words. Desktop file sizes use the language's units.
|
||||
- CI: a full artifact storage failed jobs whose checks had passed; uploads no longer fail a job, artifacts expire in
|
||||
days, and screenshots reach their branch through the cache.
|
||||
- Release workflow: signing and the public-repository publish never ran (step conditions cannot read the step's own
|
||||
|
||||
@@ -238,6 +238,7 @@ One line per decision: date · decision · alternative · reason.
|
||||
| 2026-10-06 | The regression test fills its server's log with about 2 MB up front, then logs one line about every 1 ms through the server's FileLoggerProvider only, on a LongRunning thread | A tight logging loop through ILoggerFactory (my first two versions) | The engine log sink is process-wide, so a console or file-lock flood stalled another test's job engine. The throttled version still reproduces the bug in 10 of 10 runs against the old endpoint. |
|
||||
| 2026-10-06 | Heartbeat test: count the claims the server answered with a DelegatingHandler, then wait for a later beat with a 30 s deadline | Keep the sleeps and widen the 400 ms window | It removes the timing assumption both ways (a false failure on a slow runner, and a false pass on the claim's own touch). It also proves no claim moved the beat. |
|
||||
| 2026-10-11 | Fields of a meta line are joined with `Loc.Separator`: " · " in left-to-right languages, " · " between right-to-left marks in right-to-left ones (`Loc.SeparatorOf(culture)` for texts built in another language) | Unicode isolates (FSI/PDI) around each field, or a left-to-right island for every meta line | WPF's bidi predates the isolates; without a strong right-to-left character before it, a number after a Latin field ("Canon EOS R5 · 2 h") joins the Latin run (rule W7) and splits its own field; islands would read the fields in left-to-right order. |
|
||||
| 2026-10-12 | Fields shown in a left-to-right island are joined with `Loc.IslandSeparator` (" · " between left-to-right marks in right-to-left languages); charts format text with European digits | The reading-direction separator everywhere; the culture's digit substitution in charts | In the preview's frame data a localized time ends in a right-to-left mark ("6:03:41 م"), so the next field's number read as part of it and swapped places with the dot; with the UI culture, chart text after Arabic words drew Arabic-Indic digits while every text block shows European ones. |
|
||||
| 2026-10-11 | `LocalizedViewModel.OnLanguageChanged` is the hook for texts kept in objects: the editor makes its tabs' charts, Auto chips, markers and info line again; Jobs refreshes rows, chips and the job bar; Archive reads again; Import rebuilds its session table and device list | Re-create every section after a language switch, or ask for a restart | BRIEF §16 switches language without restart; a running job's bar line and an open editor's legend otherwise stayed in the old language until their next change. |
|
||||
| 2026-10-11 | Desktop sizes use the `Common.Size.*` formats, like the Setup and the Uploader | Hard-coded B, KB, MB, GB, TB, PB | Several languages write the units in their own script or words (КБ, bayt, كيلوبايت); every UI string is a resource. |
|
||||
| 2026-10-11 | CI artifact uploads continue on error with short retention (test results 7 days, Windows programs 3); screenshots reach the screenshots job through the Actions cache | Keep failing jobs on a full artifact storage, or push the screenshots from the build job | A full storage quota failed jobs whose checks had passed; the cache has its own limit, and the build job keeps its read-only token. |
|
||||
@@ -89,7 +89,8 @@ public static class EditorText
|
||||
if (frame.FNumber is > 0 and var f) parts.Add(Loc.L("Editor.Shot.Aperture", Number(f)));
|
||||
if (frame.Iso is > 0 and var iso) parts.Add(Loc.L("Editor.Shot.Iso", iso));
|
||||
if (frame.FocalLength is > 0 and var mm) parts.Add(Loc.L("Editor.Shot.Focal", Number(mm)));
|
||||
return string.Join(Separator, parts);
|
||||
// Shown over the photo, a left-to-right island.
|
||||
return string.Join(Loc.IslandSeparator, parts);
|
||||
}
|
||||
|
||||
/// <summary>"0413 / 3,600".</summary>
|
||||
|
||||
@@ -889,7 +889,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
{
|
||||
var settings = plan.Setup.Encoder.Settings;
|
||||
var position = plan.Setup.Plan.DurationSeconds * CurrentIndex / double.Max(1, FrameCount - 1);
|
||||
InfoText = string.Join(Loc.Separator, EditorText.Position(CurrentIndex, FrameCount),
|
||||
InfoText = string.Join(Loc.IslandSeparator, EditorText.Position(CurrentIndex, FrameCount),
|
||||
Loc.L("Editor.Preview.OutputTime", EditorText.Clock(position), EditorText.Clock(plan.Setup.Plan.DurationSeconds)),
|
||||
Loc.L("Editor.Preview.OutputSize", EditorText.Size(settings.Width, settings.Height)));
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace Titano.App.Import;
|
||||
/// </summary>
|
||||
public static class BidiText
|
||||
{
|
||||
private const char LeftToRightEmbedding = '';
|
||||
private const char PopDirectionalFormatting = '';
|
||||
private const char LeftToRightEmbedding = '\u202A';
|
||||
private const char PopDirectionalFormatting = '\u202C';
|
||||
|
||||
/// <summary><paramref name="text"/> kept left to right in a right-to-left UI language; unchanged otherwise.</summary>
|
||||
public static string Ltr(string text) =>
|
||||
|
||||
@@ -62,5 +62,5 @@ public static class Formatting
|
||||
/// A path, address or fingerprint kept left to right inside right-to-left text (a Unicode left-to-right embedding),
|
||||
/// so its separators and digits stay in place; it reads unchanged in left-to-right languages.
|
||||
/// </summary>
|
||||
public static string LeftToRight(string text) => "" + text + "";
|
||||
public static string LeftToRight(string text) => "\u202A" + text + "\u202C";
|
||||
}
|
||||
@@ -33,7 +33,14 @@ public static class Loc
|
||||
public static string Separator => SeparatorOf(_culture);
|
||||
|
||||
/// <summary><see cref="Separator"/> of <paramref name="culture"/>, for texts built in a language other than the UI's.</summary>
|
||||
public static string SeparatorOf(CultureInfo culture) => culture.TextInfo.IsRightToLeft ? " · " : " · ";
|
||||
public static string SeparatorOf(CultureInfo culture) => culture.TextInfo.IsRightToLeft ? "\u200F · \u200F" : " · ";
|
||||
|
||||
/// <summary>
|
||||
/// Separator of fields shown in a left-to-right island (the frame data over the preview). In a right-to-left language
|
||||
/// it sits between left-to-right marks: after a field that ends in that language (a time with its "PM" mark) the next
|
||||
/// number would otherwise read as part of it and change places with the dot.
|
||||
/// </summary>
|
||||
public static string IslandSeparator => IsRightToLeft ? "\u200E · \u200E" : " · ";
|
||||
|
||||
public static void SetCulture(CultureInfo culture)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
@@ -398,10 +399,16 @@ public abstract class DrawingElement : FrameworkElement
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new DrawingElementAutomationPeer(this);
|
||||
|
||||
/// <summary>
|
||||
/// Digits as the rest of the UI shows them: with the UI culture alone, Arabic text before a number would turn its
|
||||
/// digits into Arabic-Indic ones in charts only.
|
||||
/// </summary>
|
||||
private static readonly NumberSubstitution EuropeanDigits = new(NumberCultureSource.Override, CultureInfo.InvariantCulture, NumberSubstitutionMethod.European);
|
||||
|
||||
private FormattedText Format(string text, double emSize, Brush brush, bool semiBold, FlowDirection direction)
|
||||
{
|
||||
var typeface = semiBold ? _semiBold ??= CreateTypeface(FontWeights.SemiBold) : _regular ??= CreateTypeface(FontWeights.Normal);
|
||||
return new FormattedText(text, Loc.Culture, direction, typeface, emSize, brush, null,
|
||||
return new FormattedText(text, Loc.Culture, direction, typeface, emSize, brush, EuropeanDigits,
|
||||
TextOptions.GetTextFormattingMode(this), VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ public sealed class ArchiveLogicTests
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("he"));
|
||||
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");
|
||||
Assert.Contains("\u200F", year.RowToolTip, "right-to-left marks keep the year and its figures apart");
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -9,20 +9,24 @@ namespace Titano.Core.Tests.Localization;
|
||||
public sealed class LocTests
|
||||
{
|
||||
[Test]
|
||||
public void FieldSeparatorHoldsRightToLeftMarksOnlyInRightToLeftLanguages()
|
||||
public void FieldSeparatorsHoldDirectionMarksOnlyInRightToLeftLanguages()
|
||||
{
|
||||
var before = Loc.Culture;
|
||||
try
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||
Assert.Equal(" · ", Loc.Separator);
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("it"));
|
||||
Assert.Equal(" · ", Loc.Separator);
|
||||
foreach (var culture in new[] { "en", "it" })
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo(culture));
|
||||
Assert.Equal(" · ", Loc.Separator);
|
||||
Assert.Equal(" · ", Loc.IslandSeparator);
|
||||
}
|
||||
foreach (var culture in new[] { "ar", "he" })
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo(culture));
|
||||
// A strong right-to-left character on each side: a number after a Latin field stays in its own field.
|
||||
Assert.Equal(" · ", Loc.Separator);
|
||||
Assert.Equal("\u200F · \u200F", Loc.Separator);
|
||||
// In a left-to-right island, strong left-to-right ones: a number after a time with its "PM" mark stays in its own field.
|
||||
Assert.Equal("\u200E · \u200E", Loc.IslandSeparator);
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in new issue
Block a user