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:
46 files changed
+191
-58
No files matched your search
@@ -198,7 +198,11 @@ run as server jobs whose progress comes from the events.
|
||||
screens never set `FlowDirection` for the language. Photos, charts, numbers, paths and templates are left-to-right
|
||||
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`.
|
||||
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.
|
||||
- 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`.
|
||||
- Radio buttons group by their parent panel. `GroupName` is shared by every window whose visual root is not known
|
||||
yet, so it is used only where the bindings are one-way (chips generated by item templates, the rail).
|
||||
- Content a control presents through its template from a dependency property other than `Content` is made a logical
|
||||
|
||||
@@ -118,6 +118,13 @@ commits follow Conventional Commits (release notes are generated from them by `T
|
||||
stayed disabled; the explicit dry run now cancels it.
|
||||
- Radio groups leaked between windows not shown yet (the Setup's capture overflowed the stack); screenshots of
|
||||
right-to-left windows were mirrored twice.
|
||||
- Switching the language left texts kept by view models in the old language until their next change: the job bar,
|
||||
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.
|
||||
- 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
|
||||
secrets); the publish job lacked the .NET SDK for `make-icon`; re-publishing an existing tag failed; the portable
|
||||
zip lacked `portable.txt`.
|
||||
|
||||
@@ -237,3 +237,7 @@ One line per decision: date · decision · alternative · reason.
|
||||
| 2026-10-06 | Log download: reuse FileResponses.Serve (fixed-length, range-capable FileSlice) with the length listed at request time | Copy the log to a temp file first, or stream to EOF without a Content-Length | It reuses an existing facility, keeps Range resume working, has no extra I/O, and the response stays self-consistent while the logger keeps appending. |
|
||||
| 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-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. |
|
||||
@@ -52,7 +52,7 @@ public static class ArchiveFigures
|
||||
new(Formatting.Count(stats.Photos), Loc.Plural("Archive.Tile.Photos", stats.Photos)),
|
||||
new(Formatting.Count(stats.Sequences), Loc.Plural("Archive.Tile.Sequences", stats.Sequences)),
|
||||
new(Formatting.Bytes(stats.Bytes), Loc.L("Archive.Tile.Originals")),
|
||||
new(Formatting.Count(cameras), Loc.Plural("Archive.Tile.Cameras", cameras) + " · " + Loc.Plural("Archive.Tile.Formats", stats.ByFormat.Count)),
|
||||
new(Formatting.Count(cameras), Loc.Plural("Archive.Tile.Cameras", cameras) + Loc.Separator + Loc.Plural("Archive.Tile.Formats", stats.ByFormat.Count)),
|
||||
new(range, Loc.L("Archive.Tile.Pending", Formatting.Count(stats.Health.NotAnalyzed), Formatting.Count(stats.Health.Unverified))),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public sealed class ArchiveTreeRowViewModel(ArchiveTreeNode node, ArchiveAvailab
|
||||
{
|
||||
get
|
||||
{
|
||||
var text = Title + " · " + Detail;
|
||||
var text = Title + Loc.Separator + Detail;
|
||||
return IsYear ? Loc.L(Loc.IsRightToLeft ? "Tooltips.Archive.YearRowRtl" : "Tooltips.Archive.YearRow", text) : text;
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public sealed class HealthLineViewModel(HealthLine line, ICommand? fix) : Observ
|
||||
public sealed class DuplicateRowViewModel(DuplicateRow row, ICommand open, ICommand reveal) : ObservableObject
|
||||
{
|
||||
public DuplicateRow Row { get; } = row;
|
||||
public string Places => string.Join(" · ", Row.Places);
|
||||
public string Places => string.Join(Loc.Separator, Row.Places);
|
||||
public ICommand OpenCommand { get; } = open;
|
||||
public ICommand RevealCommand { get; } = reveal;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public sealed class ArchiveTree
|
||||
node.Add(new ArchiveTreeNode(TreeNodeKind.Sequence, s.Id.ToString("N"), 2)
|
||||
{
|
||||
Title = s.DisplayTitle,
|
||||
Detail = Loc.Plural("Shell.Status.Photos", s.FrameCount) + " · " + Formatting.Bytes(s.TotalBytes),
|
||||
Detail = Loc.Plural("Shell.Status.Photos", s.FrameCount) + Loc.Separator + Formatting.Bytes(s.TotalBytes),
|
||||
Sequence = s,
|
||||
});
|
||||
}
|
||||
@@ -126,5 +126,5 @@ public sealed class ArchiveTree
|
||||
}
|
||||
|
||||
private static string Summary(IReadOnlyCollection<Sequence> sequences) =>
|
||||
Loc.Plural("Shell.Status.Sequences", sequences.Count) + " · " + Formatting.Bytes(sequences.Sum(s => s.TotalBytes));
|
||||
Loc.Plural("Shell.Status.Sequences", sequences.Count) + Loc.Separator + Formatting.Bytes(sequences.Sum(s => s.TotalBytes));
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public sealed record ArchiveSetFilter(string? Camera = null, StatusFilter Status
|
||||
}
|
||||
|
||||
/// <summary>"Canon EOS R5 · Not analysed · sunset"; empty without a filter.</summary>
|
||||
public string Describe() => string.Join(" · ", new[]
|
||||
public string Describe() => string.Join(Loc.Separator, new[]
|
||||
{
|
||||
Camera ?? string.Empty,
|
||||
Status == StatusFilter.Any ? string.Empty : StatusLabel(Status),
|
||||
|
||||
@@ -17,7 +17,7 @@ public sealed class TrashRowViewModel(TrashEntry entry, ICommand restore)
|
||||
public string Title => Entry.Title;
|
||||
|
||||
/// <summary>"3,600 photos · 96.2 GB · 2026/2026-09-28 Canon EOS R5" (the folder left to right in every language).</summary>
|
||||
public string Detail => string.Join(" · ", Loc.Plural("Shell.Status.Photos", Entry.Frames), Formatting.Bytes(Entry.Bytes), Formatting.LeftToRight(Entry.Folder));
|
||||
public string Detail => string.Join(Loc.Separator, Loc.Plural("Shell.Status.Photos", Entry.Frames), Formatting.Bytes(Entry.Bytes), Formatting.LeftToRight(Entry.Folder));
|
||||
|
||||
/// <summary>"Deleted 02/10/2026 18:04".</summary>
|
||||
public string DeletedText => Loc.L("Archive.Trash.Deleted", Formatting.Date(Entry.DeletedAt) + " " + Formatting.TimeOfDay(Entry.DeletedAt));
|
||||
@@ -65,7 +65,7 @@ public sealed class TrashDialogViewModel : ArchiveDialogViewModel
|
||||
|
||||
/// <summary>"3 sequences · 182 GB", or "The trash is empty".</summary>
|
||||
public string SummaryText => _rows.Count == 0 ? Loc.L("Archive.Trash.Empty")
|
||||
: Loc.Plural("Shell.Status.Sequences", _rows.Count) + " · " + Formatting.Bytes(_rows.Sum(r => r.Entry.Bytes));
|
||||
: Loc.Plural("Shell.Status.Sequences", _rows.Count) + Loc.Separator + Formatting.Bytes(_rows.Sum(r => r.Entry.Bytes));
|
||||
|
||||
/// <summary>Reads the trash of the archive (off the UI thread).</summary>
|
||||
public async Task LoadAsync()
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Titano.App.Editor;
|
||||
/// <summary>The editor's composed texts (header summary, shot data, preset card lines), in the current UI language.</summary>
|
||||
public static class EditorText
|
||||
{
|
||||
private const string Separator = " · ";
|
||||
private static string Separator => Loc.Separator;
|
||||
|
||||
/// <summary>"3,600 frames · Canon EOS R5 · 2 s interval · 2 h 00 m · 3 warnings".</summary>
|
||||
public static string Summary(SequenceContent content, int warnings)
|
||||
|
||||
@@ -814,6 +814,21 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
RequestPreview(immediate: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The UI language changed: what the tabs keep in objects (chart legends and summaries, the Auto chips of the
|
||||
/// settings), the timeline markers and the preview's info line are made again in the new language.
|
||||
/// </summary>
|
||||
protected override void OnLanguageChanged()
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
foreach (var tab in Tabs) tab.OnContentChanged();
|
||||
UpdateMarkers();
|
||||
UpdateInfo();
|
||||
}
|
||||
base.OnLanguageChanged();
|
||||
}
|
||||
|
||||
/// <summary>The first failure of a run of failed saves (they are retried until one succeeds); Retry tries at once.</summary>
|
||||
private void OnSaveFailed(Exception ex) => Shell.ShowToast(new Toast
|
||||
{
|
||||
@@ -874,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(" · ", EditorText.Position(CurrentIndex, FrameCount),
|
||||
InfoText = string.Join(Loc.Separator, 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)));
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ public sealed class ExportTab : EditorTab
|
||||
|
||||
/// <summary>"about 5 min · NVENC"; without this PC's encoder for a server sequence.</summary>
|
||||
public string? EstimatedTime => Estimated is { } plan
|
||||
? Loc.L("Editor.Export.About", Formatting.Duration(plan.Estimate.Time)) + (!Editor.IsRemote && plan.Setup.Encoder.Capability is { } c ? " · " + c.Name : string.Empty)
|
||||
? Loc.L("Editor.Export.About", Formatting.Duration(plan.Estimate.Time)) + (!Editor.IsRemote && plan.Setup.Encoder.Capability is { } c ? Loc.Separator + c.Name : string.Empty)
|
||||
: null;
|
||||
|
||||
public string? ResultName => Editor.Plan?.FileName;
|
||||
|
||||
@@ -187,6 +187,6 @@ public sealed class ExposureTab : EditorTab
|
||||
if (corrections.Report.Deflicker is { FlickerBefore: > 0 } d)
|
||||
parts.Add(Loc.L("Editor.Exposure.FlickerChange", double.Round((d.FlickerAfter / d.FlickerBefore - 1) * 100).ToString("+0;−0;0", Loc.Culture)));
|
||||
if (corrections.Report.MaxTargetStepEv is { } step) parts.Add(Loc.L("Editor.Exposure.MaxStep", step.ToString("0.00", Loc.Culture)));
|
||||
return parts.Count == 0 ? null : string.Join(" · ", parts);
|
||||
return parts.Count == 0 ? null : string.Join(Loc.Separator, parts);
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public sealed class FrameRow(FramesTab owner, Frame frame, int index) : Observab
|
||||
{
|
||||
if ((frame.Flags & flag) != 0) parts.Add(Loc.L("Editor.Frames.Flag." + flag));
|
||||
}
|
||||
return string.Join(" · ", parts);
|
||||
return string.Join(Loc.Separator, parts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public sealed class MotionTab : EditorTab
|
||||
Loc.L("Editor.Motion.CropValue", (shake.CropCost * 100).ToString("0.0", Loc.Culture)),
|
||||
};
|
||||
if (shake.PanDetected) parts.Add(Loc.L("Editor.Motion.PanValue", shake.PanPxPerFrame.ToString("0.0", Loc.Culture)));
|
||||
Summary = string.Join(" · ", parts);
|
||||
Summary = string.Join(Loc.Separator, parts);
|
||||
}
|
||||
|
||||
private static double[] Accumulate(double?[] shifts)
|
||||
|
||||
@@ -187,7 +187,7 @@ public sealed class AutoSwitchRow : SettingRow
|
||||
var project = _session.Project;
|
||||
IsOn = _setting.Effective(project, _session.Content.Deep);
|
||||
IsAuto = _setting.IsAuto(project);
|
||||
AutoText = Loc.L("Common.Auto") + " · " + Loc.L(IsOn ? "Editor.Value.On" : "Editor.Value.Off");
|
||||
AutoText = Loc.L("Common.Auto") + Loc.Separator + Loc.L(IsOn ? "Editor.Value.On" : "Editor.Value.Off");
|
||||
AutoReason = Reason(_session, _setting);
|
||||
}
|
||||
}
|
||||
@@ -273,7 +273,7 @@ public sealed class AutoChoiceRow<T> : AutoChoiceRow
|
||||
Selected = Options.FirstOrDefault(o => Equals(o.Value, value));
|
||||
IsAuto = _setting.IsAuto(project);
|
||||
var auto = _setting.AutoValue(project, _session.Content.Deep);
|
||||
AutoText = Loc.L("Common.Auto") + " · " + (Options.FirstOrDefault(o => Equals(o.Value, auto))?.Label ?? auto.ToString());
|
||||
AutoText = Loc.L("Common.Auto") + Loc.Separator + (Options.FirstOrDefault(o => Equals(o.Value, auto))?.Label ?? auto.ToString());
|
||||
AutoReason = Reason(_session, _setting);
|
||||
NotApplicableReason = _notApplicable?.Invoke(project);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public sealed record CardActions(ImportDestinationKind Destination, bool IsKnown
|
||||
/// <summary>"4,812 verified on the card · 96.2 GB · 2 kept": the dry run in one line; empty before it ran.</summary>
|
||||
public string EraseText => Erase is null
|
||||
? string.Empty
|
||||
: string.Join(" · ", new[]
|
||||
: string.Join(Loc.Separator, new[]
|
||||
{
|
||||
Loc.Plural("Import.Erase.Verified", DeleteCount),
|
||||
Formatting.Bytes(DeleteBytes),
|
||||
|
||||
@@ -95,7 +95,7 @@ public sealed record ImportSource(string Key, SourceKind Kind, CardDevice? Devic
|
||||
/// "Known card · 128 GB · 96.2 GB used · 4,812 photos": the entry's tooltip, with what its subtitle may have to cut
|
||||
/// (a drive's subtitle already says it has no DCIM).
|
||||
/// </summary>
|
||||
public string ToolTip => Kind == SourceKind.Drive ? Subtitle : string.Join(" · ", new[] { StateText, Subtitle }.Where(t => t.Length > 0));
|
||||
public string ToolTip => Kind == SourceKind.Drive ? Subtitle : string.Join(Loc.Separator, new[] { StateText, Subtitle }.Where(t => t.Length > 0));
|
||||
|
||||
/// <summary>"Canon EOS R5 · 4,812 photos": the insertion toast's line; "not yet known to Titano" for a new card.</summary>
|
||||
public string ToastText
|
||||
@@ -106,7 +106,7 @@ public sealed record ImportSource(string Key, SourceKind Kind, CardDevice? Devic
|
||||
if ((CameraText(Card) is { Length: > 0 } known ? known : Contents?.Camera) is { } camera) parts.Add(camera);
|
||||
if (Contents is { } contents) parts.Add(Loc.Plural("Shell.Status.Photos", contents.Photos));
|
||||
if (!IsKnown) parts.Add(Loc.L("Import.Toast.Unknown"));
|
||||
return string.Join(" · ", parts);
|
||||
return string.Join(Loc.Separator, parts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public sealed record ImportSource(string Key, SourceKind Kind, CardDevice? Devic
|
||||
var serial = Device?.SerialNumber ?? Card?.VolumeSerial;
|
||||
if (serial is { } s && Kind != SourceKind.Folder) parts.Add(Loc.L("Import.Device.Serial", BidiText.Ltr(SerialText(s))));
|
||||
if (CameraText(Card) is { Length: > 0 } camera) parts.Add(Card?.CameraSerial is { Length: > 0 } body ? Loc.L("Import.Device.Body", camera, body) : camera);
|
||||
return string.Join(" · ", parts);
|
||||
return string.Join(Loc.Separator, parts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ public sealed record PlanTotals(int Sessions, int Photos, int CopyCount, long Co
|
||||
public bool HasEnoughSpace => FreeAfter is not < 0;
|
||||
|
||||
/// <summary>"3 sessions · 4,812 photos · 96.2 GB · about 12 min".</summary>
|
||||
public string Text => SummaryText + " · " + Loc.L("Import.Plan.About", Formatting.Duration(Estimate));
|
||||
public string Text => SummaryText + Loc.Separator + Loc.L("Import.Plan.About", Formatting.Duration(Estimate));
|
||||
|
||||
/// <summary>"3 sessions · 4,812 photos · 96.2 GB": the plan without its time estimate.</summary>
|
||||
public string SummaryText => string.Join(" · ",
|
||||
public string SummaryText => string.Join(Loc.Separator,
|
||||
Loc.Plural("Import.Plan.Sessions", Sessions),
|
||||
Loc.Plural("Shell.Status.Photos", Photos),
|
||||
Formatting.Bytes(CopyBytes));
|
||||
@@ -171,7 +171,7 @@ public static class ImportPlans
|
||||
foreach (var problem in plan.Problems) conflicts.Add(Loc.L("Import.Details.Unreadable", BidiText.Ltr(problem.RelativePath), problem.Message));
|
||||
if (totals.Duplicates > 0) conflicts.Add(totals.DuplicatesText);
|
||||
if (!totals.HasEnoughSpace) conflicts.Add(totals.SpaceText);
|
||||
var text = string.Join(" · ", new[]
|
||||
var text = string.Join(Loc.Separator, new[]
|
||||
{
|
||||
Loc.Plural("Import.Details.Files", plan.FileCount),
|
||||
Loc.L("Import.Details.Copy", Formatting.Count(plan.CopyCount), Formatting.Bytes(plan.CopyBytes)),
|
||||
@@ -210,7 +210,7 @@ public static class ImportPlans
|
||||
var folder = FolderOf(paths[i]);
|
||||
shown.Add(i > 0 && folder == FolderOf(paths[i - 1]) ? paths[i][(folder.Length == 0 ? 0 : folder.Length + 1)..] : paths[i]);
|
||||
}
|
||||
return Loc.L("Import.Names.Preview", string.Join(" · ", shown));
|
||||
return Loc.L("Import.Names.Preview", string.Join(Loc.Separator, shown));
|
||||
}
|
||||
|
||||
private static string FolderOf(string path) => path.LastIndexOf('/') is var slash and >= 0 ? path[..slash] : string.Empty;
|
||||
|
||||
@@ -83,7 +83,7 @@ public sealed class ImportResultViewModel : LocalizedViewModel
|
||||
: Loc.L("Import.Result.Partial", Formatting.Count(Outcome.Imported), Formatting.Count(Outcome.Failures.Count));
|
||||
|
||||
/// <summary>"12 skipped · 3 already there", or empty.</summary>
|
||||
public string DetailText => string.Join(" · ", new[]
|
||||
public string DetailText => string.Join(Loc.Separator, new[]
|
||||
{
|
||||
Outcome.Skipped > 0 ? Loc.Plural("Import.Result.Skipped", Outcome.Skipped) : string.Empty,
|
||||
Outcome.Duplicates > 0 ? Loc.Plural("Import.Result.AlreadyThere", Outcome.Duplicates) : string.Empty,
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace Titano.App.Infrastructure;
|
||||
/// <summary>Culture-aware number, size and duration formatting for the UI.</summary>
|
||||
public static class Formatting
|
||||
{
|
||||
private static readonly string[] ByteUnits = ["B", "KB", "MB", "GB", "TB", "PB"];
|
||||
/// <summary>Localized "{0} KB" formats from bytes to petabytes (BRIEF §16: sizes follow the language, "96,2 Go").</summary>
|
||||
private static readonly string[] ByteUnits = ["Common.Size.B", "Common.Size.KB", "Common.Size.MB", "Common.Size.GB", "Common.Size.TB", "Common.Size.PB"];
|
||||
|
||||
/// <summary>1,536 → "1.5 KB" (decimal units, as Explorer shows for drives).</summary>
|
||||
public static string Bytes(long bytes)
|
||||
@@ -18,7 +19,7 @@ public static class Formatting
|
||||
unit++;
|
||||
}
|
||||
var format = unit == 0 || value >= 100 ? "0" : "0.#";
|
||||
return value.ToString(format, Loc.Culture) + " " + ByteUnits[unit];
|
||||
return Loc.L(ByteUnits[unit], value.ToString(format, Loc.Culture));
|
||||
}
|
||||
|
||||
public static string Count(long n) => n.ToString("N0", Loc.Culture);
|
||||
|
||||
@@ -75,6 +75,6 @@ public static class JobText
|
||||
if (Counter(entry.Done, entry.Total) is { Length: > 0 } counter) parts.Add(counter);
|
||||
if (Speed(entry.Job.Kind, entry.ItemsPerSecond) is { Length: > 0 } speed) parts.Add(speed);
|
||||
if (entry.Eta is { } eta) parts.Add(Loc.L("Jobs.Bar.Left", Formatting.Duration(eta)));
|
||||
return string.Join(" · ", parts);
|
||||
return string.Join(Loc.Separator, parts);
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public sealed class SequenceItem : ObservableObject
|
||||
public string Camera => PathTemplate.CameraName(_sequence.CameraMake, _sequence.CameraModel);
|
||||
|
||||
/// <summary>Card line: count · camera · span.</summary>
|
||||
public string Subtitle => string.Join(" · ", new[] { FramesText, Camera, SpanText }.Where(s => s.Length > 0));
|
||||
public string Subtitle => string.Join(Loc.Separator, new[] { FramesText, Camera, SpanText }.Where(s => s.Length > 0));
|
||||
|
||||
public string FramesText => Formatting.Count(_sequence.FrameCount);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public sealed class AboutViewModel : SectionViewModel
|
||||
|
||||
/// <summary>File version and processor architecture.</summary>
|
||||
public string Build =>
|
||||
(typeof(App).Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version ?? Version) + " · " + RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant();
|
||||
(typeof(App).Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version ?? Version) + Loc.Separator + RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant();
|
||||
|
||||
public string Runtime => RuntimeInformation.FrameworkDescription;
|
||||
|
||||
|
||||
@@ -223,12 +223,12 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
var text = selected.Count == 0 || selected.Any(n => n.Kind == TreeNodeKind.Archive)
|
||||
? Loc.Plural("Archive.Set.All", set.Count)
|
||||
: set.Count == 1 ? set[0].DisplayTitle : Loc.Plural("Shell.Status.Sequences", set.Count);
|
||||
return _filter.IsEmpty ? text : text + " · " + _filter.Describe();
|
||||
return _filter.IsEmpty ? text : text + Loc.Separator + _filter.Describe();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The set button's accessible name: what it is and the set it shows.</summary>
|
||||
public string SetFilterName => Loc.L("Archive.Set.Filter") + " · " + SetText;
|
||||
public string SetFilterName => Loc.L("Archive.Set.Filter") + Loc.Separator + SetText;
|
||||
|
||||
/// <summary>Camera, status and tag on top of the tree selection.</summary>
|
||||
public ArchiveSetFilter Filter
|
||||
@@ -426,6 +426,13 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
Orphans = OrphanRows(orphans, locations);
|
||||
}
|
||||
|
||||
/// <summary>The UI language changed: the figures, tree and health rows are read again in the new language.</summary>
|
||||
protected override void OnLanguageChanged()
|
||||
{
|
||||
if (_loaded) _ = LoadAsync();
|
||||
base.OnLanguageChanged();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_reloadDelay.Stop();
|
||||
|
||||
@@ -306,7 +306,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
public string ServerName => Services.Server.ServerName ?? Loc.L("Import.Destination.NotConnected");
|
||||
|
||||
/// <summary>"Server · Studio NAS": the Server choice as screen readers announce it.</summary>
|
||||
public string ServerChoiceName => Loc.L("Import.Destination.Server") + " · " + ServerName;
|
||||
public string ServerChoiceName => Loc.L("Import.Destination.Server") + Loc.Separator + ServerName;
|
||||
|
||||
public string ServerToolTip => CanUseServer ? Loc.L("Tooltips.Import.Server") : Loc.L("Import.Blocked.NoServer");
|
||||
|
||||
@@ -664,6 +664,14 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
/// <summary>Shows an import that stopped with <paramref name="error"/>, without running it (capture).</summary>
|
||||
public void ShowFailed(Exception error) => Fail(ImportFailures.Import(error, SourceTitle), error.Message);
|
||||
|
||||
/// <summary>The UI language changed: the session table and the device list say it again in the new language.</summary>
|
||||
protected override void OnLanguageChanged()
|
||||
{
|
||||
ApplyPlan();
|
||||
if (_loaded) _ = RefreshSourcesAsync();
|
||||
base.OnLanguageChanged();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_planDelay.Stop();
|
||||
@@ -801,7 +809,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
try
|
||||
{
|
||||
if ((await db.MediaCards.ListImportsAsync(card.Id, 1)).FirstOrDefault() is { } last)
|
||||
text = string.Join(" · ", new[] { text, Loc.L("Import.Device.LastImport", Formatting.Date(last.ImportedAt)) }.Where(t => t.Length > 0));
|
||||
text = string.Join(Loc.Separator, new[] { text, Loc.L("Import.Device.LastImport", Formatting.Date(last.ImportedAt)) }.Where(t => t.Length > 0));
|
||||
}
|
||||
catch (DatabaseException ex)
|
||||
{
|
||||
@@ -1325,7 +1333,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
: Loc.L("Import.Progress.Bytes", Formatting.Bytes(done), Formatting.Bytes(total)),
|
||||
};
|
||||
if (eta is { } left) parts.Add(Loc.L("Jobs.Bar.Left", Formatting.Duration(left)));
|
||||
ProgressText = string.Join(" · ", parts);
|
||||
ProgressText = string.Join(Loc.Separator, parts);
|
||||
}
|
||||
|
||||
private void Finish(ImportPlan plan, ImportOutcome outcome)
|
||||
|
||||
@@ -169,6 +169,15 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>The UI language changed: the rows, the filter chips and the job bar say it again in the new language.</summary>
|
||||
protected override void OnLanguageChanged()
|
||||
{
|
||||
foreach (var row in _rows.Values) row.Refresh();
|
||||
foreach (var chip in Chips) chip.Refresh();
|
||||
UpdateShell();
|
||||
base.OnLanguageChanged();
|
||||
}
|
||||
|
||||
/// <summary>Reads the job list again from the first page (after jobs were written outside the engine).</summary>
|
||||
public Task ReloadAsync()
|
||||
{
|
||||
|
||||
@@ -469,7 +469,7 @@ public sealed class LibraryViewModel : SectionViewModel
|
||||
get
|
||||
{
|
||||
var chosen = SelectedItems().ToList();
|
||||
return Loc.Plural("Shell.Status.Photos", chosen.Sum(i => (long)i.Sequence.FrameCount)) + " · " + Formatting.Bytes(chosen.Sum(i => i.Sequence.TotalBytes));
|
||||
return Loc.Plural("Shell.Status.Photos", chosen.Sum(i => (long)i.Sequence.FrameCount)) + Loc.Separator + Formatting.Bytes(chosen.Sum(i => i.Sequence.TotalBytes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
if (!IsConnected || Session.Flow.Info is not { } info) return null;
|
||||
var parts = new List<string> { info.Name, Loc.L("Server.Version", info.Version) };
|
||||
if (Session.Flow.Latency is { } latency) parts.Add(Loc.L("Server.Latency", Math.Max(1, (int)Math.Round(latency.TotalMilliseconds))));
|
||||
return string.Join(" · ", parts);
|
||||
return string.Join(Loc.Separator, parts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -589,7 +589,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
Encoders.Clear();
|
||||
foreach (var row in rows) Encoders.Add(new EncoderRowViewModel(row));
|
||||
var hardware = rows.Count(r => r.Hardware);
|
||||
AdapterText = string.Join(" · ", new[] { adapter, Loc.Plural("Settings.Rendering.EncoderCount", rows.Count(r => r.Source == EncoderSource.MediaFoundation)) }
|
||||
AdapterText = string.Join(Loc.Separator, new[] { adapter, Loc.Plural("Settings.Rendering.EncoderCount", rows.Count(r => r.Source == EncoderSource.MediaFoundation)) }
|
||||
.Where(s => !string.IsNullOrEmpty(s)));
|
||||
Log.Info("settings", $"{rows.Count} encoder(s), {hardware} hardware");
|
||||
}
|
||||
|
||||
@@ -300,5 +300,5 @@ public static class SyncText
|
||||
|
||||
private static string Shorten(string text) => text.Length <= 40 ? text : string.Concat(text.AsSpan(0, 39), "…");
|
||||
|
||||
private static string Join(params string[] parts) => string.Join(" · ", parts);
|
||||
private static string Join(params string[] parts) => string.Join(Loc.Separator, parts);
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public sealed record EncoderRow(string Codec, string Name, string? Vendor, Encod
|
||||
public bool CanSelfTest => Source != EncoderSource.BuiltInAnimation;
|
||||
|
||||
/// <summary>"NVIDIA · NVIDIA HEVC Encoder MFT" unless the name already carries the vendor.</summary>
|
||||
public string DisplayName => Vendor is { } vendor && !Name.Contains(vendor, StringComparison.OrdinalIgnoreCase) ? vendor + " · " + Name : Name;
|
||||
public string DisplayName => Vendor is { } vendor && !Name.Contains(vendor, StringComparison.OrdinalIgnoreCase) ? vendor + Loc.Separator + Name : Name;
|
||||
}
|
||||
|
||||
/// <summary>What the encoders of this PC are for: the built-in presets each one serves and what a render node offers.</summary>
|
||||
@@ -38,7 +38,7 @@ public static class EncoderUse
|
||||
];
|
||||
|
||||
/// <summary>"4K archive · 4K HEVC · …" for the Used for column (every codec of this PC has built-in presets).</summary>
|
||||
public static string Text(EncoderRow row) => string.Join(" · ", Presets(row));
|
||||
public static string Text(EncoderRow row) => string.Join(Loc.Separator, Presets(row));
|
||||
|
||||
/// <summary>
|
||||
/// The Media Foundation encoders a render node on this PC offers the server: the software ones, and the hardware ones
|
||||
@@ -49,5 +49,5 @@ public static class EncoderUse
|
||||
|
||||
/// <summary>"HEVC · H.264 · AV1": the codecs of <paramref name="encoders"/>, each once; null when there are none.</summary>
|
||||
public static string? Codecs(IEnumerable<EncoderRow> encoders) =>
|
||||
encoders.Select(e => e.Codec).Distinct(StringComparer.Ordinal).ToList() is { Count: > 0 } codecs ? string.Join(" · ", codecs) : null;
|
||||
encoders.Select(e => e.Codec).Distinct(StringComparer.Ordinal).ToList() is { Count: > 0 } codecs ? string.Join(Loc.Separator, codecs) : null;
|
||||
}
|
||||
@@ -25,6 +25,16 @@ public static class Loc
|
||||
/// <summary>Text direction of the current culture.</summary>
|
||||
public static bool IsRightToLeft => _culture.TextInfo.IsRightToLeft;
|
||||
|
||||
/// <summary>
|
||||
/// Separator of the fields of a meta line ("3,600 · Canon EOS R5 · 2 h 00 min"). In a right-to-left language it sits
|
||||
/// between right-to-left marks, so a number after a Latin field stays in its own field instead of joining the Latin
|
||||
/// run (Unicode bidi rule W7) and the fields read from the right.
|
||||
/// </summary>
|
||||
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 void SetCulture(CultureInfo culture)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(culture);
|
||||
|
||||
@@ -35,5 +35,11 @@ public abstract class LocalizedViewModel : ObservableObject, IDisposable
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void OnCultureChanged(object? sender, EventArgs e) => OnAllPropertiesChanged();
|
||||
private void OnCultureChanged(object? sender, EventArgs e) => OnLanguageChanged();
|
||||
|
||||
/// <summary>
|
||||
/// The UI language changed: every property is read again. A view model that keeps texts in objects (chart series
|
||||
/// and legends, rows, cached sentences) builds them again here, then calls the base.
|
||||
/// </summary>
|
||||
protected virtual void OnLanguageChanged() => OnAllPropertiesChanged();
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public sealed class BarChart : DrawingElement
|
||||
|
||||
private static string DefaultFormat(double value) => value.ToString("N0", Loc.Culture);
|
||||
|
||||
private string ReadoutText(ChartItem item) => item.ToolTip ?? item.Label + " · " + (item.ValueText ?? Format(item.Value));
|
||||
private string ReadoutText(ChartItem item) => item.ToolTip ?? item.Label + Loc.Separator + (item.ValueText ?? Format(item.Value));
|
||||
|
||||
private double ScaleMaximum(IReadOnlyList<ChartItem> items)
|
||||
{
|
||||
|
||||
@@ -249,6 +249,6 @@ public sealed class HeatmapStrip : DrawingElement
|
||||
if (data.ToolTips is { } tips && column < tips.Count && !string.IsNullOrEmpty(tips[column])) return tips[column]!;
|
||||
var value = column < data.Values.Count ? data.Values[column] : double.NaN;
|
||||
var columnLabel = ColumnLabels is { } labels && column < labels.Count ? " " + labels[column] : string.Empty;
|
||||
return data.Label + columnLabel + (double.IsFinite(value) ? " · " + Format(value) : string.Empty);
|
||||
return data.Label + columnLabel + (double.IsFinite(value) ? Loc.Separator + Format(value) : string.Empty);
|
||||
}
|
||||
}
|
||||
@@ -200,6 +200,6 @@ public sealed class StackedBar : DrawingElement
|
||||
if (item.ToolTip is not null) return item.ToolTip;
|
||||
var total = Total(items);
|
||||
var share = Share(total > 0 ? Math.Max(0, item.Value) / total : 0);
|
||||
return item.Label + " · " + (item.ValueText is null ? share : item.ValueText + " · " + share);
|
||||
return item.Label + Loc.Separator + (item.ValueText is null ? share : item.ValueText + Loc.Separator + share);
|
||||
}
|
||||
}
|
||||
@@ -277,6 +277,6 @@ public sealed class TimelineBands : DrawingElement
|
||||
var value = slot < row.Values.Count ? row.Values[slot] : double.NaN;
|
||||
var caption = SlotLabels is { } labels && slot < labels.Count ? " " + labels[slot] : string.Empty;
|
||||
var format = ValueFormatter ?? (v => v.ToString("N0", Loc.Culture));
|
||||
return row.Label + caption + (double.IsFinite(value) ? " · " + format(value) : string.Empty);
|
||||
return row.Label + caption + (double.IsFinite(value) ? Loc.Separator + format(value) : string.Empty);
|
||||
}
|
||||
}
|
||||
@@ -78,8 +78,8 @@ public sealed class QueueRowNameConverter : IMultiValueConverter
|
||||
public object Convert(object?[] values, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (values is not [string file, UploadItemState state, UploadFailure failure, var detail, ..]) return string.Empty;
|
||||
var name = file + " · " + UploadStateTextConverter.Text(state);
|
||||
return state == UploadItemState.Failed && FailureTextConverter.Describe(failure, detail as string) is { } reason ? name + " · " + reason : name;
|
||||
var name = file + Loc.Separator + UploadStateTextConverter.Text(state);
|
||||
return state == UploadItemState.Failed && FailureTextConverter.Describe(failure, detail as string) is { } reason ? name + Loc.Separator + reason : name;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object? value, Type[] targetTypes, object? parameter, CultureInfo culture) => throw new NotSupportedException();
|
||||
|
||||
@@ -290,7 +290,7 @@ public sealed class MainViewModel : LocalizedViewModel
|
||||
}
|
||||
|
||||
/// <summary>Tray hover text.</summary>
|
||||
public string TrayText => Loc.L("Uploader.App.Title") + (HasItems ? " · " + QueueText : string.Empty);
|
||||
public string TrayText => Loc.L("Uploader.App.Title") + (HasItems ? Loc.Separator + QueueText : string.Empty);
|
||||
|
||||
// ---------------- Watch folders ----------------
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public sealed class WatchFolderViewModel : ObservableObject
|
||||
public string IntervalText => Loc.L("Uploader.Watch.Interval", Interval(IntervalSeconds));
|
||||
|
||||
/// <summary>The full path (the chip may shorten it), then the folder's state and interval.</summary>
|
||||
public string ToolTip => LeftToRight(Path) + " · " + (IsAvailable == false ? Loc.L("Tooltips.Uploader.WatchFolderMissing", Interval(IntervalSeconds))
|
||||
public string ToolTip => LeftToRight(Path) + Loc.Separator + (IsAvailable == false ? Loc.L("Tooltips.Uploader.WatchFolderMissing", Interval(IntervalSeconds))
|
||||
: IsNetwork ? Loc.L("Tooltips.Uploader.WatchFolderNetwork", Interval(IntervalSeconds))
|
||||
: Loc.L("Tooltips.Uploader.WatchFolder", Interval(IntervalSeconds)));
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ public enum QueueActivity
|
||||
/// </summary>
|
||||
public static class UploaderText
|
||||
{
|
||||
private const string Separator = " · ";
|
||||
|
||||
/// <summary>Localized "{0} KB" formats from bytes to petabytes (BRIEF §16: sizes follow the language, "96,2 Go").</summary>
|
||||
private static readonly string[] SizeFormats = ["Common.Size.B", "Common.Size.KB", "Common.Size.MB", "Common.Size.GB", "Common.Size.TB", "Common.Size.PB"];
|
||||
|
||||
@@ -86,11 +84,11 @@ public static class UploaderText
|
||||
parts.Add(L("Uploader.Queue.Done", culture));
|
||||
break;
|
||||
}
|
||||
return string.Join(Separator, parts);
|
||||
return string.Join(Loc.SeparatorOf(culture), parts);
|
||||
}
|
||||
|
||||
/// <summary>"2,214 of 4,812 sent · 2,201 verified by the server · 0 retries" (failures have their own link, <see cref="Failed"/>).</summary>
|
||||
public static string ProgressLine(QueueSummary summary, CultureInfo culture) => string.Join(Separator,
|
||||
public static string ProgressLine(QueueSummary summary, CultureInfo culture) => string.Join(Loc.SeparatorOf(culture),
|
||||
L("Uploader.Progress.Sent", culture, summary.Sent, summary.Files),
|
||||
L("Uploader.Progress.Verified", culture, summary.Verified),
|
||||
Plural("Uploader.Progress.Retries", summary.Retries, culture));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Globalization;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Testing;
|
||||
|
||||
namespace Titano.Core.Tests.Localization;
|
||||
|
||||
/// <summary>Switches the process-wide UI language, so nothing else runs meanwhile.</summary>
|
||||
[Serial]
|
||||
public sealed class LocTests
|
||||
{
|
||||
[Test]
|
||||
public void FieldSeparatorHoldsRightToLeftMarksOnlyInRightToLeftLanguages()
|
||||
{
|
||||
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[] { "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);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Loc.SetCulture(before);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user