Files
Chronos/tests/Titano.Core.Tests/Localization/LocTests.cs
T
Claude 0a513fb213 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
2026-10-11 23:47:03 +00:00

34 lines
1.0 KiB
C#
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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);
}
}
}