installer_wizard: use enum for localisation

This commit is contained in:
Hyper 2024-12-04 03:04:20 +00:00
parent 7b0e6dc635
commit 130d72d805
2 changed files with 18 additions and 18 deletions

View file

@ -99,31 +99,31 @@ inline static std::unordered_map<std::string, std::unordered_map<ELanguage, std:
} }
}, },
{ {
"Installer_Page_Language", "Installer_Page_SelectLanguage",
{ {
{ ELanguage::English, "Please select a language." } { ELanguage::English, "Please select a language." }
} }
}, },
{ {
"Installer_Page_Welcome", "Installer_Page_Introduction",
{ {
{ ELanguage::English, "Welcome to Unleashed Recompiled!\n\nYou'll need an Xbox 360 copy\nof Sonic Unleashed in order to proceed with the installation." } { ELanguage::English, "Welcome to Unleashed Recompiled!\n\nYou'll need an Xbox 360 copy\nof Sonic Unleashed in order to proceed with the installation." }
} }
}, },
{ {
"Installer_Page_AddGame", "Installer_Page_SelectGameAndUpdate",
{ {
{ ELanguage::English, "Add the files for the game and its title update. You can use digital dumps or pre-extracted folders containing the necessary files." } { ELanguage::English, "Add the files for the game and its title update. You can use digital dumps or pre-extracted folders containing the necessary files." }
} }
}, },
{ {
"Installer_Page_AddDLC", "Installer_Page_SelectDLC",
{ {
{ ELanguage::English, "Add the files for the DLC. You can use digital dumps or pre-extracted folders containing the necessary files." } { ELanguage::English, "Add the files for the DLC. You can use digital dumps or pre-extracted folders containing the necessary files." }
} }
}, },
{ {
"Installer_Page_FreeSpace", "Installer_Page_CheckSpace",
{ {
{ ELanguage::English, "The content will be installed to the program's folder. Please confirm you have enough free space.\n\n" } { ELanguage::English, "The content will be installed to the program's folder. Please confirm you have enough free space.\n\n" }
} }
@ -135,7 +135,7 @@ inline static std::unordered_map<std::string, std::unordered_map<ELanguage, std:
} }
}, },
{ {
"Installer_Page_InstallComplete", "Installer_Page_InstallSucceeded",
{ {
{ ELanguage::English, "Installation complete.\n\nThis project is brought to you by:\n\n" } { ELanguage::English, "Installation complete.\n\nThis project is brought to you by:\n\n" }
} }

View file

@ -119,18 +119,18 @@ static bool g_currentMessageUpdateRemaining = false;
const char CREDITS_TEXT[] = "- Sajid (RIP)\n- imgui sega balls!"; const char CREDITS_TEXT[] = "- Sajid (RIP)\n- imgui sega balls!";
static std::string& GetWizardText(int index) static std::string& GetWizardText(WizardPage page)
{ {
switch (index) switch (page)
{ {
case 0: return Localise("Installer_Page_Language"); case WizardPage::SelectLanguage: return Localise("Installer_Page_SelectLanguage");
case 1: return Localise("Installer_Page_Welcome"); case WizardPage::Introduction: return Localise("Installer_Page_Introduction");
case 2: return Localise("Installer_Page_AddGame"); case WizardPage::SelectGameAndUpdate: return Localise("Installer_Page_SelectGameAndUpdate");
case 3: return Localise("Installer_Page_AddDLC"); case WizardPage::SelectDLC: return Localise("Installer_Page_SelectDLC");
case 4: return Localise("Installer_Page_FreeSpace"); case WizardPage::CheckSpace: return Localise("Installer_Page_CheckSpace");
case 5: return Localise("Installer_Page_Installing"); case WizardPage::Installing: return Localise("Installer_Page_Installing");
case 6: return Localise("Installer_Page_InstallComplete"); case WizardPage::InstallSucceeded: return Localise("Installer_Page_InstallSucceeded");
case 7: return Localise("Installer_Page_InstallFailed"); case WizardPage::InstallFailed: return Localise("Installer_Page_InstallFailed");
} }
return g_localeMissing; return g_localeMissing;
@ -385,7 +385,7 @@ static void DrawDescriptionContainer()
DrawContainer(descriptionMin, descriptionMax, true); DrawContainer(descriptionMin, descriptionMax, true);
char descriptionText[512]; char descriptionText[512];
strncpy(descriptionText, GetWizardText(int(g_currentPage)).c_str(), sizeof(descriptionText) - 1); strncpy(descriptionText, GetWizardText(g_currentPage).c_str(), sizeof(descriptionText) - 1);
if (g_currentPage == WizardPage::CheckSpace) if (g_currentPage == WizardPage::CheckSpace)
{ {
@ -399,7 +399,7 @@ static void DrawDescriptionContainer()
descriptionText, descriptionText,
sizeof(descriptionText), sizeof(descriptionText),
"%s%s %2.2f GiB\n%s %2.2f GiB", "%s%s %2.2f GiB\n%s %2.2f GiB",
GetWizardText(int(g_currentPage)).c_str(), GetWizardText(g_currentPage).c_str(),
Localise("Installer_Step_RequiredSpace").c_str(), requiredGiB, Localise("Installer_Step_RequiredSpace").c_str(), requiredGiB,
Localise("Installer_Step_AvailableSpace").c_str(), availableGiB Localise("Installer_Step_AvailableSpace").c_str(), availableGiB
); );