From 91bf442c26b8e8d59fe8416f4f6b3d7d5ef887e7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 2 Oct 2026 22:50:25 +0000 Subject: [PATCH] fix(i18n): keep the analysis job log lines under Advisor.Log Moving them to Jobs.Analysis.* deleted keys that the integration branch translates into every culture. The advisor resource test now covers the Advisor.Log.* job lines, as on the integration branch. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- i18n/en/Advisor.resx | 6 ++++++ i18n/en/Jobs.resx | 6 ------ i18n/it/Advisor.it.resx | 6 ++++++ i18n/it/Jobs.it.resx | 6 ------ src/Titano.Data/Processing/Jobs/AnalyseJobHandler.cs | 10 +++++----- .../Advice/AdvisorLocalizationTests.cs | 5 ++++- tests/Titano.Data.Tests/Processing/AnalysisJobTests.cs | 6 +++--- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/i18n/en/Advisor.resx b/i18n/en/Advisor.resx index fad2d883..7c3ab191 100644 --- a/i18n/en/Advisor.resx +++ b/i18n/en/Advisor.resx @@ -31,6 +31,12 @@ {0} frames could not be decoded.{0} frame count Colour balance jumps by {0:0.#}% between frames.{0} RMS colour-ratio jitter in percent {0} frames are blown out to white.{0} frame count + Automatic values of {0} updated.job log line; {0} sequence title + Deep analysis of {0}: {1} frames, {2} warnings.job log line; {0} sequence title; {1} frame count; {2} warning count + {0} could not be analysed: {1}long: job log line; {0} sequence title; {1} reason + Light analysis of {0}: {1} frames, {2} warnings.job log line; {0} sequence title; {1} frame count; {2} warning count + Suggested presets: {0}job log line; {0} preset names separated by dots + The project settings of {0} cannot be read; their automatic values were left as they were.job log line; {0} sequence title Needs the deep analysis of the pixels, which has not run yet; nothing was changed.no placeholders Shutter time or aperture is missing from the metadata, so this cannot be decided; nothing was changed.no placeholders Too few frame pairs to measure motion; nothing was changed.no placeholders diff --git a/i18n/en/Jobs.resx b/i18n/en/Jobs.resx index a4d2365a..a165f36d 100644 --- a/i18n/en/Jobs.resx +++ b/i18n/en/Jobs.resx @@ -13,12 +13,6 @@ Resume Retry Show - Automatic values of {0} updated.long: job log line; {0} sequence title - Deep analysis of {0}: {1} frames, {2} warnings.long: job log line; {0} sequence title; {1} frame count; {2} warning count - {0} could not be analysed: {1}long: job log line; {0} sequence title; {1} reason - Light analysis of {0}: {1} frames, {2} warnings.long: job log line; {0} sequence title; {1} frame count; {2} warning count - Suggested presets: {0}long: job log line; {0} preset names separated by dots - The project settings of {0} cannot be read; their automatic values were left as they were.long: job log line; {0} sequence title {0} left Clear done Kind diff --git a/i18n/it/Advisor.it.resx b/i18n/it/Advisor.it.resx index 88685171..c50b0774 100644 --- a/i18n/it/Advisor.it.resx +++ b/i18n/it/Advisor.it.resx @@ -31,6 +31,12 @@ {0} fotogrammi non sono decodificabili. Il bilanciamento del colore varia del {0:0.#}% tra un fotogramma e l'altro. {0} fotogrammi sono completamente bruciati. + Valori automatici di {0} aggiornati. + Analisi approfondita di {0}: {1} fotogrammi, {2} avvisi. + Impossibile analizzare {0}: {1} + Analisi rapida di {0}: {1} fotogrammi, {2} avvisi. + Preset suggeriti: {0} + Le impostazioni del progetto di {0} non sono leggibili; i valori automatici sono rimasti invariati. Serve l'analisi approfondita dei pixel, non ancora eseguita; nulla è stato cambiato. Tempo di scatto o diaframma mancano nei metadati, quindi non si può decidere; nulla è stato cambiato. Troppo poche coppie di fotogrammi per misurare il movimento; nulla è stato cambiato. diff --git a/i18n/it/Jobs.it.resx b/i18n/it/Jobs.it.resx index 77d95679..29507c5b 100644 --- a/i18n/it/Jobs.it.resx +++ b/i18n/it/Jobs.it.resx @@ -13,12 +13,6 @@ Riprendi Riprova Mostra - Valori automatici di {0} aggiornati. - Analisi approfondita di {0}: {1} fotogrammi, {2} avvisi. - Impossibile analizzare {0}: {1} - Analisi rapida di {0}: {1} fotogrammi, {2} avvisi. - Preset suggeriti: {0} - Le impostazioni del progetto di {0} non sono leggibili; i valori automatici sono rimasti invariati. {0} rimanenti Rimuovi concluse Tipo diff --git a/src/Titano.Data/Processing/Jobs/AnalyseJobHandler.cs b/src/Titano.Data/Processing/Jobs/AnalyseJobHandler.cs index 1476d374..82a7c770 100644 --- a/src/Titano.Data/Processing/Jobs/AnalyseJobHandler.cs +++ b/src/Titano.Data/Processing/Jobs/AnalyseJobHandler.cs @@ -49,7 +49,7 @@ internal sealed class AnalyseJobHandler(TitanoDatabase db, SequenceAnalyser anal { await chain.FlushAsync().ConfigureAwait(false); Core.Diagnostics.Log.Warning("processing", $"Analysis of sequence {targets[i]} failed", ex); - context.Log(Loc.L("Jobs.Analysis.Failed", await TitleAsync(targets[i], context.Cancellation).ConfigureAwait(false), ex.Message)); + context.Log(Loc.L("Advisor.Log.Failed", await TitleAsync(targets[i], context.Cancellation).ConfigureAwait(false), ex.Message)); failed.Add(i); } done += units[i]; @@ -66,10 +66,10 @@ internal sealed class AnalyseJobHandler(TitanoDatabase db, SequenceAnalyser anal private static void Report(JobContext context, AnalysisOutcome outcome, bool deep) { var title = outcome.Sequence.DisplayTitle; - context.Log(Loc.L(deep ? "Jobs.Analysis.DeepDone" : "Jobs.Analysis.LightDone", title, outcome.Frames, outcome.Warnings)); - if (outcome.SettingsChanged) context.Log(Loc.L("Jobs.Analysis.AutoUpdated", title)); - if (outcome.SettingsUnreadable) context.Log(Loc.L("Jobs.Analysis.ProjectUnreadable", title)); - if (outcome.Presets.Count > 0) context.Log(Loc.L("Jobs.Analysis.Presets", string.Join(" · ", outcome.Presets.Select(p => p.DisplayName())))); + context.Log(Loc.L(deep ? "Advisor.Log.DeepDone" : "Advisor.Log.LightDone", title, outcome.Frames, outcome.Warnings)); + if (outcome.SettingsChanged) context.Log(Loc.L("Advisor.Log.AutoUpdated", title)); + if (outcome.SettingsUnreadable) context.Log(Loc.L("Advisor.Log.ProjectUnreadable", title)); + if (outcome.Presets.Count > 0) context.Log(Loc.L("Advisor.Log.Presets", string.Join(" · ", outcome.Presets.Select(p => p.DisplayName())))); } /// Next target and the failed targets to retry first; a missing or unreadable checkpoint starts over. diff --git a/tests/Titano.Core.Tests/Advice/AdvisorLocalizationTests.cs b/tests/Titano.Core.Tests/Advice/AdvisorLocalizationTests.cs index e32ec414..4545b4de 100644 --- a/tests/Titano.Core.Tests/Advice/AdvisorLocalizationTests.cs +++ b/tests/Titano.Core.Tests/Advice/AdvisorLocalizationTests.cs @@ -19,6 +19,7 @@ public sealed partial class AdvisorLocalizationTests(TestContext context) { private static readonly CultureInfo English = CultureInfo.GetCultureInfo("en"); private static readonly CultureInfo Italian = CultureInfo.GetCultureInfo("it"); + private const string LogPrefix = "Advisor.Log."; [Test] public void EveryAdvisorKeyHasEnglishAndItalianTextWithTheSamePlaceholders() @@ -26,7 +27,9 @@ public sealed partial class AdvisorLocalizationTests(TestContext context) var manager = new ResourceManager("Titano.Core.i18n.Advisor", typeof(Loc).Assembly); var english = Entries(manager.GetResourceSet(CultureInfo.InvariantCulture, createIfNotExists: true, tryParents: false)!); var italian = Entries(manager.GetResourceSet(Italian, createIfNotExists: true, tryParents: false)!); - var keys = Keys(typeof(AdvisorKeys)).Concat(Keys(typeof(FindingKeys))).Concat(Keys(typeof(DeepFindingKeys))).ToList(); + // Job log lines (Advisor.Log.*) are written by the analysis job handlers in Titano.Data, not by the advisor itself. + 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); foreach (var key in keys) { diff --git a/tests/Titano.Data.Tests/Processing/AnalysisJobTests.cs b/tests/Titano.Data.Tests/Processing/AnalysisJobTests.cs index 9e15fe7f..1f03927c 100644 --- a/tests/Titano.Data.Tests/Processing/AnalysisJobTests.cs +++ b/tests/Titano.Data.Tests/Processing/AnalysisJobTests.cs @@ -47,7 +47,7 @@ public sealed class AnalysisJobTests(TestContext context) Assert.True(row.Status.HasFlag(SequenceStatus.AnalyzedLight), "index status"); Assert.False(row.Status.HasFlag(SequenceStatus.AnalyzedDeep), "no deep status without a report"); Assert.True(ManifestStore.ReadSequence(folder.ManifestPath).Status.HasFlag(SequenceStatus.AnalyzedLight), "sidecar status"); - Assert.Contains(Loc.L("Jobs.Analysis.AutoUpdated", sequence.DisplayTitle), done.LogTail); + Assert.Contains(Loc.L("Advisor.Log.AutoUpdated", sequence.DisplayTitle), done.LogTail); // Idempotent: a second pass changes nothing. var version = row.SettingsVersion; @@ -103,7 +103,7 @@ public sealed class AnalysisJobTests(TestContext context) Assert.NotNull((await fx.Db.Frames.ListBySequenceAsync(sequence.Id, cancellationToken: fx.Ct))[5].MeanLogLuminance); var project = ProjectSettings.FromJson(await File.ReadAllTextAsync(folder.ProjectPath, fx.Ct)); Assert.True(project.Exposure.Deflicker.HasAdvice, "deflicker advised from the pixels"); - Assert.Contains(Loc.L("Jobs.Analysis.Presets", string.Empty), done.LogTail); + Assert.Contains(Loc.L("Advisor.Log.Presets", string.Empty), done.LogTail); } [Test] @@ -131,7 +131,7 @@ public sealed class AnalysisJobTests(TestContext context) Assert.SequenceEqual([true, true, true], await AnalysedAsync(fx, a, b, c)); Assert.Equal((3L, 3L), (done.ProgressDone, done.ProgressTotal)); // The retry analysed B alone. - var lightOfA = Loc.L("Jobs.Analysis.LightDone", a.DisplayTitle, 10, 0).Split(',')[0]; + var lightOfA = Loc.L("Advisor.Log.LightDone", a.DisplayTitle, 10, 0).Split(',')[0]; Assert.Equal(1, done.LogTail!.Split('\n').Count(line => line.Contains(lightOfA, StringComparison.Ordinal))); }