Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)))
{
Expand Down
3 changes: 2 additions & 1 deletion SemiPlot/SemiPlot.UI/Chart/ChartMarkerLines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using ScottPlot.Plottables;

using SemiPlot.Core.Data;
using SemiPlot.UI.Localization;

namespace SemiPlot.UI.Chart;

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions SemiPlot/SemiPlot.UI/Localization/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -828,4 +828,7 @@
<data name="MarkerLabelCancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="MarkerLineLabelFormat" xml:space="preserve">
<value>{0} · {1}</value>
</data>
</root>
3 changes: 3 additions & 0 deletions SemiPlot/SemiPlot.UI/Localization/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -828,4 +828,7 @@
<data name="MarkerLabelCancel" xml:space="preserve">
<value>Отмена</value>
</data>
<data name="MarkerLineLabelFormat" xml:space="preserve">
<value>{0} · {1}</value>
</data>
</root>
8 changes: 5 additions & 3 deletions docs/architecture/ui-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -400,15 +401,16 @@ 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 |
| --- | --- | --- |
| `MarkerMenuAdd` | "Add marker here" / "Добавить метку здесь" | The chart menu, off a marker |
| `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,
Expand Down
Loading