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
This commit is contained in:
Claude committed 2026-10-12 10:13:46 +00:00
1 parent f7a7506fe7
commit 579ffd446d
242 files changed
+348 -2036

No files matched your search

+24
View File
@@ -54,6 +54,8 @@ internal sealed partial class I18nCommand : ICommand
errors.Add($"en: {key} is {entry.Value.Length} chars (budget {limit})");
if (string.IsNullOrWhiteSpace(entry.Value))
errors.Add($"en: {key} is empty");
if (CountedNoun(key, entry.Value) is { } noun)
errors.Add($"en: {key} counts {noun} but is not a plural stem: write {key}.one and {key}.other with the count as {{0}}, or a label (\"Frames: {{0}}\")");
}
foreach (var (culture, strings) in catalog.Cultures)
@@ -124,6 +126,21 @@ internal sealed partial class I18nCommand : ICommand
warnings.Add($"{culture}: {key} is {translated.Value.Length} chars (soft budget {limit})");
}
/// <summary>
/// The noun a plain (non-plural) English value counts with a number in front of it ("{0} frames", "{0} short gaps"):
/// such a key reads "1 frames", and Italian or Slavic forms cannot follow the number either (BRIEF §16). Bounds the code
/// sets ("at most {0} characters") and labels ("Frames: {0}") count nothing; null when the value counts nothing.
/// </summary>
internal static string? CountedNoun(string key, string value)
{
if (PluralSuffix().IsMatch(key[(key.LastIndexOf('.') + 1)..])) return null;
foreach (Match m in CountedNounRegex().Matches(value))
{
if (!m.Groups["bound"].Success) return m.Groups["noun"].Value;
}
return null;
}
/// <summary>The English <c>other</c> form when <paramref name="key"/> is a plural form of an English plural key.</summary>
private static Entry? PluralStem(string key, Dictionary<string, Entry> en)
{
@@ -292,6 +309,13 @@ internal sealed partial class I18nCommand : ICommand
[GeneratedRegex(@"^(one|few|many|other)$")]
private static partial Regex PluralSuffix();
/// <summary>A placeholder, up to two describing words that are not function words, then a noun the product counts.</summary>
[GeneratedRegex(@"(?<bound>\b(?i:at least|at most|up to|to)\s+)?\{\d+(?:[,:][^}]*)?\}(?:\s+(?!(?:and|or|of|the|a|an|to|on|in|at|by|for|with|from|is|are|was|were)\b)[a-z]+){0,2}?\s+"
+ @"(?<noun>frames|photos|sequences|files|folders|exports|renders|jobs|times|gaps|sessions|changes|steps|warnings|cores|days|hours|minutes|"
+ @"items|cards|tags|users|accounts|nodes|presets|characters|originals|copies|groups|issues|cameras|lenses|uploads|downloads|transfers|"
+ @"keyframes|encoders|errors|problems|duplicates|locks|packs|flags|lines|months|years|previews|settings|versions|workers|stars|rows|chunks)\b")]
private static partial Regex CountedNounRegex();
internal sealed record Entry(string File, string Value, string? Comment);
internal sealed class Catalog