Skip to content

Added more text content to the localization #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
549 changes: 549 additions & 0 deletions app/MindWork AI Studio/Assistants/I18N/allTexts.lua

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
@using AIStudio.Settings.DataModel
@using AIStudio.Tools.ERIClient.DataModel
@inherits MSGComponentBase

<MudDialog>
<DialogContent>
<MudForm @ref="@this.form" @bind-IsValid="@this.dataIsValid" @bind-Errors="@this.dataIssues">
@* ReSharper disable once CSharpWarnings::CS8974 *@
<MudTextField
T="string"
@bind-Text="@this.dataName"
Label="Data Source Name"
Label="@T("Data Source Name")"
Class="mb-6"
MaxLength="40"
Counter="40"
Expand All @@ -24,7 +26,7 @@
<MudTextField
T="string"
@bind-Text="@this.dataHostname"
Label="ERI v1 Server Hostname"
Label="@T("ERI v1 Server Hostname")"
Class="mb-6"
Immediate="@true"
Validation="@this.dataSourceValidation.ValidatingHostname"
Expand All @@ -35,7 +37,7 @@
UserAttributes="@SPELLCHECK_ATTRIBUTES"/>

<MudNumericField
Label="Port"
Label="@T("Port")"
Immediate="@true"
Min="1" Max="65535"
Validation="@this.dataSourceValidation.ValidatePort"
Expand All @@ -47,17 +49,15 @@
@if (!this.IsConnectionEncrypted())
{
<MudJustifiedText Typo="Typo.body1" Color="Color.Error" Class="mb-3">
Please note: the connection to the ERI v1 server is not encrypted. This means that all
data sent to the server is transmitted in plain text. Please ask the ERI server administrator
to enable encryption.
@T("Please note: the connection to the ERI v1 server is not encrypted. This means that all data sent to the server is transmitted in plain text. Please ask the ERI server administrator to enable encryption.")
</MudJustifiedText>
}

@if (this.IsConnectionPossible())
{
<MudStack Row="@true" AlignItems="AlignItems.Center">
<MudButton Variant="Variant.Filled" Color="@this.GetTestResultColor()" StartIcon="@this.GetTestResultIcon()" Class="mb-3" OnClick="@this.TestConnection">
Test connection & read available metadata
@T("Test connection & read available metadata")
</MudButton>
<MudText Typo="Typo.body1" Class="mb-3">
@this.GetTestResultText()
Expand All @@ -70,7 +70,9 @@
<MudSelect @bind-Value="@this.dataAuthMethod" Text="@this.dataAuthMethod.DisplayName()" Label="Authentication Method" Class="mb-3" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.dataSourceValidation.ValidateAuthMethod">
@foreach (var authMethod in this.availableAuthMethods)
{
<MudSelectItem Value="@authMethod">@authMethod.DisplayName()</MudSelectItem>
<MudSelectItem Value="@authMethod">
@authMethod.DisplayName()
</MudSelectItem>
}
</MudSelect>
}
Expand All @@ -83,7 +85,7 @@
<MudTextField
T="string"
@bind-Text="@this.dataUsername"
Label="Username"
Label="@T("Username")"
Class="mb-6"
Immediate="@true"
Validation="@this.dataSourceValidation.ValidateUsername"
Expand Down Expand Up @@ -112,7 +114,7 @@

@if (this.availableRetrievalProcesses.Count > 0)
{
<MudSelect @bind-Value="@this.dataSelectedRetrievalProcess" Text="@this.dataSelectedRetrievalProcess.Name" Label="Select one retrieval process" Class="mb-3" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.dataSourceValidation.ValidateRetrievalProcess">
<MudSelect @bind-Value="@this.dataSelectedRetrievalProcess" Text="@this.dataSelectedRetrievalProcess.Name" Label="@T("Select one retrieval process")" Class="mb-3" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.dataSourceValidation.ValidateRetrievalProcess">
@foreach (var retrievalProcess in this.availableRetrievalProcesses)
{
<MudSelectItem Value="@retrievalProcess">
Expand All @@ -122,7 +124,7 @@
</MudSelect>
}

<MudSelect @bind-Value="@this.dataSecurityPolicy" Text="@this.dataSecurityPolicy.ToSelectionText()" Label="Your security policy" Class="mb-3" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.dataSourceValidation.ValidateSecurityPolicy">
<MudSelect @bind-Value="@this.dataSecurityPolicy" Text="@this.dataSecurityPolicy.ToSelectionText()" Label="@T("Your security policy")" Class="mb-3" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.dataSourceValidation.ValidateSecurityPolicy">
@foreach (var policy in Enum.GetValues<DataSourceSecurity>())
{
<MudSelectItem Value="@policy">
Expand All @@ -135,15 +137,17 @@
<Issues IssuesData="@this.dataIssues"/>
</DialogContent>
<DialogActions>
<MudButton OnClick="@this.Cancel" Variant="Variant.Filled">Cancel</MudButton>
<MudButton OnClick="@this.Cancel" Variant="Variant.Filled">
@T("Cancel")
</MudButton>
<MudButton OnClick="@this.Store" Variant="Variant.Filled" Color="Color.Primary">
@if(this.IsEditing)
{
@:Update
@T("Update")
}
else
{
@:Add
@T("Add")
}
</MudButton>
</DialogActions>
Expand Down
22 changes: 10 additions & 12 deletions app/MindWork AI Studio/Dialogs/DataSourceERI_V1Dialog.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AIStudio.Assistants.ERI;
using AIStudio.Components;
using AIStudio.Settings;
using AIStudio.Settings.DataModel;
using AIStudio.Tools.ERIClient;
Expand All @@ -13,7 +14,7 @@
// ReSharper disable InconsistentNaming
namespace AIStudio.Dialogs;

public partial class DataSourceERI_V1Dialog : ComponentBase, ISecretId
public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
{
[CascadingParameter]
private IMudDialogInstance MudDialog { get; set; } = null!;
Expand All @@ -24,9 +25,6 @@ public partial class DataSourceERI_V1Dialog : ComponentBase, ISecretId
[Parameter]
public DataSourceERI_V1 DataSource { get; set; }

[Inject]
private SettingsManager SettingsManager { get; init; } = null!;

[Inject]
private ILogger<ProviderDialog> Logger { get; init; } = null!;

Expand Down Expand Up @@ -195,7 +193,7 @@ private async Task TestConnection()
await this.form.Validate();

Array.Resize(ref this.dataIssues, this.dataIssues.Length + 1);
this.dataIssues[^1] = "Failed to connect to the ERI v1 server. The server is not supported.";
this.dataIssues[^1] = T("Failed to connect to the ERI v1 server. The server is not supported.");
return;
}

Expand Down Expand Up @@ -254,7 +252,7 @@ private async Task TestConnection()
await this.form.Validate();

Array.Resize(ref this.dataIssues, this.dataIssues.Length + 1);
this.dataIssues[^1] = $"Failed to connect to the ERI v1 server. The message was: {e.Message}";
this.dataIssues[^1] = string.Format(T("Failed to connect to the ERI v1 server. The message was: {0}"), e.Message);
this.Logger.LogError($"Failed to connect to the ERI v1 server. Message: {e.Message}");

this.connectionTested = true;
Expand All @@ -265,9 +263,9 @@ private async Task TestConnection()
private string GetTestResultText()
{
if(!this.connectionTested)
return "Not tested yet.";
return T("Not tested yet.");

return this.connectionSuccessfulTested ? "Connection successful." : "Connection failed.";
return this.connectionSuccessfulTested ? T("Connection successful.") : T("Connection failed.");
}

private Color GetTestResultColor()
Expand All @@ -290,9 +288,9 @@ private string GetTestResultIcon()

private string GetSecretLabel() => this.dataAuthMethod switch
{
AuthMethod.TOKEN => "Access Token",
AuthMethod.USERNAME_PASSWORD => "Password",
_ => "Secret",
AuthMethod.TOKEN => T("Access Token"),
AuthMethod.USERNAME_PASSWORD => T("Password"),
_ => T("Secret"),
};

private async Task Store()
Expand Down Expand Up @@ -320,7 +318,7 @@ private async Task Store()
var storeResponse = await this.RustService.SetSecret(this, this.dataSecret);
if (!storeResponse.Success)
{
this.dataSecretStorageIssue = $"Failed to store the auth. secret in the operating system. The message was: {storeResponse.Issue}. Please try again.";
this.dataSecretStorageIssue = string.Format(T("Failed to store the auth. secret in the operating system. The message was: {0}. Please try again."), storeResponse.Issue);
await this.form.Validate();
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,66 +1,64 @@
@using AIStudio.Settings.DataModel
@using AIStudio.Tools.ERIClient.DataModel

@inherits MSGComponentBase
<MudDialog>
<DialogContent>

<MudText Typo="Typo.h5">
Common data source information
@T("Common data source information")
</MudText>

<TextInfoLine Icon="@Icons.Material.Filled.Tag" Label="Data source name" Value="@this.DataSource.Name" ClipboardTooltipSubject="the data source name"/>
<TextInfoLine Icon="@Icons.Material.Filled.NetworkCheck" Label="ERI server hostname" Value="@this.DataSource.Hostname" ClipboardTooltipSubject="the ERI server hostname"/>
<TextInfoLine Icon="@Icons.Material.Filled.Tag" Label="ERI server port" Value="@this.Port" ClipboardTooltipSubject="the ERI server port"/>
<TextInfoLine Icon="@Icons.Material.Filled.Tag" Label="@T("Data source name")" Value="@this.DataSource.Name" ClipboardTooltipSubject="@T("the data source name")"/>
<TextInfoLine Icon="@Icons.Material.Filled.NetworkCheck" Label="@T("ERI server hostname")" Value="@this.DataSource.Hostname" ClipboardTooltipSubject="@T("the ERI server hostname")"/>
<TextInfoLine Icon="@Icons.Material.Filled.Tag" Label="@T("ERI server port")" Value="@this.Port" ClipboardTooltipSubject="@T("the ERI server port")"/>

@if (!this.IsConnectionEncrypted())
{
<MudJustifiedText Typo="Typo.body1" Color="Color.Error" Class="mb-3">
Please note: the connection to the ERI v1 server is not encrypted. This means that all
data sent to the server is transmitted in plain text. Please ask the ERI server administrator
to enable encryption.
@T("Please note: the connection to the ERI v1 server is not encrypted. This means that all data sent to the server is transmitted in plain text. Please ask the ERI server administrator to enable encryption.")
</MudJustifiedText>
}

@if (this.DataSource.AuthMethod is AuthMethod.USERNAME_PASSWORD)
{
<TextInfoLine Icon="@Icons.Material.Filled.Person2" Label="Username" Value="@this.DataSource.Username" ClipboardTooltipSubject="the username"/>
<TextInfoLine Icon="@Icons.Material.Filled.Person2" Label="@T("Username")" Value="@this.DataSource.Username" ClipboardTooltipSubject="@T("the username")"/>
}

<TextInfoLines Label="Server description" MaxLines="14" Value="@this.serverDescription" ClipboardTooltipSubject="the server description"/>
<TextInfoLines Label="Security requirements of the data provider" MaxLines="3" Value="@this.securityRequirements.Explain()" ClipboardTooltipSubject="the security requirements of the data provider"/>
<TextInfoLines Label="Your security policy" MaxLines="3" Value="@this.DataSource.SecurityPolicy.ToInfoText()" Color="@this.DataSource.SecurityPolicy.GetColor()" ClipboardTooltipSubject="your security policy"/>
<TextInfoLines Label="@T("Server description")" MaxLines="14" Value="@this.serverDescription" ClipboardTooltipSubject="@T("the server description")"/>
<TextInfoLines Label="@T("Security requirements of the data provider")" MaxLines="3" Value="@this.securityRequirements.Explain()" ClipboardTooltipSubject="@T("the security requirements of the data provider")"/>
<TextInfoLines Label="@T("Your security policy")" MaxLines="3" Value="@this.DataSource.SecurityPolicy.ToInfoText()" Color="@this.DataSource.SecurityPolicy.GetColor()" ClipboardTooltipSubject="@T("your security policy")"/>

<MudText Typo="Typo.h5" Class="mt-6">
Retrieval information
@T("Retrieval information")
</MudText>
@if (!this.retrievalInfoformation.Any())
{
<MudJustifiedText Typo="Typo.body1" Color="Color.Info" Class="mb-3">
The data source does not provide any retrieval information.
@T("The data source does not provide any retrieval information.")
</MudJustifiedText>
}
else
{
<MudExpansionPanels Class="mb-3">
<ExpansionPanel HeaderText="@this.RetrievalName(this.selectedRetrievalInfo)" HeaderIcon="@Icons.Material.Filled.Info">
<TextInfoLines Label="Description" MaxLines="14" Value="@this.selectedRetrievalInfo.Description" ClipboardTooltipSubject="the retrieval description"/>
<TextInfoLines Label="Parameters" MaxLines="14" Value="@this.RetrievalParameters(this.selectedRetrievalInfo)" ClipboardTooltipSubject="the retrieval parameters"/>
<TextInfoLines Label="Description" MaxLines="14" Value="@this.selectedRetrievalInfo.Description" ClipboardTooltipSubject="@T("the retrieval description")"/>
<TextInfoLines Label="Parameters" MaxLines="14" Value="@this.RetrievalParameters(this.selectedRetrievalInfo)" ClipboardTooltipSubject="@T("the retrieval parameters")"/>

@if (!string.IsNullOrWhiteSpace(this.selectedRetrievalInfo.Link))
{
<MudButton Href="@this.selectedRetrievalInfo.Link" Target="_blank" Class="mt-3" Color="Color.Primary" StartIcon="@Icons.Material.Filled.OpenInNew">
Open web link, show more information
@T("Open web link, show more information")
</MudButton>
}

<MudText Typo="Typo.h6" Class="mt-3">
Embeddings
@T("Embeddings")
</MudText>
@* ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract *@
@if (this.selectedRetrievalInfo.Embeddings is null || !this.selectedRetrievalInfo.Embeddings.Any())
{
<MudJustifiedText Typo="Typo.body1" Color="Color.Info" Class="mb-3">
The data source does not provide any embedding information.
@T("The data source does not provide any embedding information.")
</MudJustifiedText>
}
else
Expand All @@ -70,14 +68,14 @@
{
var embedding = this.selectedRetrievalInfo.Embeddings[embeddingIndex];
<ExpansionPanel HeaderText="@embedding.EmbeddingName" HeaderIcon="@Icons.Material.Filled.Info" IsExpanded="embeddingIndex == 0">
<TextInfoLine Icon="@Icons.Material.Filled.FormatShapes" Label="Type" Value="@embedding.EmbeddingType" ClipboardTooltipSubject="the embedding type"/>
<TextInfoLines Label="Description" MaxLines="14" Value="@embedding.Description" ClipboardTooltipSubject="the embedding description"/>
<TextInfoLines Label="When to use" MaxLines="3" Value="@embedding.UsedWhen" ClipboardTooltipSubject="when is the embedding used"/>
<TextInfoLine Icon="@Icons.Material.Filled.FormatShapes" Label="Type" Value="@embedding.EmbeddingType" ClipboardTooltipSubject="@T("the embedding type")"/>
<TextInfoLines Label="@T("Description")" MaxLines="14" Value="@embedding.Description" ClipboardTooltipSubject="@T("the embedding description")"/>
<TextInfoLines Label="@T("When to use")" MaxLines="3" Value="@embedding.UsedWhen" ClipboardTooltipSubject="@T("when is the embedding used")"/>

@if (!string.IsNullOrWhiteSpace(embedding.Link))
{
<MudButton Href="@embedding.Link" Target="_blank" Class="mt-3" Color="Color.Primary" StartIcon="@Icons.Material.Filled.OpenInNew">
Open web link, show more information
@T("Open web link, show more information")
</MudButton>
}
</ExpansionPanel>
Expand All @@ -95,7 +93,11 @@
{
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="ml-5 mr-5"/>
}
<MudButton OnClick="@this.GetERIMetadata" Variant="Variant.Filled" Color="Color.Info">Reload</MudButton>
<MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
<MudButton OnClick="@this.GetERIMetadata" Variant="Variant.Filled" Color="Color.Info">
@T("Reload")
</MudButton>
<MudButton OnClick="@this.Close" Variant="Variant.Filled">
@T("Close")
</MudButton>
</DialogActions>
</MudDialog>
Loading