The right-to-left separator broke the frame data over the preview, a left-to-right
island: after the localized time ("6:03:41 م") the shutter's number read as part
of the previous field and swapped places with the dot. Fields shown in such an
island now use Loc.IslandSeparator, with left-to-right marks in right-to-left
languages. Charts formatted text with the UI culture's digit substitution, so a
number after Arabic words came out in Arabic-Indic digits there only; they now
draw European digits like every text block. The direction marks in source are
written as escapes instead of invisible characters.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
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 FieldSeparatorsHoldDirectionMarksOnlyInRightToLeftLanguages()
|
|
{
|
|
var before = Loc.Culture;
|
|
try
|
|
{
|
|
foreach (var culture in new[] { "en", "it" })
|
|
{
|
|
Loc.SetCulture(CultureInfo.GetCultureInfo(culture));
|
|
Assert.Equal(" · ", Loc.Separator);
|
|
Assert.Equal(" · ", Loc.IslandSeparator);
|
|
}
|
|
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("\u200F · \u200F", Loc.Separator);
|
|
// In a left-to-right island, strong left-to-right ones: a number after a time with its "PM" mark stays in its own field.
|
|
Assert.Equal("\u200E · \u200E", Loc.IslandSeparator);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
Loc.SetCulture(before);
|
|
}
|
|
}
|
|
}
|