Added localization support to parts of the application

This commit is contained in:
Leon Styhre 2024-07-14 12:35:40 +02:00
parent f5dbaa3224
commit ac7f912654
2 changed files with 90 additions and 81 deletions

View file

@ -98,7 +98,8 @@ GuiAlternativeEmulators::GuiAlternativeEmulators()
*std::find(SystemData::sSystemVector.cbegin(), SystemData::sSystemVector.cend(), *it)}; *std::find(SystemData::sSystemVector.cbegin(), SystemData::sSystemVector.cend(), *it)};
row.makeAcceptInputHandler([this, systemEntry, labelText] { row.makeAcceptInputHandler([this, systemEntry, labelText] {
if (labelText->getValue() == ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY") if (labelText->getValue() ==
ViewController::CROSSEDCIRCLE_CHAR + " " + _("CLEARED ENTRY"))
return; return;
selectorWindow(systemEntry); selectorWindow(systemEntry);
}); });
@ -112,7 +113,7 @@ GuiAlternativeEmulators::GuiAlternativeEmulators()
if (!mHasSystems) { if (!mHasSystems) {
ComponentListRow row; ComponentListRow row;
std::shared_ptr<TextComponent> systemText {std::make_shared<TextComponent>( std::shared_ptr<TextComponent> systemText {std::make_shared<TextComponent>(
ViewController::EXCLAMATION_CHAR + " NO ALTERNATIVE EMULATORS DEFINED", ViewController::EXCLAMATION_CHAR + " " + _("NO ALTERNATIVE EMULATORS DEFINED"),
Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary, ALIGN_CENTER)}; Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary, ALIGN_CENTER)};
row.addElement(systemText, true); row.addElement(systemText, true);
mMenu.addRow(row); mMenu.addRow(row);
@ -151,7 +152,7 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
ComponentListRow row; ComponentListRow row;
if (entry.second == "") if (entry.second == "")
label = ViewController::CROSSEDCIRCLE_CHAR + " CLEAR INVALID ENTRY"; label = ViewController::CROSSEDCIRCLE_CHAR + " " + _("CLEAR INVALID ENTRY");
else else
label = entry.second; label = entry.second;
@ -160,7 +161,8 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
labelText->setSelectable(true); labelText->setSelectable(true);
if (system->getSystemEnvData()->mLaunchCommands.front().second == label) if (system->getSystemEnvData()->mLaunchCommands.front().second == label)
labelText->setValue(labelText->getValue().append(" [DEFAULT]")); labelText->setValue(
labelText->getValue().append(" [").append(_("DEFAULT")).append("]"));
row.addElement(labelText, true); row.addElement(labelText, true);
row.makeAcceptInputHandler([this, s, system, labelText, entry, selectedLabel] { row.makeAcceptInputHandler([this, s, system, labelText, entry, selectedLabel] {
@ -174,7 +176,7 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
if (entry.second == system->getSystemEnvData()->mLaunchCommands.front().second) { if (entry.second == system->getSystemEnvData()->mLaunchCommands.front().second) {
if (system->getSystemEnvData()->mLaunchCommands.front().second == "") { if (system->getSystemEnvData()->mLaunchCommands.front().second == "") {
updateMenu(system->getName(), updateMenu(system->getName(),
ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY", ViewController::CROSSEDCIRCLE_CHAR + " " + _("CLEARED ENTRY"),
(entry.second == (entry.second ==
system->getSystemEnvData()->mLaunchCommands.front().second)); system->getSystemEnvData()->mLaunchCommands.front().second));
} }

View file

@ -12,6 +12,7 @@
#include "ThemeData.h" #include "ThemeData.h"
#include "components/MenuComponent.h" #include "components/MenuComponent.h"
#include "resources/ResourceManager.h" #include "resources/ResourceManager.h"
#include "utils/LocalizationUtil.h"
#include "rapidjson/document.h" #include "rapidjson/document.h"
#include "rapidjson/error/en.h" #include "rapidjson/error/en.h"
@ -44,7 +45,7 @@ GuiThemeDownloader::GuiThemeDownloader(std::function<void()> updateCallback)
FONT_SIZE_SMALL}; FONT_SIZE_SMALL};
// Set up main grid. // Set up main grid.
mTitle = std::make_shared<TextComponent>("THEME DOWNLOADER", Font::get(FONT_SIZE_LARGE), mTitle = std::make_shared<TextComponent>(_("THEME DOWNLOADER"), Font::get(FONT_SIZE_LARGE),
mMenuColorTitle, ALIGN_CENTER); mMenuColorTitle, ALIGN_CENTER);
mGrid.setEntry(mTitle, glm::ivec2 {0, 0}, false, true, glm::ivec2 {2, 2}, mGrid.setEntry(mTitle, glm::ivec2 {0, 0}, false, true, glm::ivec2 {2, 2},
GridFlags::BORDER_BOTTOM); GridFlags::BORDER_BOTTOM);
@ -128,7 +129,8 @@ GuiThemeDownloader::GuiThemeDownloader(std::function<void()> updateCallback)
mGrid.setEntry(mScrollDown, glm::ivec2 {1, 1}, false, false, glm::ivec2 {1, 1}); mGrid.setEntry(mScrollDown, glm::ivec2 {1, 1}, false, false, glm::ivec2 {1, 1});
std::vector<std::shared_ptr<ButtonComponent>> buttons; std::vector<std::shared_ptr<ButtonComponent>> buttons;
buttons.push_back(std::make_shared<ButtonComponent>("CLOSE", "CLOSE", [&] { delete this; })); buttons.push_back(
std::make_shared<ButtonComponent>(_("CLOSE"), _("CLOSE"), [&] { delete this; }));
mButtons = MenuComponent::makeButtonGrid(buttons); mButtons = MenuComponent::makeButtonGrid(buttons);
mGrid.setEntry(mButtons, glm::ivec2 {0, 3}, true, false, glm::ivec2 {2, 1}, mGrid.setEntry(mButtons, glm::ivec2 {0, 3}, true, false, glm::ivec2 {2, 1},
GridFlags::BORDER_TOP); GridFlags::BORDER_TOP);
@ -144,7 +146,7 @@ GuiThemeDownloader::GuiThemeDownloader(std::function<void()> updateCallback)
(mRenderer->getScreenHeight() - mSize.y) / 2.0f); (mRenderer->getScreenHeight() - mSize.y) / 2.0f);
mBusyAnim.setSize(mSize); mBusyAnim.setSize(mSize);
mBusyAnim.setText("DOWNLOADING THEMES LIST 100%"); mBusyAnim.setText(_("DOWNLOADING THEMES LIST 100%"));
mBusyAnim.onSizeChanged(); mBusyAnim.onSizeChanged();
mList->setCursorChangedCallback([this](CursorState state) { mList->setCursorChangedCallback([this](CursorState state) {
@ -343,7 +345,7 @@ bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName, bool
LOG(LogInfo) << "GuiThemeDownloader: Repository \"" << repositoryName LOG(LogInfo) << "GuiThemeDownloader: Repository \"" << repositoryName
<< "\" already up to date"; << "\" already up to date";
if (repositoryName != "themes-list") if (repositoryName != "themes-list")
mMessage = "THEME ALREADY UP TO DATE"; mMessage = _("THEME ALREADY UP TO DATE");
git_annotated_commit_free(annotated); git_annotated_commit_free(annotated);
git_object_free(object); git_object_free(object);
git_remote_free(gitRemote); git_remote_free(gitRemote);
@ -405,7 +407,7 @@ bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName, bool
} }
if (repositoryName != "themes-list") { if (repositoryName != "themes-list") {
mMessage = "THEME HAS BEEN UPDATED"; mMessage = _("THEME HAS BEEN UPDATED");
mHasThemeUpdates = true; mHasThemeUpdates = true;
} }
@ -580,7 +582,7 @@ bool GuiThemeDownloader::renameDirectory(const std::string& path, const std::str
if (renameStatus) { if (renameStatus) {
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), "COULDN'T RENAME DIRECTORY \"" + path + "\", PERMISSION PROBLEMS?", getHelpStyle(), "COULDN'T RENAME DIRECTORY \"" + path + "\", PERMISSION PROBLEMS?",
"OK", [] { return; }, "", nullptr, "", nullptr, nullptr, true)); _("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true));
return true; return true;
} }
else { else {
@ -601,7 +603,7 @@ void GuiThemeDownloader::parseThemesList()
if (!Utils::FileSystem::exists(themesFile)) { if (!Utils::FileSystem::exists(themesFile)) {
LOG(LogError) << "GuiThemeDownloader: No themes.json file found"; LOG(LogError) << "GuiThemeDownloader: No themes.json file found";
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), "COULDN'T FIND THE THEMES LIST CONFIGURATION FILE", "OK", getHelpStyle(), _("COULDN'T FIND THE THEMES LIST CONFIGURATION FILE"), _("OK"),
[] { return; }, "", nullptr, "", nullptr, nullptr, true)); [] { return; }, "", nullptr, "", nullptr, nullptr, true));
mGrid.removeEntry(mCenterGrid); mGrid.removeEntry(mCenterGrid);
mGrid.setCursorTo(mButtons); mGrid.setCursorTo(mButtons);
@ -616,9 +618,9 @@ void GuiThemeDownloader::parseThemesList()
LOG(LogError) << "GuiThemeDownloader: Couldn't parse the themes.json file"; LOG(LogError) << "GuiThemeDownloader: Couldn't parse the themes.json file";
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), getHelpStyle(),
"COULDN'T PARSE THE THEMES LIST CONFIGURATION FILE, MAYBE THE LOCAL REPOSITORY IS " _("COULDN'T PARSE THE THEMES LIST CONFIGURATION FILE, MAYBE THE LOCAL REPOSITORY IS "
"CORRUPT?", "CORRUPT?"),
"OK", [] { return; }, "", nullptr, "", nullptr, nullptr, true)); _("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true));
mGrid.removeEntry(mCenterGrid); mGrid.removeEntry(mCenterGrid);
mGrid.setCursorTo(mButtons); mGrid.setCursorTo(mButtons);
return; return;
@ -631,9 +633,9 @@ void GuiThemeDownloader::parseThemesList()
"downloading is not recommended"; "downloading is not recommended";
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), getHelpStyle(),
"IT SEEMS AS IF YOU'RE NOT RUNNING THE LATEST ES-DE RELEASE, PLEASE UPGRADE BEFORE " _("IT SEEMS AS IF YOU'RE NOT RUNNING THE LATEST ES-DE RELEASE, PLEASE UPGRADE "
"PROCEEDING AS THESE THEMES MAY NOT BE COMPATIBLE WITH YOUR VERSION", "BEFORE PROCEEDING AS THESE THEMES MAY NOT BE COMPATIBLE WITH YOUR VERSION"),
"OK", [] { return; }, "", nullptr, "", nullptr, nullptr, true)); _("OK"), [] { return; }, "", nullptr, "", nullptr, nullptr, true));
} }
} }
@ -659,8 +661,13 @@ void GuiThemeDownloader::parseThemesList()
if (theme.HasMember("url") && theme["url"].IsString()) if (theme.HasMember("url") && theme["url"].IsString())
themeEntry.url = theme["url"].GetString(); themeEntry.url = theme["url"].GetString();
if (theme.HasMember("author") && theme["author"].IsString()) if (theme.HasMember("author") && theme["author"].IsString()) {
themeEntry.author = theme["author"].GetString(); themeEntry.author = theme["author"].GetString();
if (themeEntry.author.find(" and ") != std::string::npos) {
themeEntry.author = Utils::String::replace(themeEntry.author, " and ",
" " + _("and") + " ");
}
}
if (theme.HasMember("newEntry") && theme["newEntry"].IsBool()) if (theme.HasMember("newEntry") && theme["newEntry"].IsBool())
themeEntry.newEntry = theme["newEntry"].GetBool(); themeEntry.newEntry = theme["newEntry"].GetBool();
@ -771,7 +778,7 @@ void GuiThemeDownloader::populateGUI()
"DIRECTORY \"" + "DIRECTORY \"" +
theme.reponame + theme.manualExtension + "\" WILL BE RENAMED TO \"" + theme.reponame + theme.manualExtension + "\" WILL BE RENAMED TO \"" +
theme.reponame + theme.manualExtension + "_DISABLED\"", theme.reponame + theme.manualExtension + "_DISABLED\"",
"PROCEED", _("PROCEED"),
[this, theme] { [this, theme] {
if (renameDirectory(mThemeDirectory + theme.reponame + if (renameDirectory(mThemeDirectory + theme.reponame +
theme.manualExtension, theme.manualExtension,
@ -783,9 +790,9 @@ void GuiThemeDownloader::populateGUI()
mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this, mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this,
theme.reponame, theme.url); theme.reponame, theme.url);
mStatusType = StatusType::STATUS_DOWNLOADING; mStatusType = StatusType::STATUS_DOWNLOADING;
mStatusText = "DOWNLOADING THEME"; mStatusText = _("DOWNLOADING THEME");
}, },
"CANCEL", [] { return; }, "", nullptr, nullptr, false, true, _("CANCEL"), [] { return; }, "", nullptr, nullptr, false, true,
(mRenderer->getIsVerticalOrientation() ? (mRenderer->getIsVerticalOrientation() ?
0.75f : 0.75f :
0.46f * (1.778f / mRenderer->getScreenAspectRatio())))); 0.46f * (1.778f / mRenderer->getScreenAspectRatio()))));
@ -799,7 +806,7 @@ void GuiThemeDownloader::populateGUI()
"\"" + "\"" +
theme.reponame + theme.manualExtension + "\" WILL BE RENAMED TO \"" + theme.reponame + theme.manualExtension + "\" WILL BE RENAMED TO \"" +
theme.reponame + theme.manualExtension + "_CORRUPT_DISABLED\"", theme.reponame + theme.manualExtension + "_CORRUPT_DISABLED\"",
"PROCEED", _("PROCEED"),
[this, theme] { [this, theme] {
if (renameDirectory(mThemeDirectory + theme.reponame + if (renameDirectory(mThemeDirectory + theme.reponame +
theme.manualExtension, theme.manualExtension,
@ -811,9 +818,9 @@ void GuiThemeDownloader::populateGUI()
mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this, mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this,
theme.reponame, theme.url); theme.reponame, theme.url);
mStatusType = StatusType::STATUS_DOWNLOADING; mStatusType = StatusType::STATUS_DOWNLOADING;
mStatusText = "DOWNLOADING THEME"; mStatusText = _("DOWNLOADING THEME");
}, },
"CANCEL", [] { return; }, "", nullptr, nullptr, false, true, _("CANCEL"), [] { return; }, "", nullptr, nullptr, false, true,
(mRenderer->getIsVerticalOrientation() ? (mRenderer->getIsVerticalOrientation() ?
0.75f : 0.75f :
0.46f * (1.778f / mRenderer->getScreenAspectRatio())))); 0.46f * (1.778f / mRenderer->getScreenAspectRatio()))));
@ -826,7 +833,7 @@ void GuiThemeDownloader::populateGUI()
"IS REQUIRED AND THE OLD THEME DIRECTORY \"" + "IS REQUIRED AND THE OLD THEME DIRECTORY \"" +
theme.reponame + theme.manualExtension + "\" WILL BE RENAMED TO \"" + theme.reponame + theme.manualExtension + "\" WILL BE RENAMED TO \"" +
theme.reponame + theme.manualExtension + "_DISABLED\"", theme.reponame + theme.manualExtension + "_DISABLED\"",
"PROCEED", _("PROCEED"),
[this, theme] { [this, theme] {
if (renameDirectory(mThemeDirectory + theme.reponame + if (renameDirectory(mThemeDirectory + theme.reponame +
theme.manualExtension, theme.manualExtension,
@ -838,9 +845,9 @@ void GuiThemeDownloader::populateGUI()
mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this, mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this,
theme.reponame, theme.url); theme.reponame, theme.url);
mStatusType = StatusType::STATUS_DOWNLOADING; mStatusType = StatusType::STATUS_DOWNLOADING;
mStatusText = "DOWNLOADING THEME"; mStatusText = _("DOWNLOADING THEME");
}, },
"CANCEL", [] { return; }, "", nullptr, nullptr, false, true, _("CANCEL"), [] { return; }, "", nullptr, nullptr, false, true,
(mRenderer->getIsVerticalOrientation() ? (mRenderer->getIsVerticalOrientation() ?
0.75f : 0.75f :
0.46f * (1.778f / mRenderer->getScreenAspectRatio())))); 0.46f * (1.778f / mRenderer->getScreenAspectRatio()))));
@ -851,16 +858,16 @@ void GuiThemeDownloader::populateGUI()
"THEME REPOSITORY \"" + theme.reponame + "THEME REPOSITORY \"" + theme.reponame +
"\" CONTAINS LOCAL CHANGES. PROCEED TO OVERWRITE YOUR CHANGES " "\" CONTAINS LOCAL CHANGES. PROCEED TO OVERWRITE YOUR CHANGES "
"OR CANCEL TO SKIP ALL UPDATES FOR THIS THEME", "OR CANCEL TO SKIP ALL UPDATES FOR THIS THEME",
"PROCEED", _("PROCEED"),
[this, theme] { [this, theme] {
std::promise<bool>().swap(mPromise); std::promise<bool>().swap(mPromise);
mFuture = mPromise.get_future(); mFuture = mPromise.get_future();
mFetchThread = std::thread(&GuiThemeDownloader::fetchRepository, this, mFetchThread = std::thread(&GuiThemeDownloader::fetchRepository, this,
theme.reponame, true); theme.reponame, true);
mStatusType = StatusType::STATUS_UPDATING; mStatusType = StatusType::STATUS_UPDATING;
mStatusText = "UPDATING THEME"; mStatusText = _("UPDATING THEME");
}, },
"CANCEL", [] { return; }, "", nullptr, nullptr, false, true, _("CANCEL"), [] { return; }, "", nullptr, nullptr, false, true,
(mRenderer->getIsVerticalOrientation() ? (mRenderer->getIsVerticalOrientation() ?
0.75f : 0.75f :
0.45f * (1.778f / mRenderer->getScreenAspectRatio())))); 0.45f * (1.778f / mRenderer->getScreenAspectRatio()))));
@ -870,24 +877,24 @@ void GuiThemeDownloader::populateGUI()
mFetchThread = mFetchThread =
std::thread(&GuiThemeDownloader::fetchRepository, this, theme.reponame, false); std::thread(&GuiThemeDownloader::fetchRepository, this, theme.reponame, false);
mStatusType = StatusType::STATUS_UPDATING; mStatusType = StatusType::STATUS_UPDATING;
mStatusText = "UPDATING THEME"; mStatusText = _("UPDATING THEME");
} }
else { else {
mFuture = mPromise.get_future(); mFuture = mPromise.get_future();
mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this, mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this,
theme.reponame, theme.url); theme.reponame, theme.url);
mStatusType = StatusType::STATUS_DOWNLOADING; mStatusType = StatusType::STATUS_DOWNLOADING;
mStatusText = "DOWNLOADING THEME"; mStatusText = _("DOWNLOADING THEME");
} }
mWindow->stopInfoPopup(); mWindow->stopInfoPopup();
}); });
mList->addRow(row); mList->addRow(row);
} }
mVariantsLabel->setText("VARIANTS:"); mVariantsLabel->setText(_("VARIANTS:"));
mColorSchemesLabel->setText("COLOR SCHEMES:"); mColorSchemesLabel->setText(_("COLOR SCHEMES:"));
mAspectRatiosLabel->setText("ASPECT RATIOS:"); mAspectRatiosLabel->setText(_("ASPECT RATIOS:"));
mFontSizesLabel->setText("FONT SIZES:"); mFontSizesLabel->setText(_("FONT SIZES:"));
updateInfoPane(); updateInfoPane();
updateHelpPrompts(); updateHelpPrompts();
@ -934,36 +941,36 @@ void GuiThemeDownloader::updateInfoPane()
} }
if (mThemes[mList->getCursorId()].isCloned) { if (mThemes[mList->getCursorId()].isCloned) {
mDownloadStatus->setText(ViewController::TICKMARK_CHAR + " INSTALLED"); mDownloadStatus->setText(ViewController::TICKMARK_CHAR + " " + _("INSTALLED"));
mDownloadStatus->setColor(mMenuColorGreen); mDownloadStatus->setColor(mMenuColorGreen);
mDownloadStatus->setOpacity(1.0f); mDownloadStatus->setOpacity(1.0f);
} }
else if (mThemes[mList->getCursorId()].invalidRepository || else if (mThemes[mList->getCursorId()].invalidRepository ||
mThemes[mList->getCursorId()].manuallyDownloaded) { mThemes[mList->getCursorId()].manuallyDownloaded) {
mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " MANUAL DOWNLOAD"); mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " " + _("MANUAL DOWNLOAD"));
mDownloadStatus->setColor(mMenuColorRed); mDownloadStatus->setColor(mMenuColorRed);
mDownloadStatus->setOpacity(1.0f); mDownloadStatus->setOpacity(1.0f);
} }
else if (mThemes[mList->getCursorId()].corruptRepository) { else if (mThemes[mList->getCursorId()].corruptRepository) {
mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " CORRUPT"); mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " " + _("CORRUPT"));
mDownloadStatus->setColor(mMenuColorRed); mDownloadStatus->setColor(mMenuColorRed);
mDownloadStatus->setOpacity(1.0f); mDownloadStatus->setOpacity(1.0f);
} }
else if (mThemes[mList->getCursorId()].shallowRepository) { else if (mThemes[mList->getCursorId()].shallowRepository) {
mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " SHALLOW"); mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " " + _("SHALLOW"));
mDownloadStatus->setColor(mMenuColorRed); mDownloadStatus->setColor(mMenuColorRed);
mDownloadStatus->setOpacity(1.0f); mDownloadStatus->setOpacity(1.0f);
} }
else { else {
if (mThemes[mList->getCursorId()].newEntry) if (mThemes[mList->getCursorId()].newEntry)
mDownloadStatus->setText("NOT INSTALLED (NEW)"); mDownloadStatus->setText(_("NOT INSTALLED (NEW)"));
else else
mDownloadStatus->setText("NOT INSTALLED"); mDownloadStatus->setText(_("NOT INSTALLED"));
mDownloadStatus->setColor(mMenuColorPrimary); mDownloadStatus->setColor(mMenuColorPrimary);
mDownloadStatus->setOpacity(0.7f); mDownloadStatus->setOpacity(0.7f);
} }
if (mThemes[mList->getCursorId()].hasLocalChanges) { if (mThemes[mList->getCursorId()].hasLocalChanges) {
mLocalChanges->setText(ViewController::EXCLAMATION_CHAR + " LOCAL CHANGES"); mLocalChanges->setText(ViewController::EXCLAMATION_CHAR + " " + _("LOCAL CHANGES"));
mLocalChanges->setColor(mMenuColorRed); mLocalChanges->setColor(mMenuColorRed);
} }
else { else {
@ -975,9 +982,9 @@ void GuiThemeDownloader::updateInfoPane()
mAspectRatiosCount->setText(std::to_string(mThemes[mList->getCursorId()].aspectRatios.size())); mAspectRatiosCount->setText(std::to_string(mThemes[mList->getCursorId()].aspectRatios.size()));
mFontSizesCount->setText(std::to_string(mThemes[mList->getCursorId()].fontSizes.size())); mFontSizesCount->setText(std::to_string(mThemes[mList->getCursorId()].fontSizes.size()));
if (mThemes[mList->getCursorId()].deprecated) if (mThemes[mList->getCursorId()].deprecated)
mAuthor->setText("THIS THEME ENTRY WILL BE REMOVED IN THE NEAR FUTURE"); mAuthor->setText(_("THIS THEME ENTRY WILL BE REMOVED IN THE NEAR FUTURE"));
else else
mAuthor->setText("CREATED BY " + mAuthor->setText(_("CREATED BY") + " " +
Utils::String::toUpper(mThemes[mList->getCursorId()].author)); Utils::String::toUpper(mThemes[mList->getCursorId()].author));
} }
@ -1046,15 +1053,16 @@ void GuiThemeDownloader::update(int deltaTime)
mFetchThread.join(); mFetchThread.join();
mFetching = false; mFetching = false;
if (mRepositoryError != RepositoryError::NO_REPO_ERROR) { if (mRepositoryError != RepositoryError::NO_REPO_ERROR) {
std::string errorMessage {"ERROR: "}; std::string errorMessage {_("ERROR:")};
if (mThemes.empty()) { if (mThemes.empty()) {
errorMessage.append("COULDN'T DOWNLOAD THEMES LIST, "); errorMessage.append(" ").append(
_("COULDN'T DOWNLOAD THEMES LIST").append(","));
mGrid.removeEntry(mCenterGrid); mGrid.removeEntry(mCenterGrid);
mGrid.setCursorTo(mButtons); mGrid.setCursorTo(mButtons);
} }
errorMessage.append(Utils::String::toUpper(mMessage)); errorMessage.append(" ").append(Utils::String::toUpper(mMessage));
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), errorMessage, "OK", [] { return; }, "", nullptr, "", getHelpStyle(), errorMessage, _("OK"), [] { return; }, "", nullptr, "",
nullptr, nullptr, true)); nullptr, nullptr, true));
mMessage = ""; mMessage = "";
getHelpPrompts(); getHelpPrompts();
@ -1085,7 +1093,7 @@ void GuiThemeDownloader::update(int deltaTime)
if (mReceivedObjectsProgress != 1.0f) { if (mReceivedObjectsProgress != 1.0f) {
progress = static_cast<int>( progress = static_cast<int>(
std::round(glm::mix(0.0f, 100.0f, static_cast<float>(mReceivedObjectsProgress)))); std::round(glm::mix(0.0f, 100.0f, static_cast<float>(mReceivedObjectsProgress))));
if (mStatusText.substr(0, 11) == "DOWNLOADING") if (mStatusText.substr(0, std::string {_("DOWNLOADING")}.length()) == _("DOWNLOADING"))
mBusyAnim.setText(mStatusText + " " + std::to_string(progress) + "%"); mBusyAnim.setText(mStatusText + " " + std::to_string(progress) + "%");
else else
mBusyAnim.setText(mStatusText); mBusyAnim.setText(mStatusText);
@ -1093,7 +1101,7 @@ void GuiThemeDownloader::update(int deltaTime)
else if (mReceivedObjectsProgress != 0.0f) { else if (mReceivedObjectsProgress != 0.0f) {
progress = static_cast<int>( progress = static_cast<int>(
std::round(glm::mix(0.0f, 100.0f, static_cast<float>(mResolveDeltaProgress)))); std::round(glm::mix(0.0f, 100.0f, static_cast<float>(mResolveDeltaProgress))));
if (mStatusText.substr(0, 11) == "DOWNLOADING") if (mStatusText.substr(0, std::string {_("DOWNLOADING")}.length()) == _("DOWNLOADING"))
mBusyAnim.setText(mStatusText + " " + std::to_string(progress) + "%"); mBusyAnim.setText(mStatusText + " " + std::to_string(progress) + "%");
else else
mBusyAnim.setText(mStatusText); mBusyAnim.setText(mStatusText);
@ -1232,12 +1240,11 @@ bool GuiThemeDownloader::input(InputConfig* config, Input input)
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), getHelpStyle(),
#if defined(__ANDROID__) #if defined(__ANDROID__)
"THIS WILL COMPLETELY DELETE THE THEME", _("THIS WILL COMPLETELY DELETE THE THEME"),
#else #else
"THIS WILL COMPLETELY DELETE THE THEME INCLUDING ANY " _("THIS WILL COMPLETELY DELETE THE THEME INCLUDING ANY LOCAL CUSTOMIZATIONS"),
"LOCAL CUSTOMIZATIONS",
#endif #endif
"PROCEED", _("PROCEED"),
[this] { [this] {
#if defined(_WIN64) #if defined(_WIN64)
const std::string themeDirectory { const std::string themeDirectory {
@ -1250,17 +1257,17 @@ bool GuiThemeDownloader::input(InputConfig* config, Input input)
LOG(LogInfo) << "Deleting theme directory \"" << themeDirectory << "\""; LOG(LogInfo) << "Deleting theme directory \"" << themeDirectory << "\"";
if (!Utils::FileSystem::removeDirectory(themeDirectory, true)) { if (!Utils::FileSystem::removeDirectory(themeDirectory, true)) {
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), "COULDN'T DELETE THEME, PERMISSION PROBLEMS?", "OK", getHelpStyle(), _("COULDN'T DELETE THEME, PERMISSION PROBLEMS?"), _("OK"),
[] { return; }, "", nullptr, "", nullptr, nullptr, true)); [] { return; }, "", nullptr, "", nullptr, nullptr, true));
} }
else { else {
mMessage = "THEME WAS DELETED"; mMessage = _("THEME WAS DELETED");
} }
mHasThemeUpdates = true; mHasThemeUpdates = true;
makeInventory(); makeInventory();
updateGUI(); updateGUI();
}, },
"CANCEL", nullptr, "", nullptr, nullptr, false, true, _("CANCEL"), nullptr, "", nullptr, nullptr, false, true,
(mRenderer->getIsVerticalOrientation() ? (mRenderer->getIsVerticalOrientation() ?
0.70f : 0.70f :
0.44f * (1.778f / mRenderer->getScreenAspectRatio())))); 0.44f * (1.778f / mRenderer->getScreenAspectRatio()))));
@ -1276,22 +1283,22 @@ std::vector<HelpPrompt> GuiThemeDownloader::getHelpPrompts()
if (mList->size() > 0) { if (mList->size() > 0) {
prompts = mGrid.getHelpPrompts(); prompts = mGrid.getHelpPrompts();
prompts.push_back(HelpPrompt("b", "close")); prompts.push_back(HelpPrompt("b", _("close")));
if (mGrid.getSelectedComponent() == mCenterGrid) if (mGrid.getSelectedComponent() == mCenterGrid)
prompts.push_back(HelpPrompt("x", "view screenshots")); prompts.push_back(HelpPrompt("x", _("view screenshots")));
if (mThemes[mList->getCursorId()].isCloned) { if (mThemes[mList->getCursorId()].isCloned) {
prompts.push_back(HelpPrompt("a", "fetch updates")); prompts.push_back(HelpPrompt("a", _("fetch updates")));
if (mGrid.getSelectedComponent() == mCenterGrid) if (mGrid.getSelectedComponent() == mCenterGrid)
prompts.push_back(HelpPrompt("y", "delete")); prompts.push_back(HelpPrompt("y", _("delete")));
} }
else { else {
prompts.push_back(HelpPrompt("a", "download")); prompts.push_back(HelpPrompt("a", _("download")));
} }
} }
else { else {
prompts.push_back(HelpPrompt("b", "close")); prompts.push_back(HelpPrompt("b", _("close")));
} }
return prompts; return prompts;
@ -1310,11 +1317,11 @@ bool GuiThemeDownloader::fetchThemesList()
if (errorCode != 0 || checkCorruptRepository(repository)) { if (errorCode != 0 || checkCorruptRepository(repository)) {
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), getHelpStyle(),
"IT SEEMS AS IF THE THEMES LIST REPOSITORY IS CORRUPT, WHICH COULD HAVE BEEN " _("IT SEEMS AS IF THE THEMES LIST REPOSITORY IS CORRUPT, WHICH COULD HAVE BEEN "
"CAUSED BY AN INTERRUPTION OF A PREVIOUS DOWNLOAD OR UPDATE, FOR EXAMPLE IF THE " "CAUSED BY AN INTERRUPTION OF A PREVIOUS DOWNLOAD OR UPDATE, FOR EXAMPLE IF THE "
"ES-DE PROCESS WAS KILLED. A FRESH DOWNLOAD IS REQUIRED AND THE OLD DIRECTORY " "ES-DE PROCESS WAS KILLED. A FRESH DOWNLOAD IS REQUIRED AND THE OLD DIRECTORY "
"\"themes-list\" WILL BE RENAMED TO \"themes-list_CORRUPT_DISABLED\"", "\"themes-list\" WILL BE RENAMED TO \"themes-list_CORRUPT_DISABLED\""),
"PROCEED", _("PROCEED"),
[this, repositoryName, url] { [this, repositoryName, url] {
if (renameDirectory(mThemeDirectory + "themes-list", "_CORRUPT_DISABLED")) { if (renameDirectory(mThemeDirectory + "themes-list", "_CORRUPT_DISABLED")) {
mGrid.removeEntry(mCenterGrid); mGrid.removeEntry(mCenterGrid);
@ -1326,10 +1333,10 @@ bool GuiThemeDownloader::fetchThemesList()
mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this, mFetchThread = std::thread(&GuiThemeDownloader::cloneRepository, this,
repositoryName, url); repositoryName, url);
mStatusType = StatusType::STATUS_DOWNLOADING; mStatusType = StatusType::STATUS_DOWNLOADING;
mStatusText = "DOWNLOADING THEMES LIST"; mStatusText = _("DOWNLOADING THEMES LIST");
return false; return false;
}, },
"CANCEL", _("CANCEL"),
[&] { [&] {
delete this; delete this;
return false; return false;
@ -1346,28 +1353,28 @@ bool GuiThemeDownloader::fetchThemesList()
mFetchThread = mFetchThread =
std::thread(&GuiThemeDownloader::fetchRepository, this, repositoryName, false); std::thread(&GuiThemeDownloader::fetchRepository, this, repositoryName, false);
mStatusType = StatusType::STATUS_UPDATING; mStatusType = StatusType::STATUS_UPDATING;
mStatusText = "UPDATING THEMES LIST"; mStatusText = _("UPDATING THEMES LIST");
} }
git_repository_free(repository); git_repository_free(repository);
} }
else { else {
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
getHelpStyle(), getHelpStyle(),
"IT SEEMS AS IF YOU'RE USING THE THEME DOWNLOADER FOR THE FIRST TIME. " _("IT SEEMS AS IF YOU'RE USING THE THEME DOWNLOADER FOR THE FIRST TIME. "
"AS SUCH THE THEMES LIST REPOSITORY WILL BE DOWNLOADED WHICH WILL TAKE A LITTLE " "AS SUCH THE THEMES LIST REPOSITORY WILL BE DOWNLOADED WHICH WILL TAKE A LITTLE "
"WHILE. SUBSEQUENT RUNS WILL HOWEVER BE MUCH FASTER AS ONLY NEW OR MODIFIED FILES " "WHILE. SUBSEQUENT RUNS WILL HOWEVER BE MUCH FASTER AS ONLY NEW OR MODIFIED FILES "
"WILL BE FETCHED. THE SAME IS TRUE FOR ANY THEMES YOU DOWNLOAD. NOTE THAT YOU CAN'T " "WILL BE FETCHED. THE SAME IS TRUE FOR ANY THEMES YOU DOWNLOAD. NOTE THAT YOU CAN'T "
"ABORT AN ONGOING DOWNLOAD AS THAT COULD LEAD TO DATA CORRUPTION.", "ABORT AN ONGOING DOWNLOAD AS THAT COULD LEAD TO DATA CORRUPTION."),
"PROCEED", _("PROCEED"),
[this, repositoryName, url] { [this, repositoryName, url] {
LOG(LogInfo) << "GuiThemeDownloader: Creating initial themes list repository clone"; LOG(LogInfo) << "GuiThemeDownloader: Creating initial themes list repository clone";
mFetchThread = mFetchThread =
std::thread(&GuiThemeDownloader::cloneRepository, this, repositoryName, url); std::thread(&GuiThemeDownloader::cloneRepository, this, repositoryName, url);
mStatusType = StatusType::STATUS_DOWNLOADING; mStatusType = StatusType::STATUS_DOWNLOADING;
mStatusText = "DOWNLOADING THEMES LIST"; mStatusText = _("DOWNLOADING THEMES LIST");
return false; return false;
}, },
"CANCEL", _("CANCEL"),
[&] { [&] {
delete this; delete this;
return false; return false;