Files
Chronos/tests/Titano.Tools.Tests/I18nCommandTests.cs
T
Claude 579ffd446d fix(i18n): plural forms for every text that counts
Findings, advisor reasons and a few UI texts put a count before a plural noun
without plural forms, so English and Italian read "1 frames are black". Each
such key is now a plural stem (.one/.other) whose count is its first argument;
findings and reasons, which travel as data, resolve through the new Loc.Text,
which picks the form from that argument (a fraction takes "other"), so stored
deep reports and project reasons keep their keys and arguments. Texts with two
or more counts (job log lines, "frames with a capture time: 12 of 300") read as
labels, which agree with no number. A single exposure change gets its own
finding instead of "1 exposure changes, typically 0 frames apart".

The converted and reworded keys leave the 36 other catalogs until they are
translated again; the dead plain Shell.JobBar.Ready goes too. `i18n check` now
fails on an English text that counts a noun without plural forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-12 10:13:46 +00:00

36 lines
2.6 KiB
C#

using Titano.Testing;
using Titano.Tools.Commands;
namespace Titano.Tools.Tests;
/// <summary><c>i18n check</c> flags an English text that counts something without plural forms (BRIEF §16).</summary>
public sealed class I18nCommandTests
{
[Test]
public void ANumberInFrontOfACountedNounNeedsPluralForms()
{
Assert.Equal("frames", I18nCommand.CountedNoun("Advisor.Finding.BlackFrames", "{0} frames are black (lens cap or missed exposure)."));
Assert.Equal("gaps", I18nCommand.CountedNoun("Advisor.Reason.Timing.SparseGaps", "{0} short gaps, but motion is unmeasured or fast."));
Assert.Equal("changes", I18nCommand.CountedNoun("Advisor.Finding.StepsNotReceived", "{0} logged exposure changes never reached the pixels."));
Assert.Equal("times", I18nCommand.CountedNoun("Advisor.Finding.LensChanged", "The lens changes {0} times."));
Assert.Equal("sequences", I18nCommand.CountedNoun("Errors.Analysis.Failed", "{0} of {1} sequences could not be analysed; see the job log."));
Assert.Equal("jobs", I18nCommand.CountedNoun("Shell.JobBar.Ready", "Ready · {0:N0} jobs queued"));
Assert.Equal("cores", I18nCommand.CountedNoun("Settings.Rendering.Cores", "of {0} logical cores"));
}
[Test]
public void PluralFormsBoundsLabelsAndUnitsCountNothing()
{
Assert.Null(I18nCommand.CountedNoun("Advisor.Finding.BlackFrames.other", "{0} frames are black (lens cap or missed exposure)."));
Assert.Null(I18nCommand.CountedNoun("Advisor.Finding.BlackFrames.one", "{0} frame is black (lens cap or missed exposure)."));
Assert.Null(I18nCommand.CountedNoun("Server.Error.WeakPassword", "Use at least {0} characters."));
Assert.Null(I18nCommand.CountedNoun("Library.Views.Error.Long", "At most {0} characters, no control characters."));
Assert.Null(I18nCommand.CountedNoun("Archive.Retag.Invalid", "Each tag has 1 to {0} characters."));
Assert.Null(I18nCommand.CountedNoun("Archive.Log.ScanDone", "Folders: {0}, indexed: {1}, adopted: {2}, removed: {3}"));
Assert.Null(I18nCommand.CountedNoun("Advisor.Reason.Window.Period.other", "Flicker repeats every {0} frames: a {1}-frame window averages four cycles."));
Assert.Null(I18nCommand.CountedNoun("Advisor.Reason.Timing.Regular", "Steady {0} s interval (jitter {1} s): each photo becomes one video frame."));
Assert.Null(I18nCommand.CountedNoun("Tooltips.Editor.Remote", "Changes are saved on {0} and analyses and renders run there"));
Assert.Null(I18nCommand.CountedNoun("Advisor.Reason.Transition.Single", "A single exposure step: a {0}-frame transition keeps the change gentle."));
}
}