Merge branch 'fix/app-fixes': localized error toasts, plural counts, archive and import view-model fixes

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 11:13:16 +00:00
commit 2e2145366f
303 files changed
+968 -2234

No files matched your search

@@ -31,14 +31,56 @@ public sealed partial class AdvisorLocalizationTests(TestContext context)
var keys = Keys(typeof(AdvisorKeys)).Concat(Keys(typeof(FindingKeys))).Concat(Keys(typeof(DeepFindingKeys)))
.Concat(english.Keys.Where(k => k.StartsWith(LogPrefix, StringComparison.Ordinal))).ToList();
Assert.Greater(keys.Count, 90);
var forms = 0;
foreach (var key in keys)
{
Assert.True(english.TryGetValue(key, out var en), $"English text missing for {key}");
Assert.True(italian.TryGetValue(key, out var it), $"Italian text missing for {key}");
Assert.SequenceEqual(Placeholders(en!), Placeholders(it!), key);
Assert.LessOrEqual(en!.Length, 200);
// A key that counts something is a plural stem (BRIEF §16) whose count is its first argument.
string[] names = english.ContainsKey(key) ? [key] : [key + ".one", key + ".other"];
if (names.Length == 2) Assert.Contains("0", Placeholders(english.GetValueOrDefault(key + ".other") ?? string.Empty), $"{key}.other counts with {{0}}");
foreach (var name in names)
{
Assert.True(english.TryGetValue(name, out var en), $"English text missing for {name}");
Assert.True(italian.TryGetValue(name, out var it), $"Italian text missing for {name}");
Assert.SequenceEqual(Placeholders(en!), Placeholders(it!), name);
Assert.LessOrEqual(en!.Length, 200);
forms++;
}
}
Assert.Equal(english.Count, keys.Count);
Assert.Equal(english.Count, forms);
}
[Test]
public void ACountOfOneReadsInTheSingularInBothLanguages()
{
Assert.Equal("1 frame is black (lens cap or missed exposure).", Loc.Text(DeepFindingKeys.BlackFrames, [1.0], English));
Assert.Equal("3 frames are black (lens cap or missed exposure).", Loc.Text(DeepFindingKeys.BlackFrames, [3.0], English));
Assert.Equal("1 fotogramma è nero (tappo sull'obiettivo o scatto mancato).", Loc.Text(DeepFindingKeys.BlackFrames, [1.0], Italian));
Assert.Equal("The lens changes once.", Loc.Text(FindingKeys.LensChanged, [1], English));
Assert.Equal("L'obiettivo cambia 2 volte.", Loc.Text(FindingKeys.LensChanged, [2], Italian));
Assert.Equal("2 exposure changes reached the pixels: each is spread over a smooth transition.", Loc.Text(AdvisorKeys.HolyGrailReceived, [2], English));
// Advisor windows are measured in tenths of a frame: a fraction takes the plural.
Assert.Equal("Flicker stays correlated over 1.5 frames: a 7-frame window spans four times that.", Loc.Text(AdvisorKeys.WindowCorrelation, [1.5, 7], English));
Assert.Equal("Flicker stays correlated over 1 frame: a 5-frame window spans four times that.", Loc.Text(AdvisorKeys.WindowCorrelation, [1.0, 5], English));
// Keys without a count read as before.
Assert.Equal("Clouds cover about 42% of the sky on average.", Loc.Text(DeepFindingKeys.Clouds, [42.0], English));
}
[Test]
public void ASingleExposureChangeHasNoSpacing()
{
var frames = Enumerable.Range(0, 20).Select(i => new LightFrame
{
Index = i,
CapturedAt = new DateTime(2026, 6, 1, 20, 0, 0, DateTimeKind.Utc).AddSeconds(10 * i),
ExposureTime = i < 12 ? 1.0 / 250 : 1.0 / 125,
FNumber = 8,
Iso = 100,
}).ToList();
var single = LightAnalyzer.Analyze(frames).Findings.Single(f => f.Key == FindingKeys.ExposureStep);
Assert.SequenceEqual([12], single.Frames);
Assert.Equal("One exposure change of -1.0 EV.", Loc.Text(single.Key, single.Arguments, English));
Assert.Equal("Un solo cambio di esposizione di -1,0 EV.", Loc.Text(single.Key, single.Arguments, Italian));
Assert.DoesNotContain(FindingKeys.ExposureSteps, LightAnalyzer.Analyze(frames).Findings.Select(f => f.Key));
}
[Test]
@@ -106,9 +148,8 @@ public sealed partial class AdvisorLocalizationTests(TestContext context)
{
foreach (var culture in new[] { English, Italian })
{
var format = Loc.Get(key, culture);
Assert.NotNull(format);
var text = Format(format!, culture, args);
var text = Loc.Text(key, args, culture);
Assert.False(text.Contains('⟦'), $"{key} has no {culture.Name} text");
Assert.False(text.Contains('{'), $"{key} left a placeholder: {text}");
}
return 1;