From 7cc2be438a7940e4ab6306a6c681ce4fa1a3ce43 Mon Sep 17 00:00:00 2001 From: flb Date: Tue, 6 Oct 2020 00:53:12 +0200 Subject: [PATCH] switched to borealis' implementation of internationalisation --- .gitignore | 2 + Makefile | 10 +- include/constants.hpp | 3 +- include/lang.hpp | 36 ------ resources/i18n/en-US/brls.json | 11 ++ .../i18n/en-US/menus.json | 5 +- resources/i18n/fr/brls.json | 11 ++ .../fr.json => resources/i18n/fr/menus.json | 18 +-- resources/i18n/zh-CN/brls.json | 11 ++ .../i18n/zh-CN/menus.json | 3 + source/JC_page.cpp | 25 ++-- source/about_tab.cpp | 14 ++- source/app_page.cpp | 19 +-- source/changelog_page.cpp | 44 ++++--- source/cheats_page.cpp | 19 +-- source/choice_page.cpp | 5 +- source/confirm_page.cpp | 11 +- source/download_payload_page.cpp | 21 ++-- source/exclude_page.cpp | 11 +- source/extract.cpp | 5 +- source/lang.cpp | 114 ------------------ source/language_option_page.cpp | 15 +-- source/list_download_tab.cpp | 42 ++++--- source/main.cpp | 15 ++- source/main_frame.cpp | 25 ++-- source/payload_page.cpp | 32 +++-- source/tools_tab.cpp | 31 ++--- source/utils.cpp | 17 +-- 28 files changed, 255 insertions(+), 320 deletions(-) delete mode 100644 include/lang.hpp create mode 100644 resources/i18n/en-US/brls.json rename res/lang/en.json => resources/i18n/en-US/menus.json (97%) create mode 100644 resources/i18n/fr/brls.json rename res/lang/fr.json => resources/i18n/fr/menus.json (91%) create mode 100644 resources/i18n/zh-CN/brls.json rename res/lang/ch.json => resources/i18n/zh-CN/menus.json (97%) delete mode 100644 source/lang.cpp diff --git a/.gitignore b/.gitignore index abd3a4c..ff5bbdb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ switch/ *.nacp *.nro *.zip +resources/i18n/zh-Hans +resources/i18n/en-GB \ No newline at end of file diff --git a/Makefile b/Makefile index b0e4416..ef80bef 100644 --- a/Makefile +++ b/Makefile @@ -45,11 +45,11 @@ DATA := data INCLUDES := include lib/zipper/include APP_TITLE := All-in-One Switch Updater APP_AUTHOR := HamletDuFromage -APP_VERSION := 1.2.0 +APP_VERSION := 1.2.1 -ROMFS = res +ROMFS := resources BOREALIS_PATH := lib/borealis -#BOREALIS_RESOURCES := romfs:/borealis/ +BOREALIS_RESOURCES := romfs:/ #APP_RESOURCES := romfs:/ #--------------------------------------------------------------------------------- @@ -183,7 +183,9 @@ all: $(BUILD) $(ROMFS): @[ -d $@ ] || mkdir -p $@ @echo Merging ROMFS... - @cp -ruf $(CURDIR)/$(BOREALIS_PATH)/resources/. $(CURDIR)/$(ROMFS)/borealis/ + #@cp -ruf $(CURDIR)/$(BOREALIS_PATH)/resources/. $(CURDIR)/$(ROMFS)/borealis/ + cp -ruf $(CURDIR)/$(ROMFS)/i18n/zh-CN/. $(CURDIR)/$(ROMFS)/i18n/zh-Hans/ + #cp -ruf $(CURDIR)/$(ROMFS)/i18n/en-US/. $(CURDIR)/$(ROMFS)/i18n/en-GB/ $(BUILD): $(ROMFS) @[ -d $@ ] || mkdir -p $@ diff --git a/include/constants.hpp b/include/constants.hpp index b5b9fec..3bebf10 100644 --- a/include/constants.hpp +++ b/include/constants.hpp @@ -1,7 +1,5 @@ #pragma once -#define APP_LANG "/config/aio-switch-updater/lang.json" - #define ROOT_PATH "/" #define DOWNLOAD_PATH "/config/aio-switch-updater/" #define CONFIG_PATH "/config/aio-switch-updater/" @@ -43,6 +41,7 @@ #define PAYLOAD_PATH "/payloads/" #define BOOTLOADER_PL_PATH "/bootloader/payloads/" +#define UPDATE_BIN_PATH "/bootloader/update.bin" #define REBOOT_PAYLOAD_PATH "/atmosphere/reboot_payload.bin" #define LISTITEM_HEIGHT 50 diff --git a/include/lang.hpp b/include/lang.hpp deleted file mode 100644 index c8695a1..0000000 --- a/include/lang.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include -#include -namespace lang { - -enum class Language { - English, - Chinese, - French, - /* - Dutch, - Italian, - German, - Spanish,*/ - Default, -}; - -const nlohmann::json &get_json(); - -Language get_current_language(); -Result set_language(Language lang); -Result initialize_to_system_language(); - -std::string get_string(std::string key, const nlohmann::json &json = get_json()); - -namespace literals { - -inline std::string operator ""_lang(const char *key, size_t size) { - return get_string(std::string(key, size)); -} - -} // namespace literals - -}; // namespace lang diff --git a/resources/i18n/en-US/brls.json b/resources/i18n/en-US/brls.json new file mode 100644 index 0000000..bd84e13 --- /dev/null +++ b/resources/i18n/en-US/brls.json @@ -0,0 +1,11 @@ +{ + "hints": { + "ok": "OK", + "back": "Back", + "exit": "Exit" + }, + + "crash_frame": { + "button": "OK" + } +} diff --git a/res/lang/en.json b/resources/i18n/en-US/menus.json similarity index 97% rename from res/lang/en.json rename to resources/i18n/en-US/menus.json index fd465eb..d55469d 100644 --- a/res/lang/en.json +++ b/resources/i18n/en-US/menus.json @@ -32,6 +32,8 @@ "v1_1_3_text": "\uE016 Now displays the latest installed cheat version.\n\uE016 Now warns in the app title if a new update is available.", "v1_2_0": "v1.2.0", "v1_2_0_text": "\uE016 Now multilingual (thanks to 'github.com/tiansongyu').\n\uE016 Chinese and French are currently supported.", + "v1_2_1": "v1.2.1", + "v1_2_1_text": "\uE016 Added option to set a payload to /bootloader/update.bin", "Ok_button": "Ok", "cheats_page.cpp":"", @@ -119,6 +121,7 @@ "payload_reboot": "Reboot menu", "payload_select": " Select a payload to reboot to.", "payload_set": "Set as reboot_payload.bin", + "payload_set_up": "Set as /bootloader/update.bin", "payload_success": "Successfully copied '", "payload_to": "' to '", "payload_ok": "Ok", @@ -133,7 +136,7 @@ "tool_update": "Update the app (v", "tool_DownLoad": "Downloading:\nAIO-switch-updater\n\nFrom:\n", "tool_updating": "Updating app", - "tool_downloading":"Downloading...", + "tool_downloading": "Downloading...", "tool_extracting": "Extracting....", "tool_all_done": " All done!", "tool_changelog": "Changelog", diff --git a/resources/i18n/fr/brls.json b/resources/i18n/fr/brls.json new file mode 100644 index 0000000..d498a45 --- /dev/null +++ b/resources/i18n/fr/brls.json @@ -0,0 +1,11 @@ +{ + "hints": { + "ok": "OK", + "back": "Retour", + "exit": "Quitter" + }, + + "crash_frame": { + "button": "OK" + } +} diff --git a/res/lang/fr.json b/resources/i18n/fr/menus.json similarity index 91% rename from res/lang/fr.json rename to resources/i18n/fr/menus.json index 9909237..8a7e058 100644 --- a/res/lang/fr.json +++ b/resources/i18n/fr/menus.json @@ -32,7 +32,8 @@ "v1_1_3_text": "\uE016 Now displays the latest installed cheat version.\n\uE016 Now warns in the app title if a new update is available.", "v1_2_0": "v1.2.0", "v1_2_0_text": "\uE016 Now multilingual (thanks to 'github.com/tiansongyu').\n\uE016 Chinese and French are currently supported.", - + "v1_2_1": "v1.2.1", + "v1_2_1_text": "\uE016 Added option to set a payload to /bootloader/update.bin", "Ok_button": "Ok", "cheats_page.cpp":"", @@ -86,9 +87,9 @@ "jc_all_": "Fini! Vous devrez peut-être ancrer/détacher votre Joy-Cons pour que le changement prenne effet", "list_donwload.cpp":"", - "Getting": "Obtension ", - "firmware_text": "\uE016 Firmware dumps de 'https://darthsternie.net/switch-firmwares/'. Une fois téléchargés, ils seront dans '/firmware'. Vous pouvez ensuite les installer avec Daybreak ou ChoiDuJour.\n\uE016 FW actuel: ", - "currentCeatsver": "\uE016 Cela téléchargera une archive mise à jour quotidiennement des codes de triche de 'gbatemp.net'. Les codes de triche pour les jeux que vous n'avez pas installés ne seront pas extraits sur votre carte SD. Vous pouvez désactiver les mises à jour pour pour une selection de jeux dans le menu 'Outils->Menu de cheat'.\n\uE016 Version actuelle des cheats : ", + "Getting": "Obtention de ", + "firmware_text": "\uE016 Firmware dumps de 'https://darthsternie.net/switch-firmwares/'. Une fois téléchargés, ils seront dans '/firmware'. Vous pouvez ensuite les installer avec Daybreak ou ChoiDuJour.\n\uE016 FW actuel : ", + "currentCeatsver": "\uE016 Archive mise à jour quotidiennement des codes de triche de 'gbatemp.net'. Les codes de triche pour les jeux que vous ne possedez pas ne seront pas extraits sur votre carte SD. Vous pouvez désactiver les mises à jour pour pour une sélection de jeux dans le menu 'Outils->Menu de cheat'.\n\uE016 Version actuelle des cheats : ", "operation_1": "sigpatches", "list_sigpatches": "\uE016 Les Sigpatches permettent à votre Switch d'installer et d'exécuter des fichiers NSP non officiels. Assurez-vous de choisir les bons patchs pour votre configuration (Atmosphere pur ou Hekate+Atmosphere).", "operation_2": "firmware", @@ -100,7 +101,7 @@ "list_latest_ver": "Derniers (ver ", "list_cheats": "codes de triche", "list_down": "Télécharger:\n", - "list_from": "\n\nFrom:\n", + "list_from": "\n\nDe:\n", "list_downing": "Téléchargement...", "list_extracting": "Exctraction...", "list_All": "Fini!", @@ -118,8 +119,9 @@ "payload_page.cpp":"", "payload_reboot": "Menu de redémarrage", - "payload_select": " Selectionner un payload à redémarrer.", - "payload_set": "Définit comme reboot_payload.bin", + "payload_select": " Selectionner un payload à injecter.", + "payload_set": "Déf comme reboot_payload.bin", + "payload_set_up": "Déf comme bootloader/update.bin", "payload_success": "Copié avec succès '", "payload_to": "' vers '", "payload_ok": "Ok", @@ -129,7 +131,7 @@ "tools_tab.cpp":"", "tool_cheats": "Menu de cheat", "tool_change": "Changer la couleur des Joy-Cons", - "tool_download": "Télécharger des payloads vers ", + "tool_download": "Télécharger des payloads dans ", "tool_inject": "Injecter un payload", "tool_update": "Mettre à jour l'app (v", "tool_DownLoad": "Télécharger:\nAIO-switch-updater\n\nDe:\n", diff --git a/resources/i18n/zh-CN/brls.json b/resources/i18n/zh-CN/brls.json new file mode 100644 index 0000000..bd84e13 --- /dev/null +++ b/resources/i18n/zh-CN/brls.json @@ -0,0 +1,11 @@ +{ + "hints": { + "ok": "OK", + "back": "Back", + "exit": "Exit" + }, + + "crash_frame": { + "button": "OK" + } +} diff --git a/res/lang/ch.json b/resources/i18n/zh-CN/menus.json similarity index 97% rename from res/lang/ch.json rename to resources/i18n/zh-CN/menus.json index 3cfca5b..b9a060e 100644 --- a/res/lang/ch.json +++ b/resources/i18n/zh-CN/menus.json @@ -31,6 +31,8 @@ "v1_1_3_text": "\uE016 现在显示最新安装的金手指版本.\n\uE016 如果有新的更新可用,现在在应用程序标题中警告", "v1_2_0": "v1.2.0", "v1_2_0_text": "\uE016 现在可以使用多种语言(感谢'github.com/tiansongyu').\n\uE016 目前支持中文和法文.", + "v1_2_1": "v1.2.1", + "v1_2_1_text": "\uE016 Added option to set a payload to /bootloader/update.bin", "Ok_button": "确定", "cheats_page.cpp":"", @@ -120,6 +122,7 @@ "payload_reboot": "重启菜单", "payload_select": "选择一个注入文件重启.", "payload_set": "设置 reboot_payload.bin", + "payload_set_up": "设置 bootloader/update.bin", "payload_success": "成功复制 '", "payload_to": "' to '", "payload_ok": "确定", diff --git a/source/JC_page.cpp b/source/JC_page.cpp index 7b34ee4..8a0795b 100644 --- a/source/JC_page.cpp +++ b/source/JC_page.cpp @@ -1,25 +1,26 @@ #include "JC_page.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; JCPage::JCPage() : AppletFrame(true, true) { - this->setTitle("joy_con"_lang); + this->setTitle("menus/joy_con"_i18n ); list = new brls::List(); - std::string labelText = "jc_you_can_1"_lang + std::string(COLOR_PROFILES_PATH) + "jc_you_can_goto"\ - "jc_you_can_2"_lang; + std::string labelText = "menus/jc_you_can_1"_i18n + std::string(COLOR_PROFILES_PATH) + "menus/jc_you_can_goto"\ + "menus/jc_you_can_2"_i18n ; label = new brls::Label(brls::LabelStyle::DESCRIPTION, labelText, true); list->addView(label); - backup = new brls::ListItem("jc_backup"_lang); + backup = new brls::ListItem("menus/jc_backup"_i18n ); backup->getClickEvent()->subscribe([&](brls::View* view) { brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); - stagedFrame->setTitle("jc_color"_lang); + stagedFrame->setTitle("menus/jc_color"_i18n ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "jc_backing"_lang, + new WorkerPage(stagedFrame, "menus/jc_backing"_i18n , [](){backupJCColor(COLOR_PROFILES_PATH);}) ); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "jc_all_done"_lang, true) + new ConfirmPage(stagedFrame, "menus/jc_all_done"_i18n , true) ); brls::Application::pushView(stagedFrame); }); @@ -37,13 +38,13 @@ JCPage::JCPage() : AppletFrame(true, true) items[i] = new brls::ListItem(names[i]); items[i]->getClickEvent()->subscribe([&, value](brls::View* view) { brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); - stagedFrame->setTitle("jc_concolor"_lang); + stagedFrame->setTitle("menus/jc_concolor"_i18n ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "jc_changing"_lang, + new WorkerPage(stagedFrame, "menus/jc_changing"_i18n , [value](){changeJCColor(value);}) ); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "jc_all_"_lang, true) + new ConfirmPage(stagedFrame, "menus/jc_all_"_i18n , true) ); brls::Application::pushView(stagedFrame); }); diff --git a/source/about_tab.cpp b/source/about_tab.cpp index e52611e..d12bb7e 100644 --- a/source/about_tab.cpp +++ b/source/about_tab.cpp @@ -1,13 +1,15 @@ #include "about_tab.hpp" -#include "lang.hpp" -using namespace lang::literals; + + +namespace i18n = brls::i18n; +using namespace i18n::literals; AboutTab::AboutTab() { // Subtitle brls::Label *subTitle = new brls::Label( brls::LabelStyle::REGULAR, - "About_Title"_lang , + "menus/About_Title"_i18n , true ); subTitle->setHorizontalAlign(NVG_ALIGN_CENTER); @@ -16,7 +18,7 @@ AboutTab::AboutTab() // Copyright brls::Label *copyright = new brls::Label( brls::LabelStyle::DESCRIPTION, - "copyright"_lang, + "menus/copyright"_i18n, true ); copyright->setHorizontalAlign(NVG_ALIGN_CENTER); @@ -26,8 +28,8 @@ AboutTab::AboutTab() this->addView(new brls::Header("Disclaimers")); brls::Label *links = new brls::Label( brls::LabelStyle::SMALL, - "Disclaimers"_lang, + "menus/Disclaimers"_i18n, true ); this->addView(links); -} +} \ No newline at end of file diff --git a/source/app_page.cpp b/source/app_page.cpp index a386127..e0f6c89 100644 --- a/source/app_page.cpp +++ b/source/app_page.cpp @@ -1,14 +1,15 @@ #include "app_page.hpp" //TODO: Serialize it in extract.cpp -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; AppPage::AppPage() : AppletFrame(true, true) { - this->setTitle("app_title"_lang); + this->setTitle("menus/app_title"_i18n ); list = new brls::List(); label = new brls::Label( brls::LabelStyle::DESCRIPTION, - "app_label"_lang, + "menus/app_label"_i18n , true ); list->addView(label); @@ -74,22 +75,22 @@ AppPage::AppPage() : AppletFrame(true, true) break; } text += url; - download = new brls::ListItem("text_download_list"_lang); + download = new brls::ListItem("menus/text_download_list"_i18n ); archiveType type = cheats; download->getClickEvent()->subscribe([&, url, text, type](brls::View* view) { brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); - stagedFrame->setTitle("text_title"_lang); + stagedFrame->setTitle("menus/text_title"_i18n ); stagedFrame->addStage( new ConfirmPage(stagedFrame, text) ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "Downloading"_lang, [url, type](){downloadArchive(url, type);}) + new WorkerPage(stagedFrame, "menus/Downloading"_i18n , [url, type](){downloadArchive(url, type);}) ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "Extracting"_lang, [type](){extractArchive(type);}) + new WorkerPage(stagedFrame, "menus/Extracting"_i18n , [type](){extractArchive(type);}) ); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "All_done"_lang, true) + new ConfirmPage(stagedFrame, "menus/All_done"_i18n , true) ); brls::Application::pushView(stagedFrame); }); diff --git a/source/changelog_page.cpp b/source/changelog_page.cpp index 7657921..97d3f24 100644 --- a/source/changelog_page.cpp +++ b/source/changelog_page.cpp @@ -1,37 +1,41 @@ #include "changelog_page.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; ChangelogPage::ChangelogPage() : AppletFrame(true, true) { - this->setTitle("Changelog"_lang); + this->setTitle("menus/Changelog"_i18n ); list = new brls::List(); std::vector verTitles; std::string change; std::vector changes; - verTitles.push_back("v1_0_1"_lang); - changes.push_back("v1_0_1_text"_lang); + verTitles.push_back("menus/v1_0_1"_i18n ); + changes.push_back("menus/v1_0_1_text"_i18n ); - verTitles.push_back("v1_0_2"_lang); - changes.push_back("v1_0_2_text"_lang); + verTitles.push_back("menus/v1_0_2"_i18n ); + changes.push_back("menus/v1_0_2_text"_i18n ); - verTitles.push_back("v1_0_3"_lang); - changes.push_back("v1_0_3_text"_lang); + verTitles.push_back("menus/v1_0_3"_i18n ); + changes.push_back("menus/v1_0_3_text"_i18n ); - verTitles.push_back("v1_1_0"_lang); - changes.push_back("v1_1_0_text"_lang); + verTitles.push_back("menus/v1_1_0"_i18n ); + changes.push_back("menus/v1_1_0_text"_i18n ); - verTitles.push_back("v1_1_1"_lang); - changes.push_back("v1_1_1_text"_lang); + verTitles.push_back("menus/v1_1_1"_i18n ); + changes.push_back("menus/v1_1_1_text"_i18n ); - verTitles.push_back("v1_1_2"_lang); - changes.push_back("v1_1_2_text"_lang); + verTitles.push_back("menus/v1_1_2"_i18n ); + changes.push_back("menus/v1_1_2_text"_i18n ); - verTitles.push_back("v1_1_3"_lang); - changes.push_back("v1_1_3_text"_lang); + verTitles.push_back("menus/v1_1_3"_i18n ); + changes.push_back("menus/v1_1_3_text"_i18n ); - verTitles.push_back("v1_2_0"_lang); - changes.push_back("v1_2_0_text"_lang); + verTitles.push_back("menus/v1_2_0"_i18n ); + changes.push_back("menus/v1_2_0_text"_i18n ); + + verTitles.push_back("menus/v1_2_1"_i18n ); + changes.push_back("menus/v1_2_1_text"_i18n ); int nbVersions = verTitles.size(); items.reserve(nbVersions); @@ -43,7 +47,7 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true) brls::GenericEvent::Callback callback = [dialog](brls::View* view) { dialog->close(); }; - dialog->addButton("Ok_button"_lang, callback); + dialog->addButton("menus/Ok_button"_i18n , callback); dialog->setCancelable(true); dialog->open(); }); diff --git a/source/cheats_page.cpp b/source/cheats_page.cpp index 0512b2a..9259049 100644 --- a/source/cheats_page.cpp +++ b/source/cheats_page.cpp @@ -1,33 +1,34 @@ #include "cheats_page.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; CheatsPage::CheatsPage() : AppletFrame(true, true) { - this->setTitle("cheat_menu"_lang); + this->setTitle("menus/cheat_menu"_i18n ); list = new brls::List(); - view = new brls::ListItem("cheat_view"_lang); + view = new brls::ListItem("menus/cheat_view"_i18n ); view->getClickEvent()->subscribe([&](brls::View* view){ brls::Application::pushView(new AppPage()); }); list->addView(view); - exclude = new brls::ListItem("cheat_exclude"_lang); + exclude = new brls::ListItem("menus/cheat_exclude"_i18n ); exclude->getClickEvent()->subscribe([&](brls::View* view){ brls::Application::pushView(new ExcludePage()); }); list->addView(exclude); - deleteCheats = new brls::ListItem("cheat_delete_all_ex"_lang); + deleteCheats = new brls::ListItem("menus/cheat_delete_all_ex"_i18n ); deleteCheats->getClickEvent()->subscribe([&](brls::View* view){ stagedFrame = new brls::StagedAppletFrame(); - stagedFrame->setTitle("cheat_delete_all_cheat"_lang); + stagedFrame->setTitle("menus/cheat_delete_all_cheat"_i18n ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "cheat_Deleting"_lang , [](){removeCheats(getCFW());}) + new WorkerPage(stagedFrame, "menus/cheat_Deleting"_i18n , [](){removeCheats(getCFW());}) ); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "cheat_All_done"_lang, true) + new ConfirmPage(stagedFrame, "menus/cheat_All_done"_i18n , true) ); brls::Application::pushView(stagedFrame); }); diff --git a/source/choice_page.cpp b/source/choice_page.cpp index 479b793..113f299 100644 --- a/source/choice_page.cpp +++ b/source/choice_page.cpp @@ -1,6 +1,7 @@ #include "choice_page.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; ChoicePage::ChoicePage(brls::StagedAppletFrame* frame, std::string text) { this->yes = (new brls::Button(brls::ButtonStyle::BORDERLESS))->setLabel("yes"); diff --git a/source/confirm_page.cpp b/source/confirm_page.cpp index 5df84a4..90aa647 100644 --- a/source/confirm_page.cpp +++ b/source/confirm_page.cpp @@ -1,9 +1,10 @@ #include "confirm_page.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool done): done(done) { - this->button = (new brls::Button(brls::ButtonStyle::BORDERLESS))->setLabel(done ? "Back"_lang: "Continue"_lang); + this->button = (new brls::Button(brls::ButtonStyle::BORDERLESS))->setLabel(done ? "menus/Back"_i18n : "menus/Continue"_i18n ); this->button->setParent(this); this->button->getClickEvent()->subscribe([frame, this](View* view) { if (!frame->isLastStage()) frame->nextStage(); @@ -16,7 +17,7 @@ ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool this->label->setHorizontalAlign(NVG_ALIGN_CENTER); this->label->setParent(this); - this->registerAction("Back"_lang, brls::Key::B, [this] { + this->registerAction("menus/Back"_i18n , brls::Key::B, [this] { brls::Application::popView(); return true; }); @@ -27,7 +28,7 @@ void ConfirmPage::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned he if(!this->done){ auto end = std::chrono::high_resolution_clock::now(); auto missing = std::max(1l - std::chrono::duration_cast(end - start).count(), 0l); - auto text = std::string("Continue"_lang); + auto text = std::string("menus/Continue"_i18n ); if (missing > 0) { this->button->setLabel(text + " (" + std::to_string(missing) + ")"); this->button->setState(brls::ButtonState::DISABLED); diff --git a/source/download_payload_page.cpp b/source/download_payload_page.cpp index 2056bd7..40b70a6 100644 --- a/source/download_payload_page.cpp +++ b/source/download_payload_page.cpp @@ -1,13 +1,14 @@ #include "download_payload_page.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; DownloadPayloadPage::DownloadPayloadPage() : AppletFrame(true, true) { - this->setTitle("Download_payloads"_lang); + this->setTitle("menus/Download_payloads"_i18n ); list = new brls::List(); label = new brls::Label( brls::LabelStyle::DESCRIPTION, - "select"_lang + std::string(BOOTLOADER_PL_PATH) + "'."_lang, + "menus/select"_i18n + std::string(BOOTLOADER_PL_PATH) + "." , true ); list->addView(label); @@ -18,20 +19,20 @@ DownloadPayloadPage::DownloadPayloadPage() : AppletFrame(true, true) for (int i = 0; i(links)[i]; std::string path = std::string(BOOTLOADER_PL_PATH) + std::get<0>(links)[i]; - std::string text("Download"_lang + std::get<0>(links)[i] + "from"_lang+ url); + std::string text("menus/Download"_i18n + std::get<0>(links)[i] + "menus/from"_i18n + url); items[i] = new brls::ListItem(std::get<0>(links)[i]); items[i]->getClickEvent()->subscribe([&, text, url, path](brls::View* view) { createTree(BOOTLOADER_PL_PATH); brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); - stagedFrame->setTitle("getting_paylaod"_lang); + stagedFrame->setTitle("menus/getting_paylaod"_i18n ); stagedFrame->addStage( new ConfirmPage(stagedFrame, text) ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "down"_lang, [url, path](){downloadFile(url.c_str(), path.c_str(), OFF);}) + new WorkerPage(stagedFrame, "menus/down"_i18n , [url, path](){downloadFile(url.c_str(), path.c_str(), OFF);}) ); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "download_all_done"_lang, true) + new ConfirmPage(stagedFrame, "menus/download_all_done"_i18n , true) ); brls::Application::pushView(stagedFrame); }); @@ -41,12 +42,12 @@ DownloadPayloadPage::DownloadPayloadPage() : AppletFrame(true, true) else{ notFound = new brls::Label( brls::LabelStyle::DESCRIPTION, - "description"_lang, + "menus/description"_i18n , true ); notFound->setHorizontalAlign(NVG_ALIGN_CENTER); list->addView(notFound); - brls::ListItem* back = new brls::ListItem("back"_lang); + brls::ListItem* back = new brls::ListItem("menus/back"_i18n ); back->getClickEvent()->subscribe([&](brls::View* view) { brls::Application::popView(); }); diff --git a/source/exclude_page.cpp b/source/exclude_page.cpp index f54a627..a49c7e0 100644 --- a/source/exclude_page.cpp +++ b/source/exclude_page.cpp @@ -1,13 +1,14 @@ #include "exclude_page.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; ExcludePage::ExcludePage() : AppletFrame(true, true) { - this->setTitle("exclude_titles"_lang); + this->setTitle("menus/exclude_titles"_i18n ); list = new brls::List(); label = new brls::Label( brls::LabelStyle::DESCRIPTION, - "you_can"_lang, + "menus/you_can"_i18n , true ); list->addView(label); @@ -66,7 +67,7 @@ ExcludePage::ExcludePage() : AppletFrame(true, true) i++; } - list->registerAction("save"_lang, brls::Key::B, [this] { + list->registerAction("menus/save"_i18n , brls::Key::B, [this] { std::set exclude{}; for(int i = 0; i < (int) std::get<1>(items).size(); i++){ if(!std::get<0>(items)[i]->getToggleState()){ diff --git a/source/extract.cpp b/source/extract.cpp index 21e3766..6124e8b 100644 --- a/source/extract.cpp +++ b/source/extract.cpp @@ -1,8 +1,9 @@ #include "extract.hpp" #include "utils.hpp" #include "download.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; void extract(const char * filename, const char* workingPath, int overwriteInis){ ProgressEvent::instance().reset(); ProgressEvent::instance().setStep(1); diff --git a/source/lang.cpp b/source/lang.cpp deleted file mode 100644 index 05df9ee..0000000 --- a/source/lang.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include "json.hpp" -#include "lang.hpp" -#include -#include - -using json = nlohmann::json; - -namespace lang { - -namespace { - -static json lang_json = nullptr; -static Language current_language = Language::Default; - -} // namespace - -const json &get_json() { - return lang_json; -} - -Language get_current_language() { - return current_language; -} - -Result set_language(Language lang) { - const char *path; - current_language = lang; - switch (lang) { - case Language::Chinese: - path = "romfs:/lang/ch.json"; - break; - //if you need add a new language - //use it ! - case Language::French: - path = "romfs:/lang/fr.json"; - break; - /* - case Language::Dutch: - path = "romfs:/lang/nl.json"; - break; - case Language::Italian: - path = "romfs:/lang/it.json"; - break; - case Language::German: - path = "romfs:/lang/de.json"; - break; - case Language::Spanish: - path = "romfs:/lang/es.json"; - break;*/ - case Language::English: - case Language::Default: - default: - path = "romfs:/lang/en.json"; - break; - } - - std::fstream langFile; - if(std::filesystem::exists(path)){ - langFile.open(path, std::fstream::in); - langFile >> lang_json; - langFile.close(); - } - return 0; -} - -Result initialize_to_system_language() { - if (auto rc = setInitialize(); R_FAILED(rc)) { - setExit(); - return rc; - } - - u64 l; - if (auto rc = setGetSystemLanguage(&l); R_FAILED(rc)) { - setExit(); - return rc; - } - - SetLanguage sl; - if (auto rc = setMakeLanguage(l, &sl); R_FAILED(rc)) { - setExit(); - return rc; - } - - switch (sl) { - case SetLanguage_ENGB: - case SetLanguage_ENUS: - return set_language(Language::English); - case SetLanguage_ZHCN: - case SetLanguage_ZHHANS: - return set_language(Language::Chinese); - //if you need add a new language - //use it ! - case SetLanguage_FR: - return set_language(Language::French); - /* - case SetLanguage_NL: - return set_language(Language::Dutch); - case SetLanguage_IT: - return set_language(Language::Italian); - case SetLanguage_DE: - return set_language(Language::German); - case SetLanguage_ES: - return set_language(Language::Spanish);*/ - default: - return set_language(Language::Default); - } -} - -std::string get_string(std::string key, const json &json) { - return json.value(key, key); -} - -} // namespace lang diff --git a/source/language_option_page.cpp b/source/language_option_page.cpp index ad7f87d..9d0f07b 100644 --- a/source/language_option_page.cpp +++ b/source/language_option_page.cpp @@ -1,13 +1,14 @@ #include "language_option_page.hpp" -#include "lang.hpp" + #include -using namespace lang::literals; +namespace i18n = brls::i18n; +using namespace i18n::literals; //this page is for language page LanguageOptionPage::LanguageOptionPage() : AppletFrame(true, true) { - this->setTitle("Language_Option"_lang); + /* this->setTitle("menus/Language_Option"_i18n ); list = new brls::List(); English = new brls::ListItem("English"); @@ -20,7 +21,7 @@ LanguageOptionPage::LanguageOptionPage() : AppletFrame(true, true) brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "reset_machine"_lang, true) + new ConfirmPage(stagedFrame, "menus/reset_machine"_i18n , true) ); brls::Application::pushView(stagedFrame); @@ -35,7 +36,7 @@ LanguageOptionPage::LanguageOptionPage() : AppletFrame(true, true) brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "reset_machine"_lang, true) + new ConfirmPage(stagedFrame, "menus/reset_machine"_i18n , true) ); brls::Application::pushView(stagedFrame); }); @@ -50,10 +51,10 @@ LanguageOptionPage::LanguageOptionPage() : AppletFrame(true, true) brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "reset_machine"_lang, true) + new ConfirmPage(stagedFrame, "menus/reset_machine"_i18n , true) ); brls::Application::pushView(stagedFrame); }); list->addView(French); - this->setContentView(list); + this->setContentView(list); */ } \ No newline at end of file diff --git a/source/list_download_tab.cpp b/source/list_download_tab.cpp index a3dcc74..96af5dd 100644 --- a/source/list_download_tab.cpp +++ b/source/list_download_tab.cpp @@ -1,50 +1,52 @@ #include "list_download_tab.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; + ListDownloadTab::ListDownloadTab(archiveType type) : brls::List() { std::tuple, std::vector> links; - std::string operation = "Getting"_lang; - std::string firmwareText("firmware_text"_lang + std::string operation = "menus/Getting"_i18n ; + std::string firmwareText("menus/firmware_text"_i18n ); std::string currentCheatsVer = - "currentCeatsver"_lang; + "menus/currentCeatsver"_i18n ; this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true); switch(type){ case sigpatches: links = fetchLinks(SIGPATCHES_URL); - operation += "operation_1"_lang; + operation += "menus/operation_1"_i18n ; this->description->setText( - "list_sigpatches"_lang + "menus/list_sigpatches"_i18n ); break; case fw: links = fetchLinks(FIRMWARE_URL); - operation += "operation_2"_lang; + operation += "menus/operation_2"_i18n ; SetSysFirmwareVersion ver; if (R_SUCCEEDED(setsysGetFirmwareVersion(&ver))) firmwareText += ver.display_version; - else firmwareText += "list_not"_lang; + else firmwareText += "menus/list_not"_i18n ; this->description->setText(firmwareText); break; case app: - std::get<0>(links).push_back("list_latest"_lang); + std::get<0>(links).push_back("menus/list_latest"_i18n ); std::get<1>(links).push_back(APP_URL); - operation += "list_app"_lang; + operation += "menus/list_app"_i18n ; break; case cfw: links = fetchLinks(CFW_URL); - operation += "list_cfw"_lang; + operation += "menus/list_cfw"_i18n ; this->description->setText( - "list_main"_lang + "menus/list_main"_i18n ); break; case cheats: std::string cheatsVer = fetchTitle(CHEATS_RELEASE_URL); if(cheatsVer != "-1"){ - std::get<0>(links).push_back("list_latest_ver"_lang + cheatsVer + ")"); + std::get<0>(links).push_back("menus/list_latest_ver"_i18n + cheatsVer + ")"); switch(getCFW()){ case sxos: std::get<1>(links).push_back(CHEATS_URL_TITLES); @@ -57,7 +59,7 @@ ListDownloadTab::ListDownloadTab(archiveType type) : break; } } - operation += "list_cheats"_lang; + operation += "menus/list_cheats"_i18n ; currentCheatsVer += readVersion(CHEATS_VERSION); this->description->setText(currentCheatsVer); break; @@ -71,7 +73,7 @@ ListDownloadTab::ListDownloadTab(archiveType type) : linkItems.reserve(nbLinks); for (int i = 0; i(links)[i]; - std::string text("list_down"_lang + std::get<0>(links)[i] + "list_from"_lang + url); + std::string text("menus/list_down"_i18n + std::get<0>(links)[i] + "menus/list_from"_i18n + url); linkItems[i] = new brls::ListItem(std::get<0>(links)[i]); linkItems[i]->setHeight(LISTITEM_HEIGHT); linkItems[i]->getClickEvent()->subscribe([&, text, url, type, operation](brls::View* view) { @@ -81,13 +83,13 @@ ListDownloadTab::ListDownloadTab(archiveType type) : new ConfirmPage(stagedFrame, text) ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "list_downing"_lang, [url, type](){downloadArchive(url, type);}) + new WorkerPage(stagedFrame, "menus/list_downing"_i18n , [url, type](){downloadArchive(url, type);}) ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "list_extracting"_lang, [type](){extractArchive(type);}) + new WorkerPage(stagedFrame, "menus/list_extracting"_i18n , [type](){extractArchive(type);}) ); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "list_All"_lang, true) + new ConfirmPage(stagedFrame, "menus/list_All"_i18n , true) ); brls::Application::pushView(stagedFrame); }); @@ -97,7 +99,7 @@ ListDownloadTab::ListDownloadTab(archiveType type) : else{ notFound = new brls::Label( brls::LabelStyle::DESCRIPTION, - "list_could_done"_lang, + "menus/list_could_done"_i18n , true ); notFound->setHorizontalAlign(NVG_ALIGN_CENTER); diff --git a/source/main.cpp b/source/main.cpp index 4f3632e..63dab9d 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -8,7 +8,7 @@ #include "main_frame.hpp" #include "constants.hpp" #include "utils.hpp" -#include "lang.hpp" + #include #include @@ -20,6 +20,10 @@ #include #include + +namespace i18n = brls::i18n; +using namespace i18n::literals; + int main(int argc, char* argv[]) { // Init the app @@ -28,7 +32,8 @@ int main(int argc, char* argv[]) brls::Logger::error("Unable to init Borealis application"); return EXIT_FAILURE; } - + i18n::loadTranslations(); + // Setup verbose logging on PC #ifndef __SWITCH__ brls::Logger::setLogLevel(brls::LogLevel::DEBUG); @@ -46,10 +51,12 @@ int main(int argc, char* argv[]) splInitialize(); createTree(CONFIG_PATH); + brls::Logger::setLogLevel(brls::LogLevel::DEBUG); brls::Logger::debug("Start"); - //start code by tiansongyu + +/* //start code by tiansongyu if(std::filesystem::exists(APP_LANG)) { std::ifstream i(APP_LANG); @@ -69,7 +76,7 @@ int main(int argc, char* argv[]) std::ofstream o(APP_LANG); o<addTab("main_about"_lang, new AboutTab()); + setTitle(std::string(APP_TITLE) + "menus/main_v"_i18n + std::string(APP_VERSION)); + this->addTab("menus/main_about"_i18n , new AboutTab()); this->addSeparator(); - this->addTab("main_update_cfw"_lang, new ListDownloadTab(cfw)); - this->addTab("main_update_si"_lang, new ListDownloadTab(sigpatches)); - this->addTab("main_firmwares"_lang, new ListDownloadTab(fw)); - this->addTab("main_cheats"_lang, new ListDownloadTab(cheats)); - + this->addTab("menus/main_update_cfw"_i18n , new ListDownloadTab(cfw)); + this->addTab("menus/main_update_si"_i18n , new ListDownloadTab(sigpatches)); + this->addTab("menus/main_firmwares"_i18n , new ListDownloadTab(fw)); + this->addTab("menus/main_cheats"_i18n , new ListDownloadTab(cheats)); this->addSeparator(); - this->addTab("main_tools"_lang, new ToolsTab(tag)); + + this->addTab("menus/main_tools"_i18n , new ToolsTab(tag)); + } diff --git a/source/payload_page.cpp b/source/payload_page.cpp index 2d01fa3..307eedb 100644 --- a/source/payload_page.cpp +++ b/source/payload_page.cpp @@ -1,14 +1,15 @@ #include "payload_page.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; PayloadPage::PayloadPage() : AppletFrame(true, true) { CFW cfw = getCFW(); - this->setTitle("payload_reboot"_lang); + this->setTitle("menus/payload_reboot"_i18n ); list = new brls::List(); label = new brls::Label( brls::LabelStyle::DESCRIPTION, - "payload_select"_lang, + "menus/payload_select"_i18n , true ); list->addView(label); @@ -23,32 +24,43 @@ PayloadPage::PayloadPage() : AppletFrame(true, true) brls::Application::popView(); }); if(cfw == ams){ - items[i]->registerAction("payload_set"_lang, brls::Key::X, [this, payload] { + items[i]->registerAction("menus/payload_set"_i18n , brls::Key::X, [this, payload] { if(R_SUCCEEDED(CopyFile(payload.c_str(), REBOOT_PAYLOAD_PATH))){ - brls::Dialog* dialog = new brls::Dialog("payload_success"_lang + payload + "payload_to"_lang + std::string(REBOOT_PAYLOAD_PATH) + "'."); + brls::Dialog* dialog = new brls::Dialog("menus/payload_success"_i18n + payload + "menus/payload_to"_i18n + std::string(REBOOT_PAYLOAD_PATH) + "'."); brls::GenericEvent::Callback callback = [dialog](brls::View* view) { dialog->close(); }; - dialog->addButton("payload_ok"_lang, callback); + dialog->addButton("menus/payload_ok"_i18n , callback); dialog->setCancelable(true); dialog->open(); } return true; }); } + items[i]->registerAction("menus/payload_set_up"_i18n , brls::Key::Y, [this, payload] { + if(R_SUCCEEDED(CopyFile(payload.c_str(), UPDATE_BIN_PATH))){ + brls::Dialog* dialog = new brls::Dialog("menus/payload_success"_i18n + payload + "menus/payload_to"_i18n + std::string(UPDATE_BIN_PATH) + "'."); + brls::GenericEvent::Callback callback = [dialog](brls::View* view) { + dialog->close(); + }; + dialog->addButton("menus/payload_ok"_i18n , callback); + dialog->setCancelable(true); + dialog->open(); + } + return true; + }); list->addView(items[i]); - } list->addView(new brls::ListItemGroupSpacing(true)); - shutDown = new brls::ListItem("payload_shut"_lang); + shutDown = new brls::ListItem("menus/payload_shut"_i18n ); shutDown->getClickEvent()->subscribe([](brls::View* view) { shut_down(false); brls::Application::popView(); }); list->addView(shutDown); - reboot = new brls::ListItem("payload_reboot_2"_lang); + reboot = new brls::ListItem("menus/payload_reboot_2"_i18n ); reboot->getClickEvent()->subscribe([](brls::View* view) { shut_down(true); brls::Application::popView(); diff --git a/source/tools_tab.cpp b/source/tools_tab.cpp index 696cd5c..c052d68 100644 --- a/source/tools_tab.cpp +++ b/source/tools_tab.cpp @@ -1,29 +1,30 @@ #include "tools_tab.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; ToolsTab::ToolsTab(std::string tag) : brls::List() { - cheats = new brls::ListItem("tool_cheats"_lang); + cheats = new brls::ListItem("menus/tool_cheats"_i18n ); cheats->getClickEvent()->subscribe([&](brls::View* view){ brls::Application::pushView(new CheatsPage()); }); cheats->setHeight(LISTITEM_HEIGHT); this->addView(cheats); - JCcolor = new brls::ListItem("tool_change"_lang); + JCcolor = new brls::ListItem("menus/tool_change"_i18n ); JCcolor->getClickEvent()->subscribe([&](brls::View* view){ brls::Application::pushView(new JCPage()); }); JCcolor->setHeight(LISTITEM_HEIGHT); this->addView(JCcolor); - downloadPayload = new brls::ListItem("tool_download"_lang + std::string(BOOTLOADER_PL_PATH)); + downloadPayload = new brls::ListItem("menus/tool_download"_i18n + std::string(BOOTLOADER_PL_PATH)); downloadPayload->getClickEvent()->subscribe([&](brls::View* view){ brls::Application::pushView(new DownloadPayloadPage()); }); this->addView(downloadPayload); - rebootPayload = new brls::ListItem("tool_inject"_lang); + rebootPayload = new brls::ListItem("menus/tool_inject"_i18n ); rebootPayload->getClickEvent()->subscribe([&](brls::View* view){ brls::Application::pushView(new PayloadPage()); }); @@ -31,22 +32,22 @@ ToolsTab::ToolsTab(std::string tag) : brls::List() this->addView(rebootPayload); if(!tag.empty() && tag != APP_VERSION){ - updateApp = new brls::ListItem("tool_update"_lang + tag +")"); - std::string text("tool_DownLoad"_lang + std::string(APP_URL)); + updateApp = new brls::ListItem("menus/tool_update"_i18n + tag +")"); + std::string text("menus/tool_DownLoad"_i18n + std::string(APP_URL)); updateApp->getClickEvent()->subscribe([&, text](brls::View* view) { brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); - stagedFrame->setTitle("tool_updating"_lang); + stagedFrame->setTitle("menus/tool_updating"_i18n ); stagedFrame->addStage( new ConfirmPage(stagedFrame, text) ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "tool_downloading"_lang, [](){downloadArchive(APP_URL, app);}) + new WorkerPage(stagedFrame, "menus/tool_downloading"_i18n , [](){downloadArchive(APP_URL, app);}) ); stagedFrame->addStage( - new WorkerPage(stagedFrame, "tool_extracting"_lang, [](){extractArchive(app);}) + new WorkerPage(stagedFrame, "menus/tool_extracting"_i18n , [](){extractArchive(app);}) ); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "tool_all_done"_lang, true) + new ConfirmPage(stagedFrame, "menus/tool_all_done"_i18n , true) ); brls::Application::pushView(stagedFrame); }); @@ -54,17 +55,17 @@ ToolsTab::ToolsTab(std::string tag) : brls::List() this->addView(updateApp); } - changelog = new brls::ListItem("tool_changelog"_lang); + changelog = new brls::ListItem("menus/tool_changelog"_i18n ); changelog->getClickEvent()->subscribe([&](brls::View* view){ brls::Application::pushView(new ChangelogPage()); }); changelog->setHeight(LISTITEM_HEIGHT); this->addView(changelog); - language = new brls::ListItem("Language_Option"_lang); +/* language = new brls::ListItem("menus/Language_Option"_i18n ); language->getClickEvent()->subscribe([&](brls::View* view){ brls::Application::pushView(new LanguageOptionPage()); }); language->setHeight(LISTITEM_HEIGHT); - this->addView(language); + this->addView(language); */ } \ No newline at end of file diff --git a/source/utils.cpp b/source/utils.cpp index 9d50a72..6d703c4 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -1,6 +1,7 @@ #include "utils.hpp" -#include "lang.hpp" -using namespace lang::literals; + +namespace i18n = brls::i18n; +using namespace i18n::literals; bool isServiceRunning(const char *serviceName) { Handle handle; SmServiceName service_name = smEncodeName(serviceName); @@ -69,7 +70,7 @@ void downloadArchive(std::string url, archiveType type){ downloadFile(url.c_str(), FIRMWARE_FILENAME, OFF); } else{ - showDialogBox("utils_because"_lang, "utils_ok"_lang); + showDialogBox("menus/utils_because"_i18n , "utils_ok"_i18n ); brls::Application::pushView(new MainFrame()); } break; @@ -134,7 +135,7 @@ void extractArchive(archiveType type){ std::string backup(HEKATE_IPL_PATH); backup += ".old"; if(std::filesystem::exists(HEKATE_IPL_PATH)){ - overwriteInis = showDialogBox("utils_do"_lang + std::string(HEKATE_IPL_PATH) +"?", "utils_no"_lang, "utils_yes"_lang); + overwriteInis = showDialogBox("menus/utils_do"_i18n + std::string(HEKATE_IPL_PATH) +"?", "menus/utils_no"_i18n , "menus/utils_yes"_i18n ); if(overwriteInis == 0){ extract(SIGPATCHES_FILENAME, ROOT_PATH, HEKATE_IPL_PATH); } @@ -147,7 +148,7 @@ void extractArchive(archiveType type){ } } else{ - showDialogBox("utils_the"_lang, "utils_ok"_lang); + showDialogBox("menus/utils_the"_i18n , "menus/utils_ok"_i18n ); brls::Application::pushView(new MainFrame()); } break; @@ -158,7 +159,7 @@ void extractArchive(archiveType type){ break; case fw: if(std::filesystem::file_size(FIRMWARE_FILENAME) < 200000){ - showDialogBox("utils_the_downloaded"_lang, "utils_ok"_lang); + showDialogBox("menus/utils_the_downloaded"_i18n , "menus/utils_ok"_i18n ); brls::Application::pushView(new MainFrame()); } else{ @@ -172,11 +173,11 @@ void extractArchive(archiveType type){ break; case cfw: if(isArchive(CFW_FILENAME)){ - overwriteInis = showDialogBox("ultils_overwrite"_lang, "utils_no"_lang, "utils_yes"_lang); + overwriteInis = showDialogBox("menus/ultils_overwrite"_i18n , "menus/utils_no"_i18n , "menus/utils_yes"_i18n ); extract(CFW_FILENAME, ROOT_PATH, overwriteInis); } else{ - showDialogBox("ultis_file"_lang, "utils_ok"_lang); + showDialogBox("menus/ultis_file"_i18n , "menus/utils_ok"_i18n ); brls::Application::pushView(new MainFrame()); } break;