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,8 +41,16 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus
|
|||||||
var ns = $"{type.Namespace!}::{type.Name}".ToUpperInvariant().Replace(".", "::");
|
var ns = $"{type.Namespace!}::{type.Name}".ToUpperInvariant().Replace(".", "::");
|
||||||
var key = $"root::{ns}::T{fallbackEN.ToFNV32()}";
|
var key = $"root::{ns}::T{fallbackEN.ToFNV32()}";
|
||||||
|
|
||||||
|
if(this.Lang is NoPluginLanguage)
|
||||||
|
return fallbackEN;
|
||||||
|
|
||||||
if(this.Lang.TryGetText(key, out var text, logWarning: false))
|
if(this.Lang.TryGetText(key, out var text, logWarning: false))
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(text))
|
||||||
|
return fallbackEN;
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
this.Logger.LogWarning($"Missing translation key '{key}' for content '{fallbackEN}'.");
|
this.Logger.LogWarning($"Missing translation key '{key}' for content '{fallbackEN}'.");
|
||||||
return fallbackEN;
|
return fallbackEN;
|
||||||
|
Loading…
Reference in New Issue
Block a user