mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-05-03 09:39:47 +00:00
Handle missing or empty translations in MSGComponentBase.
This commit is contained in:
parent
36df88a415
commit
2caf291db3
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user