diff --git a/SemiPlot/SemiPlot.Tests.Unit/UI/Localization/ResourcesTests.cs b/SemiPlot/SemiPlot.Tests.Unit/UI/Localization/ResourcesTests.cs index c282dec..28c37ac 100644 --- a/SemiPlot/SemiPlot.Tests.Unit/UI/Localization/ResourcesTests.cs +++ b/SemiPlot/SemiPlot.Tests.Unit/UI/Localization/ResourcesTests.cs @@ -43,6 +43,7 @@ public void GlyphValues_KeepTheCodePointsTheOperatorSees() Resources.NoValuePlaceholder.Should().Be("\u2014"); Resources.DeltaTimeLabel.Should().Be("\u0394t"); Resources.DeltaValueLabel.Should().Be("\u0394y"); + Resources.MarkerLineLabelFormat.Should().Be("{0} \u00b7 {1}"); } [Fact] @@ -106,13 +107,13 @@ public void TheRussianSet_ResolvesEveryKeyToANonEmptyValue() } } - // Three keys are glyphs and share their value by design; every other key has to differ. + // Four keys are glyphs and share their value by design; every other key has to differ. [Fact] public void EveryRussianValue_DiffersFromTheNeutralOneOutsideTheGlyphKeys() { var neutral = ReadSet(CultureInfo.InvariantCulture); var russian = ReadSet(RussianCulture); - string[] glyphKeys = ["DeltaTimeLabel", "DeltaValueLabel", "NoValuePlaceholder"]; + string[] glyphKeys = ["DeltaTimeLabel", "DeltaValueLabel", "NoValuePlaceholder", "MarkerLineLabelFormat"]; foreach (var entry in russian.Where(entry => !glyphKeys.Contains(entry.Key))) { diff --git a/SemiPlot/SemiPlot.UI/Chart/ChartMarkerLines.cs b/SemiPlot/SemiPlot.UI/Chart/ChartMarkerLines.cs index 3a71ac9..ec0bb5b 100644 --- a/SemiPlot/SemiPlot.UI/Chart/ChartMarkerLines.cs +++ b/SemiPlot/SemiPlot.UI/Chart/ChartMarkerLines.cs @@ -4,6 +4,7 @@ using ScottPlot.Plottables; using SemiPlot.Core.Data; +using SemiPlot.UI.Localization; namespace SemiPlot.UI.Chart; @@ -142,7 +143,7 @@ private static string LabelTextOf(StoredMarker marker) .ToLocalTime() .ToString(LabelTimeFormat, CultureInfo.CurrentCulture); - return marker.Label is { } label ? $"{label} \u00B7 {time}" : time; + return marker.Label is { } label ? Resources.FormatMarkerLineLabelFormat(label, time) : time; } private static double EstimatedLabelWidth(VerticalLine line) diff --git a/SemiPlot/SemiPlot.UI/Localization/Resources.resx b/SemiPlot/SemiPlot.UI/Localization/Resources.resx index 03657a9..2b0b7cc 100644 --- a/SemiPlot/SemiPlot.UI/Localization/Resources.resx +++ b/SemiPlot/SemiPlot.UI/Localization/Resources.resx @@ -828,4 +828,7 @@ Cancel + + {0} · {1} + diff --git a/SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx b/SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx index 38c2c44..d603842 100644 --- a/SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx +++ b/SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx @@ -828,4 +828,7 @@ Отмена + + {0} · {1} + diff --git a/docs/architecture/ui-text.md b/docs/architecture/ui-text.md index 1579a70..6641046 100644 --- a/docs/architecture/ui-text.md +++ b/docs/architecture/ui-text.md @@ -5,7 +5,8 @@ Russian counterpart `Resources.ru.resx`, the startup failure window included. Th ASCII: `.editorconfig:25` gives `[*.cs]` `charset = utf-8`, CI's `format check` step gates the byte order mark, and the pre-commit hook and CI's `comment gate` step run `terse` over the characters. So a glyph with no ASCII form is a resource value: the delta labels (`U+0394` plus `t` and `y`), the -no-value placeholder (`U+2014`) and the window title all sit in the resx. The Russian set is +no-value placeholder (`U+2014`), the marker line's label separator (`U+00B7`) and the window title +all sit in the resx. The Russian set is Cyrillic throughout, and the same rule is what keeps it out of the code. The Russian set calls a pen «перо» (plural «перья») everywhere: the sidebar, the editor, the menu @@ -400,8 +401,8 @@ reaches the message panel, not this line. ## The marker menu and label editor's text -`Chart/TrendChartView.axaml` reads every string of the time markers -(`trend-interaction.md#the-time-markers`): +`Chart/TrendChartView.axaml` reads every string of the time markers but the line label, which +`Chart/ChartMarkerLines` formats (`trend-interaction.md#the-time-markers`): | Key | English / Russian | Where | | --- | --- | --- | @@ -409,6 +410,7 @@ reaches the message panel, not this line. | `MarkerMenuRename`, `MarkerMenuDelete` | "Rename" / "Переименовать", "Delete" / "Удалить" | The marker menu | | `MarkerLabelPlaceholder` | "Label (optional)" / "Подпись (необязательно)" | The label box's watermark | | `MarkerLabelOk`, `MarkerLabelCancel` | "OK" / "ОК", "Cancel" / "Отмена" | The editor's buttons | +| `MarkerLineLabelFormat` | "{0} · {1}" in both sets | A labelled marker's line: the label, then its local time | The editor has no message line: nothing in it can be invalid, and the watermark says that an empty box is allowed (`ui-theme.md#the-marker-label-editor`). A failed marker write reaches the message panel,