feat: Add translation for module not found errors

This commit is contained in:
Daniel López Guimaraes 2024-10-29 19:00:22 +00:00 committed by Ash Logan
commit 68bc066c7b
14 changed files with 38 additions and 2 deletions

View file

@ -35,6 +35,8 @@ struct config_strings {
std::string_view need_menu_action; std::string_view need_menu_action;
std::string_view using_nintendo_network; std::string_view using_nintendo_network;
std::string_view using_pretendo_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); config_strings get_config_strings(nn::swkbd::LanguageType language);

View file

@ -17,13 +17,23 @@
#include "module.h" #include "module.h"
#include <coreinit/dynload.h> #include <coreinit/dynload.h>
#include "config.h"
#include "Notification.h" #include "Notification.h"
#include "utils/logger.h" #include "utils/logger.h"
#include "utils/sysconfig.h"
static OSDynLoad_Module module; static OSDynLoad_Module module;
static void (*moduleInitialize)(bool) = nullptr; static void (*moduleInitialize)(bool) = nullptr;
static InkayStatus (*moduleGetStatus)() = 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) { void Inkay_Initialize(bool apply_patches) {
if (module) { if (module) {
return; return;
@ -31,13 +41,13 @@ void Inkay_Initialize(bool apply_patches) {
if (OSDynLoad_Acquire("inkay", &module) != OS_DYNLOAD_OK) { if (OSDynLoad_Acquire("inkay", &module) != OS_DYNLOAD_OK) {
DEBUG_FUNCTION_LINE("Failed to acquire module"); 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; return;
} }
if (OSDynLoad_FindExport(module, OS_DYNLOAD_EXPORT_FUNC, "Inkay_Initialize", reinterpret_cast<void * *>(&moduleInitialize)) != OS_DYNLOAD_OK) { if (OSDynLoad_FindExport(module, OS_DYNLOAD_EXPORT_FUNC, "Inkay_Initialize", reinterpret_cast<void * *>(&moduleInitialize)) != OS_DYNLOAD_OK) {
DEBUG_FUNCTION_LINE("Failed to find initialization function"); 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); OSDynLoad_Release(module);
return; return;
} }

View file

@ -29,6 +29,8 @@ struct config_strings {
std::string_view using_nintendo_network; std::string_view using_nintendo_network;
std::string_view using_pretendo_network; std::string_view using_pretendo_network;
std::string_view multiplayer_port_display; 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); config_strings get_config_strings(nn::swkbd::LanguageType language);

View file

@ -8,3 +8,5 @@
,.need_menu_action = "Nur vom Wii U-Menü aus" ,.need_menu_action = "Nur vom Wii U-Menü aus"
,.using_nintendo_network = "Nutze Nintendo Network" ,.using_nintendo_network = "Nutze Nintendo Network"
,.using_pretendo_network = "Nutze Pretendo 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"

View file

@ -9,3 +9,5 @@
,.using_nintendo_network = "Using Nintendo Network" ,.using_nintendo_network = "Using Nintendo Network"
,.using_pretendo_network = "Using Pretendo Network" ,.using_pretendo_network = "Using Pretendo Network"
,.multiplayer_port_display = "Using UDP port {} for multiplayer" ,.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"

View file

@ -8,3 +8,5 @@
,.need_menu_action="Solo desde el Menú de Wii U" ,.need_menu_action="Solo desde el Menú de Wii U"
,.using_nintendo_network="Usando Nintendo Network" ,.using_nintendo_network="Usando Nintendo Network"
,.using_pretendo_network="Usando Pretendo 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"

View file

@ -8,3 +8,5 @@
,.need_menu_action = "Depuis le menu Wii U seulement" ,.need_menu_action = "Depuis le menu Wii U seulement"
,.using_nintendo_network = "Sur Nintendo Network" ,.using_nintendo_network = "Sur Nintendo Network"
,.using_pretendo_network = "Sur Pretendo 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"

View file

@ -8,3 +8,5 @@
,.need_menu_action = "Solo dal menu WiiU" ,.need_menu_action = "Solo dal menu WiiU"
,.using_nintendo_network = "Usando Nintendo Network" ,.using_nintendo_network = "Usando Nintendo Network"
,.using_pretendo_network = "Usando Pretendo 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"

View file

@ -8,3 +8,5 @@
,.need_menu_action = "WiiUメニューからのみ実行可能" ,.need_menu_action = "WiiUメニューからのみ実行可能"
,.using_nintendo_network = "ニンテンドーネットワークを使用中" ,.using_nintendo_network = "ニンテンドーネットワークを使用中"
,.using_pretendo_network = "Pretendoネットワークを使用中" ,.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"

View file

@ -8,3 +8,5 @@
,.need_menu_action = "Alleen vanuit het WiiU-menu" ,.need_menu_action = "Alleen vanuit het WiiU-menu"
,.using_nintendo_network = "Nintendo Network wordt gebruikt" ,.using_nintendo_network = "Nintendo Network wordt gebruikt"
,.using_pretendo_network = "Pretendo 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"

View file

@ -8,3 +8,5 @@
,.need_menu_action = "Apenas no menu do Wii U" ,.need_menu_action = "Apenas no menu do Wii U"
,.using_nintendo_network = "Usando Nintendo Network" ,.using_nintendo_network = "Usando Nintendo Network"
,.using_pretendo_network = "Usando Pretendo 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"

View file

@ -8,3 +8,5 @@
,.need_menu_action = "Только из меню Wii U" ,.need_menu_action = "Только из меню Wii U"
,.using_nintendo_network = "Используется Nintendo Network" ,.using_nintendo_network = "Используется Nintendo Network"
,.using_pretendo_network = "Используется Pretendo 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"

View file

@ -8,3 +8,5 @@
,.need_menu_action = "仅来自WiiU Menu" ,.need_menu_action = "仅来自WiiU Menu"
,.using_nintendo_network = "使用 Nintendo Network" ,.using_nintendo_network = "使用 Nintendo Network"
,.using_pretendo_network = "使用 Pretendo 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"

View file

@ -8,3 +8,5 @@
,.need_menu_action = "僅來自WiiU Menu" ,.need_menu_action = "僅來自WiiU Menu"
,.using_nintendo_network = "使用 Nintendo Network" ,.using_nintendo_network = "使用 Nintendo Network"
,.using_pretendo_network = "使用 Pretendo 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"