Implement Fractured Locales for User Profiles

Initial implementation before cleanup
This commit is contained in:
_Neo_
2026-01-04 17:40:09 +02:00
parent beb7dfe7a6
commit af59454e19
16 changed files with 844 additions and 690 deletions

View File

@@ -94,7 +94,7 @@ namespace Ryujinx.Ava.UI.Applet
ContentDialog contentDialog = new()
{
Title = LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle],
Title = LocaleManager.Instance[LocaleKeys.UserProfiles_WindowTitle],
PrimaryButtonText = LocaleManager.Instance[LocaleKeys.Continue],
SecondaryButtonText = string.Empty,
CloseButtonText = LocaleManager.Instance[LocaleKeys.Cancel],

View File

@@ -71,7 +71,7 @@ namespace Ryujinx.Ava.UI.Controls
NavigationDialogHost content = new(ownerAccountManager, ownerContentManager, ownerVirtualFileSystem, ownerHorizonClient);
ContentDialog contentDialog = new()
{
Title = LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle],
Title = LocaleManager.Instance[LocaleKeys.UserProfiles_WindowTitle],
PrimaryButtonText = string.Empty,
SecondaryButtonText = string.Empty,
CloseButtonText = string.Empty,

View File

@@ -27,7 +27,7 @@ namespace Ryujinx.Ava.UI.ViewModels
private readonly AccountManager _accountManager;
public string SaveManagerHeading => LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SaveManagerHeading, _accountManager.LastOpenedUser.Name, _accountManager.LastOpenedUser.UserId);
public string UserProfiles_SaveManagerHeading => LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.UserProfiles_SaveManagerHeading, _accountManager.LastOpenedUser.Name, _accountManager.LastOpenedUser.UserId);
public UserSaveManagerViewModel(AccountManager accountManager)
{

View File

@@ -136,7 +136,7 @@
<MenuItem
Command="{Binding ManageProfiles}"
Padding="0"
Header="{ext:Locale MenuBarOptionsManageUserProfiles}"
Header="{ext:Locale UserProfiles_MenuBarOptions_OpenUserProfiles}"
Icon="{ext:Icon fa-solid fa-user}"
IsEnabled="{Binding EnableNonGameRunningControls}"
Classes="withCheckbox">

View File

@@ -14,15 +14,15 @@
x:DataType="models:TempProfile">
<Grid Margin="0,10,0,0" ColumnDefinitions="Auto,*" RowDefinitions="*,Auto">
<StackPanel Spacing="10">
<TextBlock Text="{ext:Locale UserProfilesName}" />
<TextBlock Text="{ext:Locale UserProfiles_NameLabel}" />
<TextBox
Name="NameBox"
Margin="0,0,0,5"
Width="300"
MaxLength="{Binding MaxProfileNameLength}"
Watermark="{ext:Locale ProfileNameSelectionWatermark}"
Watermark="{ext:Locale UserProfiles_ProfileNameSelectionWatermark}"
Text="{Binding Name}" />
<TextBlock Name="IdText" Text="{ext:Locale UserProfilesUserId}" />
<TextBlock Name="IdText" Text="{ext:Locale UserProfiles_UserIdLabel}" />
<TextBox
Name="IdLabel"
Width="300"
@@ -66,11 +66,11 @@
<Button.Flyout>
<MenuFlyout Placement="Bottom">
<MenuItem
Header="{ext:Locale ProfileImageSelectionImportImage}"
Header="{ext:Locale UserProfiles_ProfileImage_Import}"
Icon="{ext:Icon fa-solid fa-image}"
Click="Import_OnClick" />
<MenuItem
Header="{ext:Locale ProfileImageSelectionSelectAvatar}"
Header="{ext:Locale UserProfiles_ProfileImage_SelectAvatar}"
Icon="{ext:Icon fa-solid fa-floppy-disk}"
Click="SelectFirmwareImage_OnClick" />
</MenuFlyout>
@@ -98,10 +98,10 @@
Margin="0,30,0,0"
Spacing="10">
<Button Name="DeleteButton" Click="DeleteButton_Click">
<TextBlock Text="{ext:Locale UserProfilesDelete}" />
<TextBlock Text="{ext:Locale UserProfiles_Delete}" />
</Button>
<Button Name="SaveButton" Click="SaveButton_Click">
<TextBlock Text="{ext:Locale Save}" />
<TextBlock Text="{ext:Locale UserProfiles_Save}" />
</Button>
</StackPanel>
</Grid>

View File

@@ -29,7 +29,7 @@ namespace Ryujinx.Ava.UI.Views.User
private bool _isNewUser;
public static uint MaxProfileNameLength => 0x20;
public bool IsDeletable => _profile.UserId != AccountManager.DefaultUserId;
public string UserEditorTitle => LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.UserEditorTitle, _profile.Name);
public string UserEditorTitle => LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.UserProfiles_UserEditorTitle, _profile.Name);
public UserEditorView()
{
InitializeComponent();
@@ -62,8 +62,8 @@ namespace Ryujinx.Ava.UI.Views.User
}
((ContentDialog)_parent.Parent).Title =
$"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - " +
$"{(_isNewUser ? LocaleManager.Instance[LocaleKeys.UserEditorTitleNewUser] : UserEditorTitle)}";
$"{LocaleManager.Instance[LocaleKeys.UserProfiles_WindowTitle]} - " +
$"{(_isNewUser ? LocaleManager.Instance[LocaleKeys.UserProfiles_UserEditorTitleNewUser] : UserEditorTitle)}";
bool hasProfile = _profile != null;
IdLabel.IsVisible = hasProfile;
@@ -82,9 +82,9 @@ namespace Ryujinx.Ava.UI.Views.User
if (hasUnsavedChanges)
{
bool confirm = await ContentDialogHelper.CreateChoiceDialog(
LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesTitle],
LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesMessage],
LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesSubMessage]);
LocaleManager.Instance[LocaleKeys.UserProfiles_DialogUserProfileUnsavedChangesTitle],
LocaleManager.Instance[LocaleKeys.UserProfiles_DialogUserProfileUnsavedChangesMessage],
LocaleManager.Instance[LocaleKeys.UserProfiles_DialogUserProfileUnsavedChangesSubMessage]);
if (confirm)
_parent?.GoBack();
@@ -111,14 +111,14 @@ namespace Ryujinx.Ava.UI.Views.User
if (nameEmpty && imageMissing)
{
DataValidationErrors.SetError(NameBox, new DataValidationException(LocaleManager.Instance[LocaleKeys.UserProfileEmptyNameError]));
DataValidationErrors.SetError(NameBox, new DataValidationException(LocaleManager.Instance[LocaleKeys.UserProfiles_EmptyNameError]));
DataValidationErrors.SetError(ImageBox, new DataValidationException(""));
ImageBox.BorderBrush = Brush.Parse("#ff99a4");
return;
}
else if (nameEmpty)
{
DataValidationErrors.SetError(NameBox,new DataValidationException(LocaleManager.Instance[LocaleKeys.UserProfileEmptyNameError]));
DataValidationErrors.SetError(NameBox,new DataValidationException(LocaleManager.Instance[LocaleKeys.UserProfiles_EmptyNameError]));
return;
}
else if (imageMissing)
@@ -162,7 +162,7 @@ namespace Ryujinx.Ava.UI.Views.User
var window = (Window)this.GetVisualRoot()!;
var result = await window.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.LoadSupportedImageFormatDialogTitle],
Title = LocaleManager.Instance[LocaleKeys.UserProfiles_SupportedImageFormatDialogTitle],
AllowMultiple = false,
FileTypeFilter = new List<FilePickerFileType>
{

View File

@@ -99,10 +99,10 @@
</ui:ColorPickerButton.Styles>
</ui:ColorPickerButton>
<Button
Content="{ext:Locale AvatarChoose}"
Content="{ext:Locale UserProfiles_AvatarChoose}"
Height="37"
Click="ChooseButton_OnClick">
<TextBlock Text="{ext:Locale AvatarChoose}" />
<TextBlock Text="{ext:Locale UserProfiles_AvatarChoose}" />
</Button>
</StackPanel>
</Grid>

View File

@@ -48,8 +48,8 @@ namespace Ryujinx.Ava.UI.Views.User
ContentManager = _parent.ContentManager;
((ContentDialog)_parent.Parent).Title =
$"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - " +
$"{LocaleManager.Instance[LocaleKeys.ProfileImageSelectionHeader]}";
$"{LocaleManager.Instance[LocaleKeys.UserProfiles_WindowTitle]} - " +
$"{LocaleManager.Instance[LocaleKeys.UserProfiles_AvatarSelectionTitle]}";
_ = Task.Run(() =>
{

View File

@@ -57,7 +57,7 @@
Margin="5"
Command="{Binding Recover}"
CommandParameter="{Binding}">
<TextBlock Text="{ext:Locale Recover}" />
<TextBlock Text="{ext:Locale UserProfiles_RecoverProfile}" />
</Button>
</Grid>
</Border>
@@ -67,7 +67,7 @@
<TextBlock
IsVisible="{Binding IsEmpty}"
TextAlignment="Center"
Text="{ext:Locale UserProfilesRecoverEmptyList}"/>
Text="{ext:Locale UserProfiles_RecoverProfile_EmptyList}"/>
</Panel>
</Border>
<StackPanel

View File

@@ -32,7 +32,7 @@ namespace Ryujinx.Ava.UI.Views.User
_parent = parent;
((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.UserProfilesRecoverLostAccounts]}";
((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfiles_WindowTitle]} - {LocaleManager.Instance[LocaleKeys.UserProfiles_RecoverLostProfiles]}";
break;
}

View File

@@ -33,9 +33,9 @@
HorizontalContentAlignment="Left"
MinWidth="100">
<ComboBoxItem
Content="{ext:Locale Name}" />
Content="{ext:Locale UserProfiles_ManageSaves_SortByName}" />
<ComboBoxItem
Content="{ext:Locale Size}" />
Content="{ext:Locale UserProfiles_ManageSaves_SortBySize}" />
<ComboBox.Styles>
<Style Selector="ContentControl#ContentPresenter">
<Setter Property="HorizontalAlignment" Value="Left" />
@@ -46,9 +46,9 @@
HorizontalContentAlignment="Left"
MinWidth="150">
<ComboBoxItem
Content="{ext:Locale OrderAscending}" />
Content="{ext:Locale UserProfiles_ManageSaves_SortOrderAscending}" />
<ComboBoxItem
Content="{ext:Locale OrderDescending}" />
Content="{ext:Locale UserProfiles_ManageSaves_SortOrderDescending}" />
<ComboBox.Styles>
<Style Selector="ContentControl#ContentPresenter">
<Setter Property="HorizontalAlignment" Value="Left" />
@@ -65,7 +65,7 @@
Grid.Column="1"
HorizontalAlignment="Stretch"
Text="{Binding Search}"
Watermark="{ext:Locale Search}" />
Watermark="{ext:Locale UserProfiles_ManageSaves_Search}" />
</Grid>
</Grid>
<Border

View File

@@ -55,7 +55,7 @@ namespace Ryujinx.Ava.UI.Views.User
}
DataContext = ViewModel = new UserSaveManagerViewModel(_accountManager);
((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {ViewModel.SaveManagerHeading}";
((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfiles_WindowTitle]} - {ViewModel.UserProfiles_SaveManagerHeading}";
Task.Run(LoadSaves);
}
@@ -127,8 +127,8 @@ namespace Ryujinx.Ava.UI.Views.User
{
if (button.DataContext is SaveModel saveModel)
{
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(LocaleManager.Instance[LocaleKeys.DeleteUserSave],
LocaleManager.Instance[LocaleKeys.IrreversibleActionNote],
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(LocaleManager.Instance[LocaleKeys.UserProfiles_DeleteUserSave],
LocaleManager.Instance[LocaleKeys.UserProfiles_IrreversibleActionNote],
LocaleManager.Instance[LocaleKeys.InputDialogYes],
LocaleManager.Instance[LocaleKeys.InputDialogNo],
string.Empty);

View File

@@ -133,13 +133,13 @@
Spacing="10">
<Button
Click="ManageSaves">
<TextBlock Text="{ext:Locale UserProfilesManageSaves}" />
<TextBlock Text="{ext:Locale UserProfiles_ManageSaves}" />
</Button>
<Button
Click="RecoverLostAccounts">
<TextBlock
Text="{ext:Locale UserProfilesRecoverLostAccounts}"
ToolTip.Tip="{ext:Locale UserProfilesRecoverLostAccountsToolTip}" />
Text="{ext:Locale UserProfiles_RecoverLostProfiles}"
ToolTip.Tip="{ext:Locale UserProfiles_RecoverLostProfiles_ToolTip}" />
</Button>
</StackPanel>
<StackPanel
@@ -149,7 +149,7 @@
Orientation="Horizontal">
<Button
Click="Close">
<TextBlock Text="{ext:Locale SettingsButtonClose}" />
<TextBlock Text="{ext:Locale UserProfiles_ButtonClose}" />
</Button>
</StackPanel>
</Grid>

View File

@@ -40,7 +40,7 @@ namespace Ryujinx.Ava.UI.Views.User
if (arg.NavigationMode == NavigationMode.Back)
{
((ContentDialog)_parent.Parent).Title = LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle];
((ContentDialog)_parent.Parent).Title = LocaleManager.Instance[LocaleKeys.UserProfiles_WindowTitle];
}
DataContext = ViewModel;