mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-13 03:21:37 +00:00
Fixed localization of profiles
This commit is contained in:
parent
c9b257a408
commit
830eb9973c
@ -7,7 +7,7 @@
|
||||
@if (this.CurrentChatTemplate != ChatTemplate.NO_CHAT_TEMPLATE)
|
||||
{
|
||||
<MudButton IconSize="Size.Large" StartIcon="@Icons.Material.Filled.RateReview" IconColor="Color.Default">
|
||||
@this.CurrentChatTemplate.Name
|
||||
@this.CurrentChatTemplate.GetSafeName()
|
||||
</MudButton>
|
||||
}
|
||||
else
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
@if (this.CurrentProfile != Profile.NO_PROFILE)
|
||||
{
|
||||
<MudButton IconSize="Size.Large" StartIcon="@Icons.Material.Filled.Person4" IconColor="Color.Default">
|
||||
@this.CurrentProfile.Name
|
||||
@this.CurrentProfile.GetSafeName()
|
||||
</MudButton>
|
||||
}
|
||||
else
|
||||
@ -20,7 +20,7 @@
|
||||
@foreach (var profile in this.SettingsManager.ConfigurationData.Profiles.GetAllProfiles())
|
||||
{
|
||||
<MudMenuItem Icon="@this.ProfileIcon(profile)" OnClick="() => this.SelectionChanged(profile)">
|
||||
@profile.Name
|
||||
@profile.GetSafeName()
|
||||
</MudMenuItem>
|
||||
}
|
||||
</ChildContent>
|
||||
|
||||
@ -22,7 +22,7 @@ public record Profile(
|
||||
|
||||
public static readonly Profile NO_PROFILE = new()
|
||||
{
|
||||
Name = TB("Use no profile"),
|
||||
Name = TB("Use no profile"), // Cannot be localized due to being a static readonly field
|
||||
NeedToKnow = string.Empty,
|
||||
Actions = string.Empty,
|
||||
Id = Guid.Empty.ToString(),
|
||||
@ -39,6 +39,23 @@ public record Profile(
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of this profile. If it is the NO_PROFILE, it returns a localized string.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Why not using the Name property directly? Because the Name property of NO_PROFILE cannot be
|
||||
/// localized because it is a static readonly field. So we need this method to return a localized
|
||||
/// string instead.
|
||||
/// </remarks>
|
||||
/// <returns>The name of this profile.</returns>
|
||||
public string GetSafeName()
|
||||
{
|
||||
if(this == NO_PROFILE)
|
||||
return TB("Use no profile");
|
||||
|
||||
return this.Name;
|
||||
}
|
||||
|
||||
public string ToSystemPrompt()
|
||||
{
|
||||
if(this.Num == uint.MaxValue)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user