From 088e4ad7e391d2499654db59de7cbb27c960e093 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 17 Apr 2025 12:26:14 +0200 Subject: [PATCH] Refactor for localization support using translation helpers. --- app/MindWork AI Studio/Pages/Assistants.razor | 28 +++++----- app/MindWork AI Studio/Pages/Chat.razor | 4 +- app/MindWork AI Studio/Pages/Home.razor | 18 +++---- app/MindWork AI Studio/Pages/Home.razor.cs | 27 +++++----- app/MindWork AI Studio/Pages/Plugins.razor | 14 ++--- app/MindWork AI Studio/Pages/Settings.razor | 2 +- app/MindWork AI Studio/Pages/Supporters.razor | 52 ++++++++++--------- app/MindWork AI Studio/Pages/Writer.razor | 8 +-- app/MindWork AI Studio/Pages/Writer.razor.cs | 11 +--- 9 files changed, 80 insertions(+), 84 deletions(-) diff --git a/app/MindWork AI Studio/Pages/Assistants.razor b/app/MindWork AI Studio/Pages/Assistants.razor index e988a738..2acaa4ca 100644 --- a/app/MindWork AI Studio/Pages/Assistants.razor +++ b/app/MindWork AI Studio/Pages/Assistants.razor @@ -14,40 +14,40 @@ General - - - - - + + + + + Business - - - - - - + + + + + + Learning - + Software Engineering - + @if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager)) { - + } diff --git a/app/MindWork AI Studio/Pages/Chat.razor b/app/MindWork AI Studio/Pages/Chat.razor index b95a9d62..5652e846 100644 --- a/app/MindWork AI Studio/Pages/Chat.razor +++ b/app/MindWork AI Studio/Pages/Chat.razor @@ -25,7 +25,7 @@ // Case: Sidebar can be toggled and is currently visible - + @@ -88,7 +88,7 @@ - Your workspaces + @T("Your workspaces") diff --git a/app/MindWork AI Studio/Pages/Home.razor b/app/MindWork AI Studio/Pages/Home.razor index 0b035995..d2bfdb93 100644 --- a/app/MindWork AI Studio/Pages/Home.razor +++ b/app/MindWork AI Studio/Pages/Home.razor @@ -12,31 +12,29 @@ - Welcome to MindWork AI Studio! + @T("Welcome to MindWork AI Studio!") - Thank you for considering MindWork AI Studio for your AI needs. This app is designed to help you harness - the power of Large Language Models (LLMs). Please note that this app doesn't come with an integrated - LLM. Instead, you will need to bring an API key from a suitable provider. + @T("Thank you for considering MindWork AI Studio for your AI needs. This app is designed to help you harness the power of Large Language Models (LLMs). Please note that this app doesn't come with an integrated LLM. Instead, you will need to bring an API key from a suitable provider.") - Here's what makes MindWork AI Studio stand out: + @T("Here's what makes MindWork AI Studio stand out:") - + - We hope you enjoy using MindWork AI Studio to bring your AI projects to life! + @T("We hope you enjoy using MindWork AI Studio to bring your AI projects to life!") - + - + - + diff --git a/app/MindWork AI Studio/Pages/Home.razor.cs b/app/MindWork AI Studio/Pages/Home.razor.cs index 4468e651..1bf9cad8 100644 --- a/app/MindWork AI Studio/Pages/Home.razor.cs +++ b/app/MindWork AI Studio/Pages/Home.razor.cs @@ -13,12 +13,27 @@ public partial class Home : MSGComponentBase private string LastChangeContent { get; set; } = string.Empty; + private TextItem[] itemsAdvantages = []; + #region Overrides of ComponentBase protected override async Task OnInitializedAsync() { await this.ReadLastChangeAsync(); await base.OnInitializedAsync(); + + this.itemsAdvantages = [ + new(T("Free of charge"), T("The app is free to use, both for personal and commercial purposes.")), + new(T("Independence"), T("You are not tied to any single provider. Instead, you might choose the provider that best suits your needs. Right now, we support OpenAI (GPT4o, o1, etc.), Mistral, Anthropic (Claude), Google Gemini, xAI (Grok), DeepSeek, and self-hosted models using llama.cpp, ollama, LM Studio, Groq, or Fireworks. For scientists and employees of research institutions, we also support Helmholtz and GWDG AI services. These are available through federated logins like eduGAIN to all 18 Helmholtz Centers, the Max Planck Society, most German, and many international universities.")), + new(T("Assistants"), T("You just want to quickly translate a text? AI Studio has so-called assistants for such and other tasks. No prompting is necessary when working with these assistants.")), + new(T("Unrestricted usage"), T("Unlike services like ChatGPT, which impose limits after intensive use, MindWork AI Studio offers unlimited usage through the providers API.")), + new(T("Cost-effective"), T("You only pay for what you use, which can be cheaper than monthly subscription services like ChatGPT Plus, especially if used infrequently. But beware, here be dragons: For extremely intensive usage, the API costs can be significantly higher. Unfortunately, providers currently do not offer a way to display current costs in the app. Therefore, check your account with the respective provider to see how your costs are developing. When available, use prepaid and set a cost limit.")), + new(T("Privacy"), T("You can control which providers receive your data using the provider confidence settings. For example, you can set different protection levels for writing emails compared to general chats, etc. Additionally, most providers guarantee that they won't use your data to train new AI systems.")), + new(T("Flexibility"), T("Choose the provider and model best suited for your current task.")), + new(T("No bloatware"), T("The app requires minimal storage for installation and operates with low memory usage. Additionally, it has a minimal impact on system resources, which is beneficial for battery life.")), + ]; + + this.StateHasChanged(); } #endregion @@ -36,18 +51,6 @@ public partial class Home : MSGComponentBase this.LastChangeContent = await response.Content.ReadAsStringAsync(); } - private static readonly TextItem[] ITEMS_ADVANTAGES = - [ - new("Free of charge", "The app is free to use, both for personal and commercial purposes."), - new("Independence", "You are not tied to any single provider. Instead, you might choose the provider that best suits your needs. Right now, we support OpenAI (GPT4o, o1, etc.), Mistral, Anthropic (Claude), Google Gemini, xAI (Grok), DeepSeek, and self-hosted models using llama.cpp, ollama, LM Studio, Groq, or Fireworks. For scientists and employees of research institutions, we also support Helmholtz and GWDG AI services. These are available through federated logins like eduGAIN to all 18 Helmholtz Centers, the Max Planck Society, most German, and many international universities."), - new("Assistants", "You just want to quickly translate a text? AI Studio has so-called assistants for such and other tasks. No prompting is necessary when working with these assistants."), - new("Unrestricted usage", "Unlike services like ChatGPT, which impose limits after intensive use, MindWork AI Studio offers unlimited usage through the providers API."), - new("Cost-effective", "You only pay for what you use, which can be cheaper than monthly subscription services like ChatGPT Plus, especially if used infrequently. But beware, here be dragons: For extremely intensive usage, the API costs can be significantly higher. Unfortunately, providers currently do not offer a way to display current costs in the app. Therefore, check your account with the respective provider to see how your costs are developing. When available, use prepaid and set a cost limit."), - new("Privacy", "You can control which providers receive your data using the provider confidence settings. For example, you can set different protection levels for writing emails compared to general chats, etc. Additionally, most providers guarantee that they won't use your data to train new AI systems."), - new("Flexibility", "Choose the provider and model best suited for your current task."), - new("No bloatware", "The app requires minimal storage for installation and operates with low memory usage. Additionally, it has a minimal impact on system resources, which is beneficial for battery life."), - ]; - private const string QUICK_START_GUIDE = """ Ready to dive in and get started with MindWork AI Studio? This quick start guide will help you set up everything you need to start using the app. diff --git a/app/MindWork AI Studio/Pages/Plugins.razor b/app/MindWork AI Studio/Pages/Plugins.razor index 8306d6d1..0db15706 100644 --- a/app/MindWork AI Studio/Pages/Plugins.razor +++ b/app/MindWork AI Studio/Pages/Plugins.razor @@ -4,7 +4,7 @@
- Plugins + @T("Plugins") @@ -18,8 +18,8 @@ - Plugins - Actions + @T("Plugins") + @T("Actions") @@ -27,19 +27,19 @@ { case GROUP_ENABLED: - Enabled Plugins + @T("Enabled Plugins") break; case GROUP_DISABLED: - Disabled Plugins + @T("Disabled Plugins") break; case GROUP_INTERNAL: - Internal Plugins + @T("Internal Plugins") break; } @@ -67,7 +67,7 @@ @if (!context.IsInternal) { var isEnabled = this.SettingsManager.IsPluginEnabled(context); - + } diff --git a/app/MindWork AI Studio/Pages/Settings.razor b/app/MindWork AI Studio/Pages/Settings.razor index ebcd9248..9cc28223 100644 --- a/app/MindWork AI Studio/Pages/Settings.razor +++ b/app/MindWork AI Studio/Pages/Settings.razor @@ -4,7 +4,7 @@ @inherits MSGComponentBase
- Settings + @T("Settings") diff --git a/app/MindWork AI Studio/Pages/Supporters.razor b/app/MindWork AI Studio/Pages/Supporters.razor index 8e32052c..a35d4fd1 100644 --- a/app/MindWork AI Studio/Pages/Supporters.razor +++ b/app/MindWork AI Studio/Pages/Supporters.razor @@ -2,22 +2,26 @@ @inherits MSGComponentBase
- Supporters + + @T("Supporters") + - +
- Our Titans - - In this section, we highlight the titan supporters of MindWork AI Studio. Titans are prestigious companies that provide significant support to our mission. + + @T("Our Titans") - For companies, sponsoring MindWork AI Studio is not only a way to support innovation but also a valuable opportunity for public relations and marketing. Your company's name and logo will be featured prominently, showcasing your commitment to using cutting-edge AI tools and enhancing your reputation as an innovative enterprise. + @T("In this section, we highlight the titan supporters of MindWork AI Studio. Titans are prestigious companies that provide significant support to our mission.") + + + @T("For companies, sponsoring MindWork AI Studio is not only a way to support innovation but also a valuable opportunity for public relations and marketing. Your company's name and logo will be featured prominently, showcasing your commitment to using cutting-edge AI tools and enhancing your reputation as an innovative enterprise.") - Become our first Titan + @T("Become our first Titan")
@@ -26,27 +30,27 @@ - Individual Contributors + @T("Individual Contributors") - Become a contributor + @T("Become a contributor") - The first 10 supporters who make a monthly contribution: + @T("The first 10 supporters who make a monthly contribution:") - - - + + + - The first 10 supporters who make a one-time contribution: + @T("The first 10 supporters who make a one-time contribution:") - + @@ -55,11 +59,11 @@ - Business Contributors + @T("Business Contributors") - Become a contributor + @T("Become a contributor") @@ -73,14 +77,14 @@ - Code Contributions + @T("Code Contributions") - - - - + + + + @@ -89,11 +93,11 @@ - Moderation, Design, Wiki, and Documentation + @T("Moderation, Design, Wiki, and Documentation") - + diff --git a/app/MindWork AI Studio/Pages/Writer.razor b/app/MindWork AI Studio/Pages/Writer.razor index 790e3e07..bead1792 100644 --- a/app/MindWork AI Studio/Pages/Writer.razor +++ b/app/MindWork AI Studio/Pages/Writer.razor @@ -3,7 +3,7 @@
- Writer + @T("Writer") @@ -13,7 +13,7 @@ Logger { get; init; } = null!; @@ -158,13 +158,4 @@ public partial class Writer : MSGComponentBase, IAsyncDisposable this.suggestion = string.Join(' ', words.Skip(1)); this.StateHasChanged(); } - - #region Implementation of IAsyncDisposable - - public ValueTask DisposeAsync() - { - return ValueTask.CompletedTask; - } - - #endregion } \ No newline at end of file