Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c20b1c6
Fixed data collection for Lua comments
SommerEngineering Apr 27, 2025
8f27281
Enhance localization support by adding namespace and type parameters …
SommerEngineering Apr 27, 2025
18aadeb
Refactor IDisposable implementation in MSGComponentBase to improve re…
SommerEngineering Apr 27, 2025
989fb05
Fixed order of initialization
SommerEngineering Apr 27, 2025
ae0cb4c
Added missed text content
SommerEngineering Apr 27, 2025
8896a3c
Added more dialogs & components
SommerEngineering Apr 27, 2025
ea7a899
Updated
SommerEngineering Apr 27, 2025
1a59df8
Added German translation
SommerEngineering Apr 27, 2025
3f2b851
Added abbreviation for TB in code style settings
SommerEngineering Apr 27, 2025
09d87d2
Updated
SommerEngineering Apr 27, 2025
b1c0cb3
Remove generic suffix from type names in ILangExtensions
SommerEngineering Apr 27, 2025
74f6b07
Update German translations for clarity and consistency
SommerEngineering Apr 27, 2025
ad3c428
Refactor Vision and Home components to initialize items on async load…
SommerEngineering Apr 27, 2025
bcde1c2
Formatting
SommerEngineering Apr 27, 2025
22ce747
Refactor FindAllTextTags method to support multiple start tags and im…
SommerEngineering Apr 27, 2025
dc34028
Remove debug logging for language plugin checks
SommerEngineering Apr 27, 2025
b1319fa
Trigger state update for MudDialog on initialization to update the he…
SommerEngineering Apr 27, 2025
a3a1483
Enhance plugin loading with improved error handling and file reading …
SommerEngineering Apr 27, 2025
2492a58
Improve hot reload logic with enhanced logging and semaphore management
SommerEngineering Apr 27, 2025
ed58bae
Add new UI text entries and improve existing translations for chat co…
SommerEngineering Apr 27, 2025
28d6159
Added missed tooltip to the I18N system
SommerEngineering Apr 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enhance localization support by adding namespace and type parameters …
…for base classes
  • Loading branch information
SommerEngineering committed Apr 27, 2025
commit 8f2728127dab485975fd4b7cb80808820f98cd55
2 changes: 2 additions & 0 deletions app/MindWork AI Studio/Assistants/AssistantBase.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender)

#endregion

private string TB(string fallbackEN) => this.T(fallbackEN, typeof(AssistantBase<TSettings>).Namespace, nameof(AssistantBase<TSettings>));

private string SubmitButtonStyle => this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence ? this.providerSettings.UsedLLMProvider.GetConfidence(this.SettingsManager).StyleBorder(this.SettingsManager) : string.Empty;

protected string? ValidatingProvider(AIStudio.Settings.Provider provider)
Expand Down
3 changes: 3 additions & 0 deletions app/MindWork AI Studio/Components/MSGComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ protected override async Task OnInitializedAsync()

/// <inheritdoc />
public string T(string fallbackEN) => this.GetText(this.Lang, fallbackEN);

/// <inheritdoc />
public string T(string fallbackEN, string? typeNamespace, string? typeName) => this.GetText(this.Lang, fallbackEN, typeNamespace, typeName);

#endregion

Expand Down
4 changes: 4 additions & 0 deletions app/MindWork AI Studio/Layout/MainLayout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ private void LoadNavItems()

#region Implementation of ILang

/// <inheritdoc />
public string T(string fallbackEN) => this.GetText(this.Lang, fallbackEN);

/// <inheritdoc />
public string T(string fallbackEN, string? typeNamespace, string? typeName) => this.GetText(this.Lang, fallbackEN, typeNamespace, typeName);

#endregion

#region Implementation of IMessageBusReceiver
Expand Down
20 changes: 20 additions & 0 deletions app/MindWork AI Studio/Tools/PluginSystem/ILang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,24 @@ public interface ILang
/// <param name="fallbackEN">The fallback text in English (US).</param>
/// <returns>The text from the language plugin or the fallback text.</returns>
public string T(string fallbackEN);

/// <summary>
/// Tries to get a text from the language plugin.
/// </summary>
/// <remarks>
/// The given fallback text is used to determine the key for
/// the language plugin. Base for the key is the namespace of
/// the using component and the fallback text in English (US).
/// The given text is hashed. When the key does not exist,
/// the fallback text will be returned.<br/>
/// <br/>
/// You might predefine the namespace and type. This is needed
/// when your abstract base class component wants to localize
/// text as well.
/// </remarks>
/// <param name="fallbackEN">The fallback text in English (US).</param>
/// <param name="typeNamespace">The namespace of the type requesting the text, used as part of the key.</param>
/// <param name="typeName">The name of the type requesting the text, used as part of the key.</param>
/// <returns>The text from the language plugin or the fallback text.</returns>
public string T(string fallbackEN, string? typeNamespace, string? typeName);
}
7 changes: 5 additions & 2 deletions app/MindWork AI Studio/Tools/PluginSystem/ILangExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ public static class ILangExtensions
{
private static readonly ILogger<ILang> LOGGER = Program.LOGGER_FACTORY.CreateLogger<ILang>();

public static string GetText(this ILang lang, ILanguagePlugin plugin, string fallbackEN)
public static string GetText(this ILang lang, ILanguagePlugin plugin, string fallbackEN, string? typeNamespace = null, string? typeName = null)
{
var type = lang.GetType();
var ns = $"{type.Namespace!}::{type.Name}".ToUpperInvariant().Replace(".", "::");
typeName ??= type.Name;
typeNamespace ??= type.Namespace!;

var ns = $"{typeNamespace}::{typeName}".ToUpperInvariant().Replace(".", "::");
var key = $"root::{ns}::T{fallbackEN.ToFNV32()}";

if(plugin is NoPluginLanguage)
Expand Down