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
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user