From 2caf291db39615596982c5838b88b317178ccf87 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 17 Apr 2025 12:25:56 +0200 Subject: [PATCH] Handle missing or empty translations in MSGComponentBase. --- .../Components/MSGComponentBase.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/MindWork AI Studio/Components/MSGComponentBase.cs b/app/MindWork AI Studio/Components/MSGComponentBase.cs index 7767bd31..fa0c456d 100644 --- a/app/MindWork AI Studio/Components/MSGComponentBase.cs +++ b/app/MindWork AI Studio/Components/MSGComponentBase.cs @@ -41,9 +41,17 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus var ns = $"{type.Namespace!}::{type.Name}".ToUpperInvariant().Replace(".", "::"); var key = $"root::{ns}::T{fallbackEN.ToFNV32()}"; - if(this.Lang.TryGetText(key, out var text, logWarning: false)) - return text; + if(this.Lang is NoPluginLanguage) + return fallbackEN; + if(this.Lang.TryGetText(key, out var text, logWarning: false)) + { + if(string.IsNullOrWhiteSpace(text)) + return fallbackEN; + + return text; + } + this.Logger.LogWarning($"Missing translation key '{key}' for content '{fallbackEN}'."); return fallbackEN; }