Show the title in the configured language when launching an application
This commit is contained in:
parent
49e390b1d5
commit
360f98c577
3 changed files with 16 additions and 10 deletions
|
@ -187,7 +187,10 @@ namespace Ryujinx.UI
|
|||
: IntegrityCheckLevel.None;
|
||||
|
||||
// Instantiate GUI objects.
|
||||
ApplicationLibrary = new ApplicationLibrary(_virtualFileSystem, checkLevel);
|
||||
ApplicationLibrary = new ApplicationLibrary(_virtualFileSystem, checkLevel)
|
||||
{
|
||||
DesiredTitleLanguage = ConfigurationState.Instance.System.Language,
|
||||
};
|
||||
_uiHandler = new GtkHostUIHandler(this);
|
||||
_deviceExitStatus = new AutoResetEvent(false);
|
||||
|
||||
|
@ -737,7 +740,8 @@ namespace Ryujinx.UI
|
|||
|
||||
Thread applicationLibraryThread = new(() =>
|
||||
{
|
||||
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs, ConfigurationState.Instance.System.Language);
|
||||
ApplicationLibrary.DesiredTitleLanguage = ConfigurationState.Instance.System.Language;
|
||||
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs);
|
||||
|
||||
_updatingGameTable = false;
|
||||
})
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace Ryujinx.UI.App.Common
|
|||
{
|
||||
public class ApplicationLibrary
|
||||
{
|
||||
public Language DesiredTitleLanguage { get; set; }
|
||||
public event EventHandler<ApplicationAddedEventArgs> ApplicationAdded;
|
||||
public event EventHandler<ApplicationCountUpdatedEventArgs> ApplicationCountUpdated;
|
||||
|
||||
|
@ -45,7 +46,6 @@ namespace Ryujinx.UI.App.Common
|
|||
|
||||
private readonly VirtualFileSystem _virtualFileSystem;
|
||||
private readonly IntegrityCheckLevel _checkLevel;
|
||||
private Language _desiredTitleLanguage;
|
||||
private CancellationTokenSource _cancellationToken;
|
||||
|
||||
private static readonly ApplicationJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
@ -221,7 +221,7 @@ namespace Ryujinx.UI.App.Common
|
|||
{
|
||||
using UniqueRef<IFile> icon = new();
|
||||
|
||||
controlFs.OpenFile(ref icon.Ref, $"/icon_{_desiredTitleLanguage}.dat".ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
controlFs.OpenFile(ref icon.Ref, $"/icon_{DesiredTitleLanguage}.dat".ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
using MemoryStream stream = new();
|
||||
|
||||
|
@ -477,13 +477,11 @@ namespace Ryujinx.UI.App.Common
|
|||
controlFile.Get.Read(out _, 0, outProperty, ReadOption.None).ThrowIfFailure();
|
||||
}
|
||||
|
||||
public void LoadApplications(List<string> appDirs, Language desiredTitleLanguage)
|
||||
public void LoadApplications(List<string> appDirs)
|
||||
{
|
||||
int numApplicationsFound = 0;
|
||||
int numApplicationsLoaded = 0;
|
||||
|
||||
_desiredTitleLanguage = desiredTitleLanguage;
|
||||
|
||||
_cancellationToken = new CancellationTokenSource();
|
||||
|
||||
// Builds the applications list with paths to found applications
|
||||
|
@ -832,7 +830,7 @@ namespace Ryujinx.UI.App.Common
|
|||
|
||||
private void GetApplicationInformation(ref ApplicationControlProperty controlData, ref ApplicationData data)
|
||||
{
|
||||
_ = Enum.TryParse(_desiredTitleLanguage.ToString(), out TitleLanguage desiredTitleLanguage);
|
||||
_ = Enum.TryParse(DesiredTitleLanguage.ToString(), out TitleLanguage desiredTitleLanguage);
|
||||
|
||||
if (controlData.Title.ItemsRo.Length > (int)desiredTitleLanguage)
|
||||
{
|
||||
|
|
|
@ -225,7 +225,10 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
? IntegrityCheckLevel.ErrorOnInvalid
|
||||
: IntegrityCheckLevel.None;
|
||||
|
||||
ApplicationLibrary = new ApplicationLibrary(VirtualFileSystem, checkLevel);
|
||||
ApplicationLibrary = new ApplicationLibrary(VirtualFileSystem, checkLevel)
|
||||
{
|
||||
DesiredTitleLanguage = ConfigurationState.Instance.System.Language,
|
||||
};
|
||||
|
||||
// Save data created before we supported extra data in directory save data will not work properly if
|
||||
// given empty extra data. Luckily some of that extra data can be created using the data from the
|
||||
|
@ -634,7 +637,8 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
Thread applicationLibraryThread = new(() =>
|
||||
{
|
||||
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs, ConfigurationState.Instance.System.Language);
|
||||
ApplicationLibrary.DesiredTitleLanguage = ConfigurationState.Instance.System.Language;
|
||||
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs);
|
||||
|
||||
_isLoading = false;
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue