From 87c70eef4e40cf3b4882f775c67f6d2e3be74d70 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 2 Oct 2026 12:26:18 +0000 Subject: [PATCH] feat(i18n): export, render and encoder messages; check keys passed as data Adds the Export catalog (en, it) for preset names, plan and render warnings and encoder notices. i18n check now treats C# string literals shaped Area.Group.Name with an existing area as used keys, which is how these 53 keys had gone unnoticed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- i18n/en/Export.resx | 60 ++++++++++++++++++++++++ i18n/it/Export.it.resx | 60 ++++++++++++++++++++++++ src/Titano.Tools/Commands/I18nCommand.cs | 19 ++++++-- 3 files changed, 136 insertions(+), 3 deletions(-) create mode 100644 i18n/en/Export.resx create mode 100644 i18n/it/Export.it.resx diff --git a/i18n/en/Export.resx b/i18n/en/Export.resx new file mode 100644 index 00000000..b5dafdeb --- /dev/null +++ b/i18n/en/Export.resx @@ -0,0 +1,60 @@ + + + text/microsoft-resx + 2.0 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + {0}-bit output is not available with this encoder; encoding at {1}-bit.long; {0} requested bit depth; {1} bit depth used + Bit rate capped at {1} bit/s, the maximum of level {0}.long; {0} codec level name; {1} maximum bit rate in bit/s + No {0} encoder on this PC; H.264 is used instead.long; {0} codec name + The server cannot encode {0}; a render node or the desktop client will.long; {0} codec name + No encoder available for {0}.long; {0} codec name + Resolution reduced to {1}, the maximum of {0}.long; {0} encoder name; {1} size as WIDTHxHEIGHT + Resolution reduced to {1}, the maximum of level {0}.long; {0} codec level name; {1} size as WIDTHxHEIGHT + No hardware encoder: {0} encodes in software, which is slower.long; {0} encoder name + {0} cannot encode 10-bit; 8-bit is used.long; {0} encoder name + Playback rate not understood; the export frame rate is used.long + No capture times: frames are spaced evenly.long + Every frame is excluded.long + The time curve went backwards and was straightened.long + 1080p 60 fpsinvariant + Share 1080p + 1440p H.264invariant + 4K 60 fpsinvariant + 4K archive + 4K AV1invariant + 4K H.264invariant + 4K HEVCinvariant + 8K archive + Animated PNG + Cinema 21:9invariant + DCI 4Kinvariant + Animated GIF + JPEG frames + Linear DNG + MJPEG AVIinvariant + PNG frames + Portrait 4:5 + Preview 720p + Square 1:1 + TIFF 16-bit + Vertical 9:16 + The preset's {1} frame replaces the {0} aspect ratio.long; {0} requested aspect ratio; {1} preset frame as W:H + Aspect ratio “{0}” not understood; the source aspect ratio is used.long; {0} aspect ratio text as entered + Motion blur is off while frames are stacked.long + The crop lies outside the frame and is ignored.long + Easing “{0}” not understood; linear is used.long; {0} easing name as entered + The keyframe at frame {0} is invalid and was skipped.long; {0} source frame number + Highlight knee {0} is out of range and is ignored.long; {0} knee value as entered + Every frame is excluded; there is nothing to render.long + No sky and land mask; deflicker uses the whole frame.long + The sky and land mask is uncertain (confidence {0}); deflicker uses the whole frame.long; {0} mask confidence between 0 and 1 + Strong shake: stabilisation would keep only {0} of the frame, so borders may show.long; {0} kept fraction of the frame between 0 and 1 + Stabilisation is unavailable: too little detail to track.long + The container does not suit the codec; the codec's container is used.long + Unknown codec; the preset's codec is used.long + Unknown frame rate; the preset's frame rate is used.long + Unknown preset; the default preset is used.long + Unknown profile; the codec's default profile is used.long + Unknown rate control; the preset's rate control is used.long + diff --git a/i18n/it/Export.it.resx b/i18n/it/Export.it.resx new file mode 100644 index 00000000..513b88a6 --- /dev/null +++ b/i18n/it/Export.it.resx @@ -0,0 +1,60 @@ + + + text/microsoft-resx + 2.0 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + Uscita a {0} bit non disponibile con questo encoder; codifica a {1} bit. + Bit rate limitato a {1} bit/s, il massimo del livello {0}. + Nessun encoder {0} su questo PC; viene usato H.264. + Il server non può codificare {0}; lo farà un nodo di rendering o il client desktop. + Nessun encoder disponibile per {0}. + Risoluzione ridotta a {1}, il massimo di {0}. + Risoluzione ridotta a {1}, il massimo del livello {0}. + Nessun encoder hardware: {0} codifica via software, più lentamente. + {0} non codifica a 10 bit; viene usato 8 bit. + Velocità di riproduzione non valida; viene usata la frequenza di esportazione. + Nessun orario di scatto: fotogrammi distribuiti in modo uniforme. + Tutti i fotogrammi sono esclusi. + La curva del tempo tornava indietro ed è stata corretta. + 1080p 60 fps + Condivisione 1080p + 1440p H.264 + 4K 60 fps + Archivio 4K + 4K AV1 + 4K H.264 + 4K HEVC + Archivio 8K + PNG animato + Cinema 21:9 + DCI 4K + GIF animata + Fotogrammi JPEG + DNG lineare + MJPEG AVI + Fotogrammi PNG + Ritratto 4:5 + Anteprima 720p + Quadrato 1:1 + TIFF 16 bit + Verticale 9:16 + Il formato {1} del preset sostituisce le proporzioni {0}. + Proporzioni «{0}» non valide; vengono usate quelle della sorgente. + La sfocatura di movimento è disattivata mentre i fotogrammi sono sovrapposti. + Il ritaglio è fuori dall'immagine e viene ignorato. + Andamento «{0}» non valido; viene usato quello lineare. + Il fotogramma chiave {0} non è valido ed è stato saltato. + Compressione delle alte luci {0} fuori intervallo, ignorata. + Tutti i fotogrammi sono esclusi: non c'è nulla da renderizzare. + Nessuna maschera cielo/terra; il deflicker usa l'intera immagine. + La maschera cielo/terra è incerta (affidabilità {0}); il deflicker usa l'intera immagine. + Vibrazioni forti: la stabilizzazione conserverebbe solo {0} dell'immagine, i bordi possono vedersi. + Stabilizzazione non disponibile: troppo pochi dettagli da tracciare. + Il contenitore non è adatto al codec; viene usato quello del codec. + Codec sconosciuto; viene usato quello del preset. + Frequenza sconosciuta; viene usata quella del preset. + Preset sconosciuto; viene usato quello predefinito. + Profilo sconosciuto; viene usato quello predefinito del codec. + Controllo del bit rate sconosciuto; viene usato quello del preset. + diff --git a/src/Titano.Tools/Commands/I18nCommand.cs b/src/Titano.Tools/Commands/I18nCommand.cs index fa657663..dc4fa4d2 100644 --- a/src/Titano.Tools/Commands/I18nCommand.cs +++ b/src/Titano.Tools/Commands/I18nCommand.cs @@ -80,7 +80,8 @@ internal sealed partial class I18nCommand : ICommand errors.Add($"{culture}: orphan key {key}"); } - foreach (var (file, key) in UsedKeys(root)) + var areas = en.Keys.Select(k => k[..k.IndexOf('.')]).ToHashSet(StringComparer.Ordinal); + foreach (var (file, key) in UsedKeys(root, areas)) { if (en.ContainsKey(key)) continue; // Prefix lookups such as L("Settings.Page." + page) are satisfied by any key under the prefix. @@ -133,8 +134,12 @@ internal sealed partial class I18nCommand : ICommand private static HashSet Placeholders(string s) => [.. PlaceholderRegex().Matches(s).Select(m => m.Groups[1].Value)]; - /// Keys referenced from C# (L("…"), Plural("…"), Loc.Get("…")), XAML ({l:Loc …}) and admin JS (t("…")). - private static IEnumerable<(string File, string Key)> UsedKeys(string root) + /// + /// Keys referenced from C# (L("…"), Plural("…"), Loc.Get("…"), and any string literal shaped + /// Area.Group.Name whose area has a catalog, since reason and warning keys travel as data), XAML + /// ({l:Loc …}) and admin JS (t("…")). + /// + private static IEnumerable<(string File, string Key)> UsedKeys(string root, IReadOnlySet areas) { var src = Path.Combine(root, "src"); foreach (var file in Directory.EnumerateFiles(src, "*.*", SearchOption.AllDirectories)) @@ -152,6 +157,11 @@ internal sealed partial class I18nCommand : ICommand if (regex is null) continue; var text = File.ReadAllText(file); foreach (Match m in regex.Matches(text)) yield return (file, m.Groups[1].Value); + if (ext != ".cs") continue; + foreach (Match m in CsKeyLiteralRegex().Matches(text)) + { + if (areas.Contains(m.Groups[2].Value)) yield return (file, m.Groups[1].Value); + } } } @@ -161,6 +171,9 @@ internal sealed partial class I18nCommand : ICommand [GeneratedRegex(@"\b(?:L|Plural|Loc\.Get|LocKey)\(\s*""([A-Z][A-Za-z0-9]*\.[A-Za-z0-9_.]+)""")] private static partial Regex CsKeyRegex(); + [GeneratedRegex(@"(?