From 68bc066c7bb06a9f69a76e5d5ca0febbfb026b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B3pez=20Guimaraes?= Date: Tue, 29 Oct 2024 19:00:22 +0000 Subject: [PATCH] feat: Add translation for module not found errors --- plugin/src/config.h | 2 ++ plugin/src/module.cpp | 14 ++++++++++++-- src/config.h | 2 ++ src/lang/de_DE.lang | 2 ++ src/lang/en_US.lang | 2 ++ src/lang/es_ES.lang | 2 ++ src/lang/fr_FR.lang | 2 ++ src/lang/it_IT.lang | 2 ++ src/lang/ja_JP.lang | 2 ++ src/lang/nl_NL.lang | 2 ++ src/lang/pt_BR.lang | 2 ++ src/lang/ru_RU.lang | 2 ++ src/lang/zh_CN.lang | 2 ++ src/lang/zh_Hant.lang | 2 ++ 14 files changed, 38 insertions(+), 2 deletions(-) diff --git a/plugin/src/config.h b/plugin/src/config.h index 2fa9812..845f9f5 100644 --- a/plugin/src/config.h +++ b/plugin/src/config.h @@ -35,6 +35,8 @@ struct config_strings { std::string_view need_menu_action; std::string_view using_nintendo_network; std::string_view using_pretendo_network; + std::string_view module_not_found; + std::string_view module_init_not_found; }; config_strings get_config_strings(nn::swkbd::LanguageType language); diff --git a/plugin/src/module.cpp b/plugin/src/module.cpp index 4e3fb8e..77a2249 100644 --- a/plugin/src/module.cpp +++ b/plugin/src/module.cpp @@ -17,13 +17,23 @@ #include "module.h" #include +#include "config.h" #include "Notification.h" #include "utils/logger.h" +#include "utils/sysconfig.h" static OSDynLoad_Module module; static void (*moduleInitialize)(bool) = nullptr; static InkayStatus (*moduleGetStatus)() = nullptr; +static const char *get_module_not_found_message() { + return get_config_strings(get_system_language()).module_not_found.data(); +} + +static const char *get_module_init_not_found_message() { + return get_config_strings(get_system_language()).module_init_not_found.data(); +} + void Inkay_Initialize(bool apply_patches) { if (module) { return; @@ -31,13 +41,13 @@ void Inkay_Initialize(bool apply_patches) { if (OSDynLoad_Acquire("inkay", &module) != OS_DYNLOAD_OK) { DEBUG_FUNCTION_LINE("Failed to acquire module"); - ShowNotification("Cannot find Inkay module. Ensure the Inkay module is properly installed"); + ShowNotification(get_module_not_found_message()); return; } if (OSDynLoad_FindExport(module, OS_DYNLOAD_EXPORT_FUNC, "Inkay_Initialize", reinterpret_cast(&moduleInitialize)) != OS_DYNLOAD_OK) { DEBUG_FUNCTION_LINE("Failed to find initialization function"); - ShowNotification("Cannot find Inkay module initialization function. Ensure the Inkay module is properly installed"); + ShowNotification(get_module_init_not_found_message()); OSDynLoad_Release(module); return; } diff --git a/src/config.h b/src/config.h index b816876..3d6f08f 100644 --- a/src/config.h +++ b/src/config.h @@ -29,6 +29,8 @@ struct config_strings { std::string_view using_nintendo_network; std::string_view using_pretendo_network; std::string_view multiplayer_port_display; + std::string_view module_not_found; + std::string_view module_init_not_found; }; config_strings get_config_strings(nn::swkbd::LanguageType language); diff --git a/src/lang/de_DE.lang b/src/lang/de_DE.lang index 1bfb5e8..a3485cb 100644 --- a/src/lang/de_DE.lang +++ b/src/lang/de_DE.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "Nur vom Wii U-Menü aus" ,.using_nintendo_network = "Nutze Nintendo Network" ,.using_pretendo_network = "Nutze Pretendo Network" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/en_US.lang b/src/lang/en_US.lang index ed0e423..aa02d40 100644 --- a/src/lang/en_US.lang +++ b/src/lang/en_US.lang @@ -9,3 +9,5 @@ ,.using_nintendo_network = "Using Nintendo Network" ,.using_pretendo_network = "Using Pretendo Network" ,.multiplayer_port_display = "Using UDP port {} for multiplayer" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/es_ES.lang b/src/lang/es_ES.lang index c6e9188..e03dd7f 100644 --- a/src/lang/es_ES.lang +++ b/src/lang/es_ES.lang @@ -8,3 +8,5 @@ ,.need_menu_action="Solo desde el Menú de Wii U" ,.using_nintendo_network="Usando Nintendo Network" ,.using_pretendo_network="Usando Pretendo Network" +,.module_not_found="No se pudo encontrar el módulo Inkay. Confirme que el módulo Inkay está instalado correctamente" +,.module_init_not_found="No se pudo inicializar el módulo Inkay. Confirme que el módulo Inkay está instalado correctamente" diff --git a/src/lang/fr_FR.lang b/src/lang/fr_FR.lang index 1f8eda7..88776de 100644 --- a/src/lang/fr_FR.lang +++ b/src/lang/fr_FR.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "Depuis le menu Wii U seulement" ,.using_nintendo_network = "Sur Nintendo Network" ,.using_pretendo_network = "Sur Pretendo Network" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/it_IT.lang b/src/lang/it_IT.lang index 7dbf2ff..d77bc19 100644 --- a/src/lang/it_IT.lang +++ b/src/lang/it_IT.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "Solo dal menu WiiU" ,.using_nintendo_network = "Usando Nintendo Network" ,.using_pretendo_network = "Usando Pretendo Network" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/ja_JP.lang b/src/lang/ja_JP.lang index 1e88f5a..8740611 100644 --- a/src/lang/ja_JP.lang +++ b/src/lang/ja_JP.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "WiiUメニューからのみ実行可能" ,.using_nintendo_network = "ニンテンドーネットワークを使用中" ,.using_pretendo_network = "Pretendoネットワークを使用中" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/nl_NL.lang b/src/lang/nl_NL.lang index 6d15650..ef23280 100644 --- a/src/lang/nl_NL.lang +++ b/src/lang/nl_NL.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "Alleen vanuit het WiiU-menu" ,.using_nintendo_network = "Nintendo Network wordt gebruikt" ,.using_pretendo_network = "Pretendo Network wordt gebruikt" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/pt_BR.lang b/src/lang/pt_BR.lang index 5e60a59..17a4714 100644 --- a/src/lang/pt_BR.lang +++ b/src/lang/pt_BR.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "Apenas no menu do Wii U" ,.using_nintendo_network = "Usando Nintendo Network" ,.using_pretendo_network = "Usando Pretendo Network" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/ru_RU.lang b/src/lang/ru_RU.lang index 966166b..575c06d 100644 --- a/src/lang/ru_RU.lang +++ b/src/lang/ru_RU.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "Только из меню Wii U" ,.using_nintendo_network = "Используется Nintendo Network" ,.using_pretendo_network = "Используется Pretendo Network" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/zh_CN.lang b/src/lang/zh_CN.lang index df1bc5a..671122d 100644 --- a/src/lang/zh_CN.lang +++ b/src/lang/zh_CN.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "仅来自WiiU Menu" ,.using_nintendo_network = "使用 Nintendo Network" ,.using_pretendo_network = "使用 Pretendo Network" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed" diff --git a/src/lang/zh_Hant.lang b/src/lang/zh_Hant.lang index ec3a0ad..d831cc2 100644 --- a/src/lang/zh_Hant.lang +++ b/src/lang/zh_Hant.lang @@ -8,3 +8,5 @@ ,.need_menu_action = "僅來自WiiU Menu" ,.using_nintendo_network = "使用 Nintendo Network" ,.using_pretendo_network = "使用 Pretendo Network" +,.module_not_found = "Could not find Inkay module. Ensure the Inkay module is properly installed" +,.module_init_not_found = "Could not initialize Inkay module. Ensure the Inkay module is properly installed"