From d0605ea650d7d6f62cc5b745803558a8d1dc5fb1 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 15 Jul 2024 18:38:23 +0200 Subject: [PATCH] Added localization support to parts of the application --- es-app/src/ApplicationUpdater.cpp | 22 ++- es-app/src/guis/GuiApplicationUpdater.cpp | 143 ++++++++--------- es-app/src/views/ViewController.cpp | 184 ++++++++++++---------- 3 files changed, 185 insertions(+), 164 deletions(-) diff --git a/es-app/src/ApplicationUpdater.cpp b/es-app/src/ApplicationUpdater.cpp index 9e339559a..b3564019e 100644 --- a/es-app/src/ApplicationUpdater.cpp +++ b/es-app/src/ApplicationUpdater.cpp @@ -13,6 +13,7 @@ #include "Log.h" #include "Settings.h" #include "resources/ResourceManager.h" +#include "utils/LocalizationUtil.h" #include "utils/StringUtil.h" #include "utils/TimeUtil.h" @@ -198,8 +199,11 @@ void ApplicationUpdater::update() return; // Everything else is some sort of error. - std::string errorMessage {"Network error (status: "}; - errorMessage.append(std::to_string(reqStatus)).append(") - ").append(mRequest->getErrorMsg()); + std::string errorMessage {_("Network error (status:")}; + errorMessage.append(" ") + .append(std::to_string(reqStatus)) + .append(") - ") + .append(mRequest->getErrorMsg()); throw std::runtime_error(errorMessage); } @@ -435,21 +439,25 @@ void ApplicationUpdater::compareVersions() .append("), release date: ") .append(releaseType->date); - mResults.append("New "); - if (releaseType == &mPrerelease) { - mResults.append("prerelease available:\n") + mResults.append(_("New prerelease available:")) + .append("\n") .append(releaseType->version) .append(" (") .append(releaseType->date) .append(")"); } else { - mResults.append("release available: ").append(releaseType->version); + mResults.append(_("New release available:")) + .append(" ") + .append(releaseType->version); } if (mPackageType == PackageType::UNKNOWN) - mResults.append("\nFor more information visit\n").append("https://es-de.org"); + mResults.append("\n") + .append(_("For more information visit")) + .append("\n") + .append("https://es-de.org"); if (mPackage.message != "") mResults.append("\n").append(mPackage.message); diff --git a/es-app/src/guis/GuiApplicationUpdater.cpp b/es-app/src/guis/GuiApplicationUpdater.cpp index 72c07f5a8..4b46e34b5 100644 --- a/es-app/src/guis/GuiApplicationUpdater.cpp +++ b/es-app/src/guis/GuiApplicationUpdater.cpp @@ -12,6 +12,7 @@ #include "ApplicationVersion.h" #include "guis/GuiTextEditKeyboardPopup.h" #include "guis/GuiTextEditPopup.h" +#include "utils/LocalizationUtil.h" #include "utils/PlatformUtil.h" #include @@ -42,17 +43,17 @@ GuiApplicationUpdater::GuiApplicationUpdater() setDownloadPath(); // Set up grid. - mTitle = std::make_shared("APPLICATION UPDATER", Font::get(FONT_SIZE_LARGE), + mTitle = std::make_shared(_("APPLICATION UPDATER"), Font::get(FONT_SIZE_LARGE), mMenuColorTitle, ALIGN_CENTER); mGrid.setEntry(mTitle, glm::ivec2 {0, 0}, false, true, glm::ivec2 {4, 1}, GridFlags::BORDER_BOTTOM); mStatusHeader = std::make_shared( - "INSTALLATION STEPS:", Font::get(FONT_SIZE_MINI), mMenuColorPrimary, ALIGN_LEFT); + _("INSTALLATION STEPS:"), Font::get(FONT_SIZE_MINI), mMenuColorPrimary, ALIGN_LEFT); mGrid.setEntry(mStatusHeader, glm::ivec2 {1, 1}, false, true, glm::ivec2 {2, 1}); - const std::string step1Text {mLinuxAppImage ? "DOWNLOAD NEW RELEASE" : - "DOWNLOAD NEW RELEASE TO THIS DIRECTORY:"}; + const std::string step1Text {mLinuxAppImage ? _("DOWNLOAD NEW RELEASE") : + _("DOWNLOAD NEW RELEASE TO THIS DIRECTORY:")}; mProcessStep1 = std::make_shared(step1Text, Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary, ALIGN_LEFT); mGrid.setEntry(mProcessStep1, glm::ivec2 {1, 2}, false, true, glm::ivec2 {2, 1}); @@ -62,21 +63,21 @@ GuiApplicationUpdater::GuiApplicationUpdater() Utils::String::replace(Utils::FileSystem::getParent(mDownloadPackageFilename), "/", "\\")}; #else const std::string step2Text {mLinuxAppImage ? - "INSTALL PACKAGE" : + _("INSTALL PACKAGE") : Utils::FileSystem::getParent(mDownloadPackageFilename)}; #endif mProcessStep2 = std::make_shared(step2Text, Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary, ALIGN_LEFT); mGrid.setEntry(mProcessStep2, glm::ivec2 {1, 3}, false, true, glm::ivec2 {2, 1}); - const std::string step3Text {mLinuxAppImage ? "QUIT AND MANUALLY RESTART ES-DE" : - "QUIT AND MANUALLY UPGRADE ES-DE"}; + const std::string step3Text {mLinuxAppImage ? _("QUIT AND MANUALLY RESTART ES-DE") : + _("QUIT AND MANUALLY UPGRADE ES-DE")}; mProcessStep3 = std::make_shared(step3Text, Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary, ALIGN_LEFT); mGrid.setEntry(mProcessStep3, glm::ivec2 {1, 4}, false, true, glm::ivec2 {2, 1}); mStatusMessageHeader = std::make_shared( - "STATUS MESSAGE:", Font::get(FONT_SIZE_MINI), mMenuColorPrimary, ALIGN_LEFT); + _("STATUS MESSAGE:"), Font::get(FONT_SIZE_MINI), mMenuColorPrimary, ALIGN_LEFT); mGrid.setEntry(mStatusMessageHeader, glm::ivec2 {1, 6}, false, true, glm::ivec2 {2, 1}); mStatusMessage = std::make_shared("", Font::get(FONT_SIZE_SMALL), @@ -90,32 +91,34 @@ GuiApplicationUpdater::GuiApplicationUpdater() // Buttons. std::vector> buttons; - mButton1 = std::make_shared("DOWNLOAD", "download new release", [this]() { - if (!mDownloading) { - if (!mLinuxAppImage) { - if (!Utils::FileSystem::exists( - Utils::FileSystem::getParent(mDownloadPackageFilename))) { - mMessage = "Download directory does not exist"; - return; + mButton1 = + std::make_shared(_("DOWNLOAD"), _("download new release"), [this]() { + if (!mDownloading) { + if (!mLinuxAppImage) { + if (!Utils::FileSystem::exists( + Utils::FileSystem::getParent(mDownloadPackageFilename))) { + mMessage = _("Download directory does not exist"); + return; + } } + mMessage = ""; + mStatusMessage->setText(mMessage); + mDownloadPercentage = 0; + mDownloading = true; + if (mThread) { + mThread->join(); + mThread.reset(); + } + mThread = + std::make_unique(&GuiApplicationUpdater::downloadPackage, this); } - mMessage = ""; - mStatusMessage->setText(mMessage); - mDownloadPercentage = 0; - mDownloading = true; - if (mThread) { - mThread->join(); - mThread.reset(); - } - mThread = std::make_unique(&GuiApplicationUpdater::downloadPackage, this); - } - }); + }); buttons.push_back(mButton1); if (!mLinuxAppImage) { mButton2 = std::make_shared( - "CHANGE DIRECTORY", "change download directory", [this]() { + _("CHANGE DIRECTORY"), _("change download directory"), [this]() { if (mDownloading || mHasDownloaded) return; #if defined(_WIN64) @@ -156,40 +159,40 @@ GuiApplicationUpdater::GuiApplicationUpdater() }; if (Settings::getInstance()->getBool("VirtualKeyboard")) { mWindow->pushGui(new GuiTextEditKeyboardPopup( - getHelpStyle(), 0.0f, "ENTER DOWNLOAD DIRECTORY", currentDownloadDirectory, - directoryFunc, false)); + getHelpStyle(), 0.0f, _("ENTER DOWNLOAD DIRECTORY"), + currentDownloadDirectory, directoryFunc, false)); } else { mWindow->pushGui( - new GuiTextEditPopup(getHelpStyle(), "ENTER DOWNLOAD DIRECTORY", + new GuiTextEditPopup(getHelpStyle(), _("ENTER DOWNLOAD DIRECTORY"), currentDownloadDirectory, directoryFunc, false)); } }); buttons.push_back(mButton2); } - mButton3 = std::make_shared("CANCEL", "cancel", [this]() { + mButton3 = std::make_shared(_("CANCEL"), _("cancel"), [this]() { mAbortDownload = true; if (mThread) { mThread->join(); mThread.reset(); } if (mDownloading) { - mWindow->pushGui( - new GuiMsgBox(getHelpStyle(), "DOWNLOAD ABORTED\nNO PACKAGE SAVED TO DISK", "OK", - nullptr, "", nullptr, "", nullptr, nullptr, true, true, - (mRenderer->getIsVerticalOrientation() ? - 0.70f : - 0.45f * (1.778f / mRenderer->getScreenAspectRatio())))); - } - else if (mHasDownloaded || mReadyToInstall) { mWindow->pushGui(new GuiMsgBox( - getHelpStyle(), "PACKAGE WAS DOWNLOADED AND\nCAN BE MANUALLY INSTALLED", "OK", - nullptr, "", nullptr, "", nullptr, nullptr, true, true, + getHelpStyle(), _("DOWNLOAD ABORTED") + "\n" + _("NO PACKAGE SAVED TO DISK"), + _("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true, (mRenderer->getIsVerticalOrientation() ? 0.70f : 0.45f * (1.778f / mRenderer->getScreenAspectRatio())))); } + else if (mHasDownloaded || mReadyToInstall) { + mWindow->pushGui(new GuiMsgBox( + getHelpStyle(), _("PACKAGE WAS DOWNLOADED AND CAN BE MANUALLY INSTALLED"), _("OK"), + nullptr, "", nullptr, "", nullptr, nullptr, true, true, + (mRenderer->getIsVerticalOrientation() ? + 0.60f : + 0.35f * (1.778f / mRenderer->getScreenAspectRatio())))); + } delete this; }); @@ -217,7 +220,7 @@ GuiApplicationUpdater::GuiApplicationUpdater() std::round(mRenderer->getScreenHeight() * 0.13f)); mBusyAnim.setSize(mSize); - mBusyAnim.setText("DOWNLOADING 100%"); + mBusyAnim.setText(_("DOWNLOADING 100%")); mBusyAnim.onSizeChanged(); } @@ -270,8 +273,9 @@ bool GuiApplicationUpdater::downloadPackage() break; } else if (reqStatus != HttpReq::REQ_IN_PROGRESS) { - std::string errorMessage {"Network error (status: "}; - errorMessage.append(std::to_string(reqStatus)) + std::string errorMessage {_("Network error (status:")}; + errorMessage.append(" ") + .append(std::to_string(reqStatus)) .append(") - ") .append(mRequest->getErrorMsg()); mRequest.reset(); @@ -301,7 +305,7 @@ bool GuiApplicationUpdater::downloadPackage() mRequest.reset(); if (Utils::Math::md5Hash(fileContents, false) != mPackage.md5) { - const std::string errorMessage {"Downloaded file does not match expected MD5 checksum"}; + const std::string errorMessage {_("Downloaded file does not match expected MD5 checksum")}; LOG(LogError) << errorMessage; std::unique_lock lock {mMutex}; mMessage = "Error: " + errorMessage; @@ -317,11 +321,9 @@ bool GuiApplicationUpdater::downloadPackage() LOG(LogInfo) << "Temporary package file already exists, deleting it"; Utils::FileSystem::removeFile(mDownloadPackageFilename); if (Utils::FileSystem::exists(mDownloadPackageFilename)) { - const std::string errorMessage { - "Couldn't delete temporary package file, permission problems?"}; - LOG(LogError) << errorMessage; + LOG(LogError) << "Couldn't delete temporary package file, permission problems?"; std::unique_lock lock {mMutex}; - mMessage = "Error: " + errorMessage; + mMessage = _("Error: Couldn't delete temporary package file, permission problems?"); return true; } } @@ -334,7 +336,7 @@ bool GuiApplicationUpdater::downloadPackage() LOG(LogError) << "Couldn't write package file \"" << mDownloadPackageFilename << "\", permission problems?"; std::unique_lock lock {mMutex}; - mMessage = "Error: Couldn't write package file, permission problems?"; + mMessage = _("Error: Couldn't write package file, permission problems?"); return true; } @@ -353,10 +355,9 @@ bool GuiApplicationUpdater::downloadPackage() (std::filesystem::perms::owner_all | std::filesystem::perms::group_all | std::filesystem::perms::others_read | std::filesystem::perms::others_exec)) { Utils::FileSystem::removeFile(mDownloadPackageFilename); - const std::string errorMessage {"Couldn't set permissions on AppImage file"}; - LOG(LogError) << errorMessage; + LOG(LogError) << "Couldn't set permissions on AppImage file"; std::unique_lock lock {mMutex}; - mMessage = "Error: " + errorMessage; + mMessage = _("Error: Couldn't set permissions on AppImage file"); return true; } } @@ -364,7 +365,8 @@ bool GuiApplicationUpdater::downloadPackage() LOG(LogInfo) << "Successfully downloaded package file \"" << mDownloadPackageFilename << "\""; std::unique_lock lock {mMutex}; - mMessage = "Downloaded " + Utils::FileSystem::getFileName(mDownloadPackageFilename); + mMessage = Utils::String::format( + _("Downloaded %s"), Utils::FileSystem::getFileName(mDownloadPackageFilename).c_str()); mDownloading = false; mReadyToInstall = true; @@ -398,9 +400,8 @@ bool GuiApplicationUpdater::installAppImage() readFile.open(mDownloadPackageFilename.c_str(), std::ofstream::binary); if (readFile.fail()) { - const std::string errorMessage {"Couldn't open AppImage update file for reading"}; - LOG(LogError) << errorMessage; - mMessage = "Error: " + errorMessage; + LOG(LogError) << "Couldn't open AppImage update file for reading"; + mMessage = _("Error: Couldn't open AppImage update file for reading"); mHasDownloaded = false; return true; } @@ -413,9 +414,8 @@ bool GuiApplicationUpdater::installAppImage() readFile.close(); if (Utils::Math::md5Hash(fileData, false) != mPackage.md5) { - const std::string errorMessage {"Downloaded file does not match expected MD5 checksum"}; - LOG(LogError) << errorMessage; - mMessage = "Error: " + errorMessage; + LOG(LogError) << "Downloaded file does not match expected MD5 checksum"; + mMessage = _("Error: Downloaded file does not match expected MD5 checksum"); mHasDownloaded = false; return true; } @@ -423,10 +423,8 @@ bool GuiApplicationUpdater::installAppImage() const std::string packageOldFile {packageTargetFile + "_" + PROGRAM_VERSION_STRING + ".OLD"}; if (Utils::FileSystem::renameFile(packageTargetFile, packageOldFile, true)) { - const std::string errorMessage { - "Couldn't rename running AppImage file, permission problems?"}; - LOG(LogError) << errorMessage; - mMessage = "Error: " + errorMessage; + LOG(LogError) << "Couldn't rename running AppImage file, permission problems?"; + mMessage = _("Error: Couldn't rename running AppImage file, permission problems?"); LOG(LogInfo) << "Attempting to rename \"" << packageOldFile << "\" back to running AppImage"; Utils::FileSystem::renameFile(packageOldFile, packageTargetFile, true); @@ -437,10 +435,8 @@ bool GuiApplicationUpdater::installAppImage() LOG(LogInfo) << "Renamed running AppImage to \"" << packageOldFile << "\""; if (Utils::FileSystem::renameFile(mDownloadPackageFilename, packageTargetFile, true)) { - const std::string errorMessage { - "Couldn't replace running AppImage file, permission problems?"}; - LOG(LogError) << errorMessage; - mMessage = "Error: " + errorMessage; + LOG(LogError) << "Couldn't replace running AppImage file, permission problems?"; + mMessage = _("Error: Couldn't replace running AppImage file, permission problems?"); LOG(LogInfo) << "Attempting to rename \"" << packageOldFile << "\" back to running AppImage"; Utils::FileSystem::renameFile(packageOldFile, packageTargetFile, true); @@ -451,7 +447,8 @@ bool GuiApplicationUpdater::installAppImage() LOG(LogInfo) << "Package was successfully installed as \"" << packageTargetFile << "\""; std::unique_lock lock {mMutex}; - mMessage = "Successfully installed as " + Utils::FileSystem::getFileName(packageTargetFile); + mMessage = Utils::String::format(_("Successfully installed as %s"), + Utils::FileSystem::getFileName(packageTargetFile).c_str()); mHasInstalled = true; return false; @@ -468,13 +465,13 @@ void GuiApplicationUpdater::update(int deltaTime) } if (mDownloading) { - mBusyAnim.setText("DOWNLOADING " + std::to_string(mDownloadPercentage) + "%"); + mBusyAnim.setText(_("DOWNLOADING") + " " + std::to_string(mDownloadPercentage) + "%"); mBusyAnim.update(deltaTime); } else if (mLinuxAppImage && mReadyToInstall) { mProcessStep1->setText(ViewController::TICKMARK_CHAR + " " + mProcessStep1->getValue()); mProcessStep1->setColor(mMenuColorGreen); - mButton1->setText("INSTALL", "install package", true, false); + mButton1->setText(_("INSTALL"), _("install package"), true, false); mButton1->setPressedFunc([this] { if (!mInstalling) { mMessage = ""; @@ -494,10 +491,10 @@ void GuiApplicationUpdater::update(int deltaTime) mProcessStep1->setText(ViewController::TICKMARK_CHAR + " " + mProcessStep1->getValue()); mProcessStep1->setColor(mMenuColorGreen); } - mChangelogMessage->setText("Find the detailed changelog at https://es-de.org"); + mChangelogMessage->setText(_("Find the detailed changelog at") + " https://es-de.org"); mGrid.removeEntry(mButtons); mGrid.setEntry(MenuComponent::makeButtonGrid(std::vector> { - std::make_shared("QUIT", "quit application", + std::make_shared(_("QUIT"), _("quit application"), [this]() { delete this; Utils::Platform::quitES(); diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index fa739284b..5526c65da 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -31,6 +31,7 @@ #include "guis/GuiMenu.h" #include "guis/GuiTextEditKeyboardPopup.h" #include "guis/GuiTextEditPopup.h" +#include "utils/LocalizationUtil.h" #include "views/GamelistView.h" #include "views/SystemView.h" @@ -186,15 +187,15 @@ void ViewController::migratedAppDataFilesDialog() void ViewController::unsafeUpgradeDialog() { const std::string upgradeMessage { - "IT SEEMS AS IF AN UNSAFE UPGRADE HAS BEEN MADE, POSSIBLY BY " - "UNPACKING THE NEW RELEASE ON TOP OF THE OLD ONE? THIS MAY CAUSE " - "VARIOUS PROBLEMS, SOME OF WHICH MAY NOT BE APPARENT IMMEDIATELY. " - "MAKE SURE TO ALWAYS FOLLOW THE UPGRADE INSTRUCTIONS IN THE " - "README.TXT FILE THAT CAN BE FOUND IN THE ES-DE DIRECTORY."}; + _("IT SEEMS AS IF AN UNSAFE UPGRADE HAS BEEN MADE, POSSIBLY BY " + "UNPACKING THE NEW RELEASE ON TOP OF THE OLD ONE? THIS MAY CAUSE " + "VARIOUS PROBLEMS, SOME OF WHICH MAY NOT BE APPARENT IMMEDIATELY. " + "MAKE SURE TO ALWAYS FOLLOW THE UPGRADE INSTRUCTIONS IN THE " + "README.TXT FILE THAT CAN BE FOUND IN THE ES-DE DIRECTORY.")}; mWindow->pushGui(new GuiMsgBox( - HelpStyle(), upgradeMessage.c_str(), "OK", [] {}, "", nullptr, "", nullptr, nullptr, true, - true, + HelpStyle(), upgradeMessage.c_str(), _("OK"), [] {}, "", nullptr, "", nullptr, nullptr, + true, true, (mRenderer->getIsVerticalOrientation() ? 0.85f : 0.55f * (1.778f / mRenderer->getScreenAspectRatio())))); @@ -202,15 +203,15 @@ void ViewController::unsafeUpgradeDialog() void ViewController::invalidSystemsFileDialog() { - const std::string errorMessage {"COULDN'T PARSE THE SYSTEMS CONFIGURATION FILE. " - "IF YOU HAVE A CUSTOMIZED es_systems.xml FILE, THEN " - "SOMETHING IS LIKELY WRONG WITH YOUR XML SYNTAX. " - "IF YOU DON'T HAVE A CUSTOM SYSTEMS FILE, THEN THE " - "ES-DE INSTALLATION IS BROKEN. SEE THE APPLICATION " - "LOG FILE es_log.txt FOR ADDITIONAL INFO"}; + const std::string errorMessage {_("COULDN'T PARSE THE SYSTEMS CONFIGURATION FILE. " + "IF YOU HAVE A CUSTOMIZED es_systems.xml FILE, THEN " + "SOMETHING IS LIKELY WRONG WITH YOUR XML SYNTAX. " + "IF YOU DON'T HAVE A CUSTOM SYSTEMS FILE, THEN THE " + "ES-DE INSTALLATION IS BROKEN. SEE THE APPLICATION " + "LOG FILE es_log.txt FOR ADDITIONAL INFO")}; mWindow->pushGui(new GuiMsgBox( - HelpStyle(), errorMessage.c_str(), "QUIT", + HelpStyle(), errorMessage.c_str(), _("QUIT"), [] { SDL_Event quit {}; quit.type = SDL_QUIT; @@ -225,20 +226,20 @@ void ViewController::invalidSystemsFileDialog() void ViewController::noGamesDialog() { #if defined(__ANDROID__) - mNoGamesErrorMessage = "NO GAME FILES WERE FOUND, PLEASE PLACE YOUR GAMES IN " - "THE CONFIGURED ROM DIRECTORY. OPTIONALLY THE ROM " - "DIRECTORY STRUCTURE CAN BE GENERATED WHICH WILL " - "CREATE A TEXT FILE FOR EACH SYSTEM PROVIDING SOME " - "INFORMATION SUCH AS THE SUPPORTED FILE EXTENSIONS.\n" - "THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n"; + mNoGamesErrorMessage = _("NO GAME FILES WERE FOUND, PLEASE PLACE YOUR GAMES IN " + "THE CONFIGURED ROM DIRECTORY. OPTIONALLY THE ROM " + "DIRECTORY STRUCTURE CAN BE GENERATED WHICH WILL " + "CREATE A TEXT FILE FOR EACH SYSTEM PROVIDING SOME " + "INFORMATION SUCH AS THE SUPPORTED FILE EXTENSIONS.\n" + "THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n"); #else - mNoGamesErrorMessage = "NO GAME FILES WERE FOUND. EITHER PLACE YOUR GAMES IN " - "THE CURRENTLY CONFIGURED ROM DIRECTORY OR CHANGE " - "ITS PATH USING THE BUTTON BELOW. OPTIONALLY THE ROM " - "DIRECTORY STRUCTURE CAN BE GENERATED WHICH WILL " - "CREATE A TEXT FILE FOR EACH SYSTEM PROVIDING SOME " - "INFORMATION SUCH AS THE SUPPORTED FILE EXTENSIONS.\n" - "THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n"; + mNoGamesErrorMessage = _("NO GAME FILES WERE FOUND. EITHER PLACE YOUR GAMES IN " + "THE CURRENTLY CONFIGURED ROM DIRECTORY OR CHANGE " + "ITS PATH USING THE BUTTON BELOW. OPTIONALLY THE ROM " + "DIRECTORY STRUCTURE CAN BE GENERATED WHICH WILL " + "CREATE A TEXT FILE FOR EACH SYSTEM PROVIDING SOME " + "INFORMATION SUCH AS THE SUPPORTED FILE EXTENSIONS.\n" + "THIS IS THE CURRENTLY CONFIGURED ROM DIRECTORY:\n"); #endif #if defined(_WIN64) @@ -252,7 +253,7 @@ void ViewController::noGamesDialog() HelpStyle(), mNoGamesErrorMessage + mRomDirectory, #else mNoGamesMessageBox = new GuiMsgBox( - HelpStyle(), mNoGamesErrorMessage + mRomDirectory, "CHANGE ROM DIRECTORY", + HelpStyle(), mNoGamesErrorMessage + mRomDirectory, _("CHANGE ROM DIRECTORY"), [this] { std::string currentROMDirectory; #if defined(_WIN64) @@ -262,7 +263,7 @@ void ViewController::noGamesDialog() #endif if (Settings::getInstance()->getBool("VirtualKeyboard")) { mWindow->pushGui(new GuiTextEditKeyboardPopup( - HelpStyle(), 0.0f, "ENTER ROM DIRECTORY PATH", currentROMDirectory, + HelpStyle(), 0.0f, _("ENTER ROM DIRECTORY PATH"), currentROMDirectory, [this, currentROMDirectory](const std::string& newROMDirectory) { if (currentROMDirectory != newROMDirectory) { Settings::getInstance()->setString( @@ -275,20 +276,23 @@ void ViewController::noGamesDialog() mRomDirectory = FileData::getROMDirectory(); #endif mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory); - mWindow->pushGui(new GuiMsgBox(HelpStyle(), - "ROM DIRECTORY SETTING SAVED, RESTART\n" - "THE APPLICATION TO RESCAN THE SYSTEMS", - "OK", nullptr, "", nullptr, "", nullptr, - nullptr, true, true)); + mWindow->pushGui(new GuiMsgBox( + HelpStyle(), + _("ROM DIRECTORY SETTING SAVED, RESTART " + "THE APPLICATION TO RESCAN THE SYSTEMS"), + _("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true, + (mRenderer->getIsVerticalOrientation() ? + 0.66f : + 0.42f * (1.778f / mRenderer->getScreenAspectRatio())))); } }, - false, "SAVE", "SAVE CHANGES?", "Currently configured path:", - currentROMDirectory, "LOAD CURRENTLY CONFIGURED PATH", - "CLEAR (LEAVE BLANK TO RESET TO DEFAULT PATH)")); + false, _("SAVE"), _("SAVE CHANGES?"), _("Currently configured path:"), + currentROMDirectory, _("LOAD CURRENTLY CONFIGURED PATH"), + _("CLEAR (LEAVE BLANK TO RESET TO DEFAULT PATH)"))); } else { mWindow->pushGui(new GuiTextEditPopup( - HelpStyle(), "ENTER ROM DIRECTORY PATH", currentROMDirectory, + HelpStyle(), _("ENTER ROM DIRECTORY PATH"), currentROMDirectory, [this](const std::string& newROMDirectory) { Settings::getInstance()->setString("ROMDirectory", Utils::String::trim(newROMDirectory)); @@ -300,48 +304,60 @@ void ViewController::noGamesDialog() mRomDirectory = FileData::getROMDirectory(); #endif mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory); - mWindow->pushGui(new GuiMsgBox(HelpStyle(), - "ROM DIRECTORY SETTING SAVED, RESTART\n" - "THE APPLICATION TO RESCAN THE SYSTEMS", - "OK", nullptr, "", nullptr, "", nullptr, - nullptr, true)); + mWindow->pushGui(new GuiMsgBox( + HelpStyle(), + _("ROM DIRECTORY SETTING SAVED, RESTART " + "THE APPLICATION TO RESCAN THE SYSTEMS"), + _("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true, + (mRenderer->getIsVerticalOrientation() ? + 0.66f : + 0.42f * (1.778f / mRenderer->getScreenAspectRatio())))); }, - false, "SAVE", "SAVE CHANGES?", "Currently configured path:", - currentROMDirectory, "LOAD CURRENTLY CONFIGURED PATH", - "CLEAR (LEAVE BLANK TO RESET TO DEFAULT PATH)")); + false, _("SAVE"), _("SAVE CHANGES?"), _("Currently configured path:"), + currentROMDirectory, _("LOAD CURRENTLY CONFIGURED PATH"), + _("CLEAR (LEAVE BLANK TO RESET TO DEFAULT PATH)"))); } }, #endif // __ANDROID__ - "CREATE DIRECTORIES", + _("CREATE DIRECTORIES"), [this] { mWindow->pushGui(new GuiMsgBox( HelpStyle(), - "THIS WILL CREATE DIRECTORIES FOR ALL THE\n" - "GAME SYSTEMS DEFINED IN es_systems.xml\n\n" - "THIS MAY CREATE A LOT OF FOLDERS SO IT'S\n" - "ADVICED TO REMOVE THE ONES YOU DON'T NEED", - "PROCEED", + _("THIS WILL CREATE DIRECTORIES FOR ALL THE " + "GAME SYSTEMS DEFINED IN es_systems.xml\n\n" + "THIS MAY CREATE A LOT OF FOLDERS SO IT'S " + "ADVICED TO REMOVE THE ONES YOU DON'T NEED"), + _("PROCEED"), [this] { if (!SystemData::createSystemDirectories()) { - mWindow->pushGui(new GuiMsgBox(HelpStyle(), - "THE SYSTEM DIRECTORIES WERE SUCCESSFULLY\n" - "GENERATED, EXIT THE APPLICATION AND PLACE\n" - "YOUR GAMES IN THE NEWLY CREATED FOLDERS", - "OK", nullptr, "", nullptr, "", nullptr, - nullptr, true)); + mWindow->pushGui(new GuiMsgBox( + HelpStyle(), + _("THE SYSTEM DIRECTORIES WERE SUCCESSFULLY " + "GENERATED, EXIT THE APPLICATION AND PLACE " + "YOUR GAMES IN THE NEW FOLDERS"), + _("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true, + (mRenderer->getIsVerticalOrientation() ? + 0.74f : + 0.46f * (1.778f / mRenderer->getScreenAspectRatio())))); } else { - mWindow->pushGui(new GuiMsgBox(HelpStyle(), - "ERROR CREATING THE SYSTEM DIRECTORIES,\n" - "PERMISSION PROBLEMS OR DISK FULL?\n\n" - "SEE THE LOG FILE FOR MORE DETAILS", - "OK", nullptr, "", nullptr, "", nullptr, - nullptr, true)); + mWindow->pushGui(new GuiMsgBox( + HelpStyle(), + _("ERROR CREATING THE SYSTEM DIRECTORIES, " + "PERMISSION PROBLEMS OR DISK FULL?\n\n" + "SEE THE LOG FILE FOR MORE DETAILS"), + _("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true, + (mRenderer->getIsVerticalOrientation() ? + 0.75f : + 0.47f * (1.778f / mRenderer->getScreenAspectRatio())))); } }, - "CANCEL", nullptr, "", nullptr, nullptr, false)); + _("CANCEL"), nullptr, "", nullptr, nullptr, false, true, + (mRenderer->getIsVerticalOrientation() ? + 0.78f : + 0.50 * (1.778f / mRenderer->getScreenAspectRatio())))); }, - "QUIT", + _("QUIT"), [] { SDL_Event quit {}; quit.type = SDL_QUIT; @@ -394,7 +410,7 @@ void ViewController::updateAvailableDialog() << "\""; mWindow->pushGui(new GuiMsgBox( - getHelpStyle(), results, "UPDATE", + getHelpStyle(), results, _("UPDATE"), [this, package] { mWindow->pushGui(new GuiApplicationUpdater()); @@ -402,36 +418,36 @@ void ViewController::updateAvailableDialog() std::string upgradeMessage; if (package.name == "WindowsPortable") { upgradeMessage = - "THE APPLICATION UPDATER WILL DOWNLOAD THE LATEST PORTABLE WINDOWS " - "RELEASE FOR YOU, BUT YOU WILL NEED TO MANUALLY PERFORM THE UPGRADE. " - "SEE THE README.TXT FILE INSIDE THE DOWNLOADED ZIP FILE FOR " - "INSTRUCTIONS ON HOW THIS IS ACCOMPLISHED. AS IS ALSO DESCRIBED IN " - "THAT DOCUMENT, NEVER UNPACK A NEW RELEASE ON TOP OF AN OLD " - "INSTALLATION AS THAT MAY COMPLETELY BREAK THE APPLICATION."; + _("THE APPLICATION UPDATER WILL DOWNLOAD THE LATEST PORTABLE WINDOWS " + "RELEASE FOR YOU, BUT YOU WILL NEED TO MANUALLY PERFORM THE UPGRADE. " + "SEE THE README.TXT FILE INSIDE THE DOWNLOADED ZIP FILE FOR " + "INSTRUCTIONS ON HOW THIS IS ACCOMPLISHED. AS IS ALSO DESCRIBED IN " + "THAT DOCUMENT, NEVER UNPACK A NEW RELEASE ON TOP OF AN OLD " + "INSTALLATION AS THAT MAY BREAK THE APPLICATION."); } else if (package.name == "WindowsInstaller") { upgradeMessage = - "THE APPLICATION UPDATER WILL DOWNLOAD THE LATEST WINDOWS INSTALLER " - "RELEASE FOR YOU, BUT YOU WILL NEED TO MANUALLY RUN IT TO PERFORM " - "THE UPGRADE. WHEN DOING THIS, MAKE SURE THAT YOU ANSWER YES TO THE " - "QUESTION OF WHETHER TO UNINSTALL THE OLD VERSION, OR YOU MAY " - "END UP WITH A BROKEN SETUP."; + _("THE APPLICATION UPDATER WILL DOWNLOAD THE LATEST WINDOWS INSTALLER " + "RELEASE FOR YOU, BUT YOU WILL NEED TO MANUALLY RUN IT TO PERFORM " + "THE UPGRADE. WHEN DOING THIS, MAKE SURE THAT YOU ANSWER YES TO THE " + "QUESTION OF WHETHER TO UNINSTALL THE OLD VERSION, OR YOU MAY " + "END UP WITH A BROKEN SETUP."); } else if (package.name == "macOSApple" || package.name == "macOSIntel") { upgradeMessage = - "THE APPLICATION UPDATER WILL DOWNLOAD THE LATEST RELEASE FOR " - "YOU, BUT YOU WILL NEED TO MANUALLY INSTALL THE DMG FILE TO PERFORM " - "THE UPGRADE."; + _("THE APPLICATION UPDATER WILL DOWNLOAD THE LATEST RELEASE FOR " + "YOU, BUT YOU WILL NEED TO MANUALLY INSTALL THE DMG FILE TO PERFORM " + "THE UPGRADE."); } mWindow->pushGui(new GuiMsgBox( - getHelpStyle(), upgradeMessage.c_str(), "OK", [] {}, "", nullptr, "", + getHelpStyle(), upgradeMessage.c_str(), _("OK"), [] {}, "", nullptr, "", nullptr, nullptr, true, true, (mRenderer->getIsVerticalOrientation() ? 0.85f : 0.535f * (1.778f / mRenderer->getScreenAspectRatio())))); } }, - "CANCEL", + _("CANCEL"), [] { HttpReq::cleanupCurlMulti(); return; @@ -442,7 +458,7 @@ void ViewController::updateAvailableDialog() 0.45f * (1.778f / mRenderer->getScreenAspectRatio())))); } else { - mWindow->pushGui(new GuiMsgBox(getHelpStyle(), results, "OK", nullptr, "", nullptr, "", + mWindow->pushGui(new GuiMsgBox(getHelpStyle(), results, _("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true, (mRenderer->getIsVerticalOrientation() ? 0.70f :