diff --git a/Ryujinx.Ava/Assets/Locales/de_DE.json b/Ryujinx.Ava/Assets/Locales/de_DE.json index adda79ca..671f369e 100644 --- a/Ryujinx.Ava/Assets/Locales/de_DE.json +++ b/Ryujinx.Ava/Assets/Locales/de_DE.json @@ -1,4 +1,5 @@ { + "Language": "Deutsch", "MenuBarFileOpenApplet": "Applet öffnen", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Öffnet das Mii Editor Applet im Standalone Modus", "SettingsTabInputDirectMouseAccess": "Direkter Mauszugriff", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Konto wiederherstellen", "Recover": "Wiederherstellen", "UserProfilesRecoverHeading": "Speicherstände wurden für die folgenden Konten gefunden" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/el_GR.json b/Ryujinx.Ava/Assets/Locales/el_GR.json index aef474ac..5cd7a554 100644 --- a/Ryujinx.Ava/Assets/Locales/el_GR.json +++ b/Ryujinx.Ava/Assets/Locales/el_GR.json @@ -1,4 +1,5 @@ { + "Language": "Ελληνικά", "MenuBarFileOpenApplet": "Άνοιγμα Applet", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Άνοιγμα του Mii Editor Applet σε Αυτόνομη λειτουργία", "SettingsTabInputDirectMouseAccess": "Άμεση Πρόσβαση Ποντικιού", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Recover Lost Accounts", "Recover": "Recover", "UserProfilesRecoverHeading": "Saves were found for the following accounts" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/en_US.json b/Ryujinx.Ava/Assets/Locales/en_US.json index afd3f393..46203463 100644 --- a/Ryujinx.Ava/Assets/Locales/en_US.json +++ b/Ryujinx.Ava/Assets/Locales/en_US.json @@ -1,4 +1,5 @@ { + "Language": "English (US)", "MenuBarFileOpenApplet": "Open Applet", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Open Mii Editor Applet in Standalone mode", "SettingsTabInputDirectMouseAccess": "Direct Mouse Access", @@ -610,4 +611,5 @@ "UserProfilesRecoverLostAccounts": "Recover Lost Accounts", "Recover": "Recover", "UserProfilesRecoverHeading" : "Saves were found for the following accounts" -} \ No newline at end of file +} + diff --git a/Ryujinx.Ava/Assets/Locales/es_ES.json b/Ryujinx.Ava/Assets/Locales/es_ES.json index 8275cdd8..1922318d 100644 --- a/Ryujinx.Ava/Assets/Locales/es_ES.json +++ b/Ryujinx.Ava/Assets/Locales/es_ES.json @@ -1,4 +1,5 @@ { + "Language": "Español (ES)", "MenuBarFileOpenApplet": "Abrir applet", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Abre el editor de Mii en modo autónomo", "SettingsTabInputDirectMouseAccess": "Acceso directo al ratón", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Recover Lost Accounts", "Recover": "Recover", "UserProfilesRecoverHeading": "Saves were found for the following accounts" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/fr_FR.json b/Ryujinx.Ava/Assets/Locales/fr_FR.json index 634a996c..938d0cc7 100644 --- a/Ryujinx.Ava/Assets/Locales/fr_FR.json +++ b/Ryujinx.Ava/Assets/Locales/fr_FR.json @@ -1,4 +1,5 @@ { + "Language": "Français", "MenuBarFileOpenApplet": "Ouvrir Applet", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Ouvrir l'Applet Mii Editor en mode Standalone", "SettingsTabInputDirectMouseAccess": "Accès direct à la souris", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Récupérer les comptes perdus", "Recover": "Récupérer", "UserProfilesRecoverHeading": "Des sauvegardes ont été trouvées pour les comptes suivants" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/it_IT.json b/Ryujinx.Ava/Assets/Locales/it_IT.json index b53dbf37..fbdd4046 100644 --- a/Ryujinx.Ava/Assets/Locales/it_IT.json +++ b/Ryujinx.Ava/Assets/Locales/it_IT.json @@ -1,4 +1,5 @@ { + "Language": "Italiano", "MenuBarFileOpenApplet": "Apri Applet", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Apri l'applet Mii Editor in modalità Standalone", "SettingsTabInputDirectMouseAccess": "Accesso diretto al mouse", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Recupera il tuo account", "Recover": "Recupera", "UserProfilesRecoverHeading": "Sono stati trovati dei salvataggi per i seguenti account" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/ja_JP.json b/Ryujinx.Ava/Assets/Locales/ja_JP.json index c779056b..c88477f9 100644 --- a/Ryujinx.Ava/Assets/Locales/ja_JP.json +++ b/Ryujinx.Ava/Assets/Locales/ja_JP.json @@ -1,4 +1,5 @@ { + "Language": "日本語", "MenuBarFileOpenApplet": "アプレットを開く", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "スタンドアロンモードで Mii エディタアプレットを開きます", "SettingsTabInputDirectMouseAccess": "マウス直接アクセス", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "アカウントの復旧", "Recover": "復旧", "UserProfilesRecoverHeading": "以下のアカウントのセーブデータが見つかりました" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/ko_KR.json b/Ryujinx.Ava/Assets/Locales/ko_KR.json index 0efafc32..5379efa9 100644 --- a/Ryujinx.Ava/Assets/Locales/ko_KR.json +++ b/Ryujinx.Ava/Assets/Locales/ko_KR.json @@ -1,4 +1,5 @@ { + "Language": "한국어", "MenuBarFileOpenApplet": "애플릿 열기", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "독립 실행형 모드에서 Mii 편집기 애플릿 열기", "SettingsTabInputDirectMouseAccess": "직접 마우스 접속", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "잃어버린 계정 복구", "Recover": "복구", "UserProfilesRecoverHeading": "다음 계정에 대한 저장 발견" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/pl_PL.json b/Ryujinx.Ava/Assets/Locales/pl_PL.json index 020f54b8..3c1b541e 100644 --- a/Ryujinx.Ava/Assets/Locales/pl_PL.json +++ b/Ryujinx.Ava/Assets/Locales/pl_PL.json @@ -1,4 +1,5 @@ { + "Language": "Polski", "MenuBarFileOpenApplet": "Otwórz Aplet", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Otwórz aplet Mii Editor w trybie Indywidualnym", "SettingsTabInputDirectMouseAccess": "Bezpośredni Dostęp do Myszy", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Odzyskaj Utracone Konta", "Recover": "Odzyskaj", "UserProfilesRecoverHeading": "Znaleziono zapisy dla następujących kont" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/pt_BR.json b/Ryujinx.Ava/Assets/Locales/pt_BR.json index 6a377b0d..036b0a4b 100644 --- a/Ryujinx.Ava/Assets/Locales/pt_BR.json +++ b/Ryujinx.Ava/Assets/Locales/pt_BR.json @@ -1,4 +1,5 @@ { + "Language": "Português (BR)", "MenuBarFileOpenApplet": "Abrir Applet", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Abrir editor Mii em modo avulso", "SettingsTabInputDirectMouseAccess": "Acesso direto ao mouse", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Recuperar contas perdidas", "Recover": "Recuperar", "UserProfilesRecoverHeading": "Jogos salvos foram encontrados para as seguintes contas" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/ru_RU.json b/Ryujinx.Ava/Assets/Locales/ru_RU.json index b5eadd6b..b3ad82be 100644 --- a/Ryujinx.Ava/Assets/Locales/ru_RU.json +++ b/Ryujinx.Ava/Assets/Locales/ru_RU.json @@ -1,4 +1,5 @@ { + "Language": "Русский", "MenuBarFileOpenApplet": "Открыть апплет", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Открыть апплет Mii Editor в автономном режиме.", "SettingsTabInputDirectMouseAccess": "Прямой доступ с помощью мыши", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Recover Lost Accounts", "Recover": "Recover", "UserProfilesRecoverHeading": "Saves were found for the following accounts" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/tr_TR.json b/Ryujinx.Ava/Assets/Locales/tr_TR.json index 623ad34a..ae14cdaf 100644 --- a/Ryujinx.Ava/Assets/Locales/tr_TR.json +++ b/Ryujinx.Ava/Assets/Locales/tr_TR.json @@ -1,4 +1,5 @@ { + "Language": "Türkçe", "MenuBarFileOpenApplet": "Applet'i Aç", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Mii Editör Applet'ini Bağımsız Mod'da Aç", "SettingsTabInputDirectMouseAccess": "Doğrudan Mouse Erişimi", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Kayıp Hesapları Kurtar", "Recover": "Kurtar", "UserProfilesRecoverHeading": "Aşağıdaki hesaplar için kayıtlar bulundu" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/uk_UA.json b/Ryujinx.Ava/Assets/Locales/uk_UA.json index e28d47c2..01d433da 100644 --- a/Ryujinx.Ava/Assets/Locales/uk_UA.json +++ b/Ryujinx.Ava/Assets/Locales/uk_UA.json @@ -1,4 +1,5 @@ { + "Language": "Yкраїнська", "MenuBarFileOpenApplet": "Відкрити аплет", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "Відкрийте аплет Mii Editor в автономному режимі", "SettingsTabInputDirectMouseAccess": "Прямий доступ мишею", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "Відновлення втрачених облікових записів", "Recover": "Відновити", "UserProfilesRecoverHeading": "Знайдено збереження для наступних облікових записів" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/zh_CN.json b/Ryujinx.Ava/Assets/Locales/zh_CN.json index 1fcfe8da..cd76951a 100644 --- a/Ryujinx.Ava/Assets/Locales/zh_CN.json +++ b/Ryujinx.Ava/Assets/Locales/zh_CN.json @@ -1,4 +1,5 @@ { + "Language": "简体中文", "MenuBarFileOpenApplet": "打开小程序", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "打开独立的 Mii 小程序", "SettingsTabInputDirectMouseAccess": "直通鼠标操作", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "恢复丢失的账户", "Recover": "恢复", "UserProfilesRecoverHeading": "找到了这些用户的存档数据" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Assets/Locales/zh_TW.json b/Ryujinx.Ava/Assets/Locales/zh_TW.json index fcc16d78..963c0a83 100644 --- a/Ryujinx.Ava/Assets/Locales/zh_TW.json +++ b/Ryujinx.Ava/Assets/Locales/zh_TW.json @@ -1,4 +1,5 @@ { + "Language": "繁體中文", "MenuBarFileOpenApplet": "打開小程式", "MenuBarFileOpenAppletOpenMiiAppletToolTip": "打開獨立的 Mii 小程式", "SettingsTabInputDirectMouseAccess": "直通滑鼠操作", @@ -610,4 +611,4 @@ "UserProfilesRecoverLostAccounts": "恢復遺失的帳號", "Recover": "恢復", "UserProfilesRecoverHeading": "在以下帳號找到了一些遊戲存檔" -} \ No newline at end of file +} diff --git a/Ryujinx.Ava/Common/Locale/LocaleManager.cs b/Ryujinx.Ava/Common/Locale/LocaleManager.cs index c2251f85..5bcaa437 100644 --- a/Ryujinx.Ava/Common/Locale/LocaleManager.cs +++ b/Ryujinx.Ava/Common/Locale/LocaleManager.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; -using System.Text.Json; namespace Ryujinx.Ava.Common.Locale { diff --git a/Ryujinx.Ava/Ryujinx.Ava.csproj b/Ryujinx.Ava/Ryujinx.Ava.csproj index 5c001c67..996817b9 100644 --- a/Ryujinx.Ava/Ryujinx.Ava.csproj +++ b/Ryujinx.Ava/Ryujinx.Ava.csproj @@ -145,6 +145,7 @@ + @@ -165,6 +166,7 @@ + diff --git a/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml b/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml index 0d0ae119..bd26561a 100644 --- a/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml +++ b/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml @@ -77,63 +77,7 @@ - - - - - - - - - - - - - - - + menuItems = new(); + + string localePath = "Ryujinx.Ava/Assets/Locales"; + string localeExt = ".json"; + + string[] localesPath = EmbeddedResources.GetAllAvailableResources(localePath, localeExt); + + Array.Sort(localesPath); + + foreach (string locale in localesPath) + { + string languageCode = Path.GetFileNameWithoutExtension(locale).Split('.').Last(); + string languageJson = EmbeddedResources.ReadAllText($"{localePath}/{languageCode}{localeExt}"); + var strings = JsonHelper.Deserialize>(languageJson); + + if (!strings.TryGetValue("Language", out string languageName)) + { + languageName = languageCode; + } + + MenuItem menuItem = new() + { + Header = languageName, + Command = MiniCommand.Create(() => + { + ViewModel.ChangeLanguage(languageCode); + }) + }; + + menuItems.Add(menuItem); + } + + ChangeLanguageMenuItem.Items = menuItems.ToArray(); } protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) { base.OnAttachedToVisualTree(e); - if (this.VisualRoot is MainWindow window) + if (VisualRoot is MainWindow window) { Window = window; } diff --git a/Ryujinx.Common/Utilities/EmbeddedResources.cs b/Ryujinx.Common/Utilities/EmbeddedResources.cs index 286d2c5c..e7c8d7d7 100644 --- a/Ryujinx.Common/Utilities/EmbeddedResources.cs +++ b/Ryujinx.Common/Utilities/EmbeddedResources.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using System.Reflection; using System.Threading.Tasks; @@ -127,6 +128,13 @@ namespace Ryujinx.Common return stream; } + public static string[] GetAllAvailableResources(string path, string ext = "") + { + return ResolveManifestPath(path).Item1.GetManifestResourceNames() + .Where(r => r.EndsWith(ext)) + .ToArray(); + } + private static (Assembly, string) ResolveManifestPath(string filename) { var segments = filename.Split('/', 2, StringSplitOptions.RemoveEmptyEntries);