diff --git a/app/MindWork AI Studio/Tools/PluginSystem/ILanguagePlugin.cs b/app/MindWork AI Studio/Tools/PluginSystem/ILanguagePlugin.cs
index 5b9fd895..8766a2e7 100644
--- a/app/MindWork AI Studio/Tools/PluginSystem/ILanguagePlugin.cs
+++ b/app/MindWork AI Studio/Tools/PluginSystem/ILanguagePlugin.cs
@@ -19,6 +19,15 @@ public interface ILanguagePlugin
/// True if the key exists, false otherwise.
public bool TryGetText(string key, out string value);
+ ///
+ /// Gets the text from the language plugin.
+ ///
+ ///
+ /// When the key does not exist, the value will be an empty string.
+ ///
+ /// The key to use to get the text.
+ public string this[string key] { get; }
+
///
/// Gets the IETF tag of the language plugin.
///
diff --git a/app/MindWork AI Studio/Tools/PluginSystem/PluginLanguage.cs b/app/MindWork AI Studio/Tools/PluginSystem/PluginLanguage.cs
index c5865ffa..95f6c1ba 100644
--- a/app/MindWork AI Studio/Tools/PluginSystem/PluginLanguage.cs
+++ b/app/MindWork AI Studio/Tools/PluginSystem/PluginLanguage.cs
@@ -40,39 +40,6 @@ public sealed class PluginLanguage : PluginBase, ILanguagePlugin
///
/// The language plugin to add.
public void AddOtherLanguagePlugin(ILanguagePlugin languagePlugin) => this.otherLanguagePlugins.Add(languagePlugin);
-
- ///
- /// Tries to get a text from the language plugin.
- ///
- ///
- /// When the key neither in the base language nor in this language exist,
- /// the value will be an empty string. Please note that the key is case-sensitive.
- /// Furthermore, the keys are in the format "root::key". That means that
- /// the keys are hierarchical and separated by "::".
- ///
- /// The key to use to get the text.
- /// The desired text.
- /// True if the key exists, false otherwise.
- public bool TryGetText(string key, out string value)
- {
- // First, we check if the key is part of the main language pack:
- if (this.content.TryGetValue(key, out value!))
- return true;
-
- // Second, we check if the key is part of the other language packs, such as the assistant plugins:
- foreach (var otherLanguagePlugin in this.otherLanguagePlugins)
- if(otherLanguagePlugin.TryGetText(key, out value))
- return true;
-
- // Finally, we check if the key is part of the base language pack. This is the case,
- // when a language plugin does not cover all keys. In this case, the base language plugin
- // will be used to fill in the missing keys:
- if(this.baseLanguage is not null && this.baseLanguage.TryGetText(key, out value))
- return true;
-
- value = string.Empty;
- return false;
- }
///
/// Tries to initialize the IETF tag.
@@ -152,6 +119,44 @@ public sealed class PluginLanguage : PluginBase, ILanguagePlugin
return true;
}
+ #region Implementation of ILanguagePlugin
+
+ ///
+ /// Tries to get a text from the language plugin.
+ ///
+ ///
+ /// When the key neither in the base language nor in this language exist,
+ /// the value will be an empty string. Please note that the key is case-sensitive.
+ /// Furthermore, the keys are in the format "root::key". That means that
+ /// the keys are hierarchical and separated by "::".
+ ///
+ /// The key to use to get the text.
+ /// The desired text.
+ /// True if the key exists, false otherwise.
+ public bool TryGetText(string key, out string value)
+ {
+ // First, we check if the key is part of the main language pack:
+ if (this.content.TryGetValue(key, out value!))
+ return true;
+
+ // Second, we check if the key is part of the other language packs, such as the assistant plugins:
+ foreach (var otherLanguagePlugin in this.otherLanguagePlugins)
+ if(otherLanguagePlugin.TryGetText(key, out value))
+ return true;
+
+ // Finally, we check if the key is part of the base language pack. This is the case,
+ // when a language plugin does not cover all keys. In this case, the base language plugin
+ // will be used to fill in the missing keys:
+ if(this.baseLanguage is not null && this.baseLanguage.TryGetText(key, out value))
+ return true;
+
+ value = string.Empty;
+ return false;
+ }
+
+ ///
+ public string this[string key] => this.TryGetText(key, out var value) ? value : "string.Empty";
+
///
public string IETFTag => this.langCultureTag;