Added localization support to parts of the application

This commit is contained in:
Leon Styhre 2024-07-13 22:14:37 +02:00
parent 7f4f06eedc
commit f088658004
13 changed files with 144 additions and 119 deletions

View file

@ -30,6 +30,7 @@
#include "UIModeController.h" #include "UIModeController.h"
#include "Window.h" #include "Window.h"
#include "utils/FileSystemUtil.h" #include "utils/FileSystemUtil.h"
#include "utils/LocalizationUtil.h"
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "utils/TimeUtil.h" #include "utils/TimeUtil.h"
#include "views/GamelistView.h" #include "views/GamelistView.h"
@ -46,11 +47,11 @@ CollectionSystemsManager::CollectionSystemsManager() noexcept
{ {
// clang-format off // clang-format off
CollectionSystemDecl systemDecls[] { CollectionSystemDecl systemDecls[] {
// Type Name Long name Theme folder isCustom // Type Name Long name Theme folder isCustom
{AUTO_ALL_GAMES, "all", "all games", "auto-allgames", false}, {AUTO_ALL_GAMES, "all", _("ALL GAMES"), "auto-allgames", false},
{AUTO_LAST_PLAYED, "recent", "last played", "auto-lastplayed", false}, {AUTO_LAST_PLAYED, "recent", _("LAST PLAYED"), "auto-lastplayed", false},
{AUTO_FAVORITES, "favorites", "favorites", "auto-favorites", false}, {AUTO_FAVORITES, "favorites", _("FAVORITES"), "auto-favorites", false},
{CUSTOM_COLLECTION, myCollectionsName, "collections", "custom-collections", true } {CUSTOM_COLLECTION, myCollectionsName, _("COLLECTIONS"), "custom-collections", true }
}; };
// clang-format on // clang-format on

View file

@ -12,6 +12,7 @@
#include "Log.h" #include "Log.h"
#include "Settings.h" #include "Settings.h"
#include "UIModeController.h" #include "UIModeController.h"
#include "utils/LocalizationUtil.h"
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "views/ViewController.h" #include "views/ViewController.h"
@ -40,23 +41,29 @@ FileFilterIndex::FileFilterIndex()
// clang-format off // clang-format off
FilterDataDecl filterDecls[] = { FilterDataDecl filterDecls[] = {
//type //allKeys //filteredBy //filteredKeys //primaryKey //hasSecondaryKey //secondaryKey //menuLabel //type //allKeys //filteredBy //filteredKeys //primaryKey //hasSecondaryKey //secondaryKey //menuLabel
{RATINGS_FILTER, &mRatingsIndexAllKeys, &mFilterByRatings, &mRatingsIndexFilteredKeys, "rating", false, "", "RATING"}, {RATINGS_FILTER, &mRatingsIndexAllKeys, &mFilterByRatings, &mRatingsIndexFilteredKeys, "rating", false, "", _("RATING")},
{DEVELOPER_FILTER, &mDeveloperIndexAllKeys, &mFilterByDeveloper, &mDeveloperIndexFilteredKeys, "developer", false, "", "DEVELOPER"}, {DEVELOPER_FILTER, &mDeveloperIndexAllKeys, &mFilterByDeveloper, &mDeveloperIndexFilteredKeys, "developer", false, "", _("DEVELOPER")},
{PUBLISHER_FILTER, &mPublisherIndexAllKeys, &mFilterByPublisher, &mPublisherIndexFilteredKeys, "publisher", false, "", "PUBLISHER"}, {PUBLISHER_FILTER, &mPublisherIndexAllKeys, &mFilterByPublisher, &mPublisherIndexFilteredKeys, "publisher", false, "", _("PUBLISHER")},
{GENRE_FILTER, &mGenreIndexAllKeys, &mFilterByGenre, &mGenreIndexFilteredKeys, "genre", true, "genre", "GENRE"}, {GENRE_FILTER, &mGenreIndexAllKeys, &mFilterByGenre, &mGenreIndexFilteredKeys, "genre", true, "genre", _("GENRE")},
{PLAYER_FILTER, &mPlayersIndexAllKeys, &mFilterByPlayers, &mPlayersIndexFilteredKeys, "players", false, "", "PLAYERS"}, {PLAYER_FILTER, &mPlayersIndexAllKeys, &mFilterByPlayers, &mPlayersIndexFilteredKeys, "players", false, "", _("PLAYERS")},
{FAVORITES_FILTER, &mFavoritesIndexAllKeys, &mFilterByFavorites, &mFavoritesIndexFilteredKeys, "favorite", false, "", "FAVORITE"}, {FAVORITES_FILTER, &mFavoritesIndexAllKeys, &mFilterByFavorites, &mFavoritesIndexFilteredKeys, "favorite", false, "", _("FAVORITE")},
{COMPLETED_FILTER, &mCompletedIndexAllKeys, &mFilterByCompleted, &mCompletedIndexFilteredKeys, "completed", false, "", "COMPLETED"}, {COMPLETED_FILTER, &mCompletedIndexAllKeys, &mFilterByCompleted, &mCompletedIndexFilteredKeys, "completed", false, "", _("COMPLETED")},
{KIDGAME_FILTER, &mKidGameIndexAllKeys, &mFilterByKidGame, &mKidGameIndexFilteredKeys, "kidgame", false, "", "KIDGAME"}, {KIDGAME_FILTER, &mKidGameIndexAllKeys, &mFilterByKidGame, &mKidGameIndexFilteredKeys, "kidgame", false, "", _("KIDGAME")},
{HIDDEN_FILTER, &mHiddenIndexAllKeys, &mFilterByHidden, &mHiddenIndexFilteredKeys, "hidden", false, "", "HIDDEN"}, {HIDDEN_FILTER, &mHiddenIndexAllKeys, &mFilterByHidden, &mHiddenIndexFilteredKeys, "hidden", false, "", _("HIDDEN")},
{BROKEN_FILTER, &mBrokenIndexAllKeys, &mFilterByBroken, &mBrokenIndexFilteredKeys, "broken", false, "", "BROKEN"}, {BROKEN_FILTER, &mBrokenIndexAllKeys, &mFilterByBroken, &mBrokenIndexFilteredKeys, "broken", false, "", _("BROKEN")},
{CONTROLLER_FILTER, &mControllerIndexAllKeys, &mFilterByController, &mControllerIndexFilteredKeys, "controller", false, "", "CONTROLLER"}, {CONTROLLER_FILTER, &mControllerIndexAllKeys, &mFilterByController, &mControllerIndexFilteredKeys, "controller", false, "", _("CONTROLLER")},
{ALTEMULATOR_FILTER, &mAltemulatorIndexAllKeys, &mFilterByAltemulator, &mAltemulatorIndexFilteredKeys, "altemulator", false, "", "ALTERNATIVE EMULATOR"} {ALTEMULATOR_FILTER, &mAltemulatorIndexAllKeys, &mFilterByAltemulator, &mAltemulatorIndexFilteredKeys, "altemulator", false, "", _("ALTERNATIVE EMULATOR")}
}; };
// clang-format on // clang-format on
filterDataDecl = std::vector<FilterDataDecl>( filterDataDecl = std::vector<FilterDataDecl>(
filterDecls, filterDecls + sizeof(filterDecls) / sizeof(filterDecls[0])); filterDecls, filterDecls + sizeof(filterDecls) / sizeof(filterDecls[0]));
#if defined(GETTEXT_DUMMY_ENTRIES)
// This is just to get gettext msgid entries added to the PO message catalog files.
_("FALSE");
_("TRUE");
#endif
} }
FileFilterIndex::~FileFilterIndex() FileFilterIndex::~FileFilterIndex()
@ -148,10 +155,10 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
ratingNumber = 0; ratingNumber = 0;
if (ratingNumber == 5) if (ratingNumber == 5)
key = "5 STARS"; key = "5";
else else
key = std::to_string(ratingNumber) + " - " + key = std::to_string(ratingNumber) + " - " +
std::to_string(ratingNumber) + ".5 STARS"; std::to_string(ratingNumber) + ".5";
} }
catch (int e) { catch (int e) {
LOG(LogError) << "Error parsing Rating (invalid value, exception nr.): " LOG(LogError) << "Error parsing Rating (invalid value, exception nr.): "
@ -239,10 +246,10 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
if ((type == GENRE_FILTER || type == PLAYER_FILTER || type == DEVELOPER_FILTER || if ((type == GENRE_FILTER || type == PLAYER_FILTER || type == DEVELOPER_FILTER ||
type == PUBLISHER_FILTER) && type == PUBLISHER_FILTER) &&
Utils::String::toUpper(key) == UNKNOWN_LABEL) Utils::String::toUpper(key) == UNKNOWN_LABEL)
key = ViewController::CROSSEDCIRCLE_CHAR + " UNKNOWN"; key = ViewController::CROSSEDCIRCLE_CHAR + " " + _("UNKNOWN");
else if ((type == CONTROLLER_FILTER || type == ALTEMULATOR_FILTER) && key.empty()) else if ((type == CONTROLLER_FILTER || type == ALTEMULATOR_FILTER) && key.empty())
key = ViewController::CROSSEDCIRCLE_CHAR + " NONE SELECTED"; key = ViewController::CROSSEDCIRCLE_CHAR + " " + _("NONE SELECTED");
else if (key.empty() || (type == RATINGS_FILTER && key == "0 STARS")) else if (key.empty() || (type == RATINGS_FILTER && key == "0"))
key = UNKNOWN_LABEL; key = UNKNOWN_LABEL;
return key; return key;

View file

@ -22,6 +22,7 @@
#include "UIModeController.h" #include "UIModeController.h"
#include "resources/ResourceManager.h" #include "resources/ResourceManager.h"
#include "utils/FileSystemUtil.h" #include "utils/FileSystemUtil.h"
#include "utils/LocalizationUtil.h"
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "views/GamelistView.h" #include "views/GamelistView.h"
#include "views/ViewController.h" #include "views/ViewController.h"
@ -260,7 +261,8 @@ SystemData::SystemData(const std::string& name,
} }
// This placeholder can be used later in the gamelist view. // This placeholder can be used later in the gamelist view.
mPlaceholder = new FileData(PLACEHOLDER, "<No Entries Found>", getSystemEnvData(), this); mPlaceholder =
new FileData(PLACEHOLDER, "<" + _("No Entries Found") + ">", getSystemEnvData(), this);
setIsGameSystemStatus(); setIsGameSystemStatus();
loadTheme(ThemeTriggers::TriggerType::NONE); loadTheme(ThemeTriggers::TriggerType::NONE);

View file

@ -65,7 +65,7 @@ GuiAlternativeEmulators::GuiAlternativeEmulators()
bool invalidEntry {false}; bool invalidEntry {false};
if (label.empty()) { if (label.empty()) {
label = ViewController::EXCLAMATION_CHAR + " INVALID ENTRY"; label = ViewController::EXCLAMATION_CHAR + " " + _("INVALID ENTRY");
invalidEntry = true; invalidEntry = true;
} }

View file

@ -16,6 +16,7 @@
#include "guis/GuiSettings.h" #include "guis/GuiSettings.h"
#include "guis/GuiTextEditKeyboardPopup.h" #include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h" #include "guis/GuiTextEditPopup.h"
#include "utils/LocalizationUtil.h"
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "views/ViewController.h" #include "views/ViewController.h"
@ -46,7 +47,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
// Automatic collections. // Automatic collections.
mCollectionSystemsAuto = std::make_shared<OptionListComponent<std::string>>( mCollectionSystemsAuto = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "SELECT COLLECTIONS", true); getHelpStyle(), _("SELECT COLLECTIONS"), true);
std::map<std::string, CollectionSystemData, StringComparator> autoSystems { std::map<std::string, CollectionSystemData, StringComparator> autoSystems {
CollectionSystemsManager::getInstance()->getAutoCollectionSystems()}; CollectionSystemsManager::getInstance()->getAutoCollectionSystems()};
// Add automatic systems. // Add automatic systems.
@ -55,7 +56,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
it != autoSystems.cend(); ++it) it != autoSystems.cend(); ++it)
mCollectionSystemsAuto->add(it->second.decl.fullName, it->second.decl.name, mCollectionSystemsAuto->add(it->second.decl.fullName, it->second.decl.name,
it->second.isEnabled); it->second.isEnabled);
addWithLabel("AUTOMATIC GAME COLLECTIONS", mCollectionSystemsAuto); addWithLabel(_("AUTOMATIC GAME COLLECTIONS"), mCollectionSystemsAuto);
addSaveFunc([this, autoSystems] { addSaveFunc([this, autoSystems] {
std::string autoSystemsSelected {Utils::String::vectorToDelimitedString( std::string autoSystemsSelected {Utils::String::vectorToDelimitedString(
mCollectionSystemsAuto->getSelectedObjects(), ",", true)}; mCollectionSystemsAuto->getSelectedObjects(), ",", true)};
@ -96,7 +97,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
// Custom collections. // Custom collections.
mCollectionSystemsCustom = std::make_shared<OptionListComponent<std::string>>( mCollectionSystemsCustom = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "SELECT COLLECTIONS", true); getHelpStyle(), _("SELECT COLLECTIONS"), true);
std::map<std::string, CollectionSystemData, StringComparator> customSystems { std::map<std::string, CollectionSystemData, StringComparator> customSystems {
CollectionSystemsManager::getInstance()->getCustomCollectionSystems()}; CollectionSystemsManager::getInstance()->getCustomCollectionSystems()};
// Add custom systems. // Add custom systems.
@ -106,7 +107,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
mCollectionSystemsCustom->add(it->second.decl.fullName, it->second.decl.name, mCollectionSystemsCustom->add(it->second.decl.fullName, it->second.decl.name,
it->second.isEnabled); it->second.isEnabled);
addWithLabel("CUSTOM GAME COLLECTIONS", mCollectionSystemsCustom); addWithLabel(_("CUSTOM GAME COLLECTIONS"), mCollectionSystemsCustom);
addSaveFunc([this, customSystems] { addSaveFunc([this, customSystems] {
if (!mDeletedCustomCollection) { if (!mDeletedCustomCollection) {
std::string customSystemsSelected {Utils::String::vectorToDelimitedString( std::string customSystemsSelected {Utils::String::vectorToDelimitedString(
@ -166,7 +167,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
if (unusedFolders.size() > 0) { if (unusedFolders.size() > 0) {
ComponentListRow row; ComponentListRow row;
auto themeCollection = auto themeCollection =
std::make_shared<TextComponent>("CREATE NEW CUSTOM COLLECTION FROM THEME", std::make_shared<TextComponent>(_("CREATE NEW CUSTOM COLLECTION FROM THEME"),
Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary); Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary);
auto bracketThemeCollection = std::make_shared<ImageComponent>(); auto bracketThemeCollection = std::make_shared<ImageComponent>();
bracketThemeCollection->setResize( bracketThemeCollection->setResize(
@ -176,10 +177,10 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
row.addElement(themeCollection, true); row.addElement(themeCollection, true);
row.addElement(bracketThemeCollection, false); row.addElement(bracketThemeCollection, false);
row.makeAcceptInputHandler([this, unusedFolders] { row.makeAcceptInputHandler([this, unusedFolders] {
auto ss = new GuiSettings("SELECT THEME FOLDER"); auto ss = new GuiSettings(_("SELECT THEME FOLDER"));
std::shared_ptr<OptionListComponent<std::string>> folderThemes { std::shared_ptr<OptionListComponent<std::string>> folderThemes {
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), std::make_shared<OptionListComponent<std::string>>(getHelpStyle(),
"SELECT THEME FOLDER", true)}; _("SELECT THEME FOLDER"), true)};
// Add custom systems. // Add custom systems.
for (auto it = unusedFolders.cbegin(); it != unusedFolders.cend(); ++it) { for (auto it = unusedFolders.cbegin(); it != unusedFolders.cend(); ++it) {
ComponentListRow row; ComponentListRow row;
@ -201,7 +202,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
// Create new custom collection. // Create new custom collection.
ComponentListRow row; ComponentListRow row;
auto newCollection = std::make_shared<TextComponent>( auto newCollection = std::make_shared<TextComponent>(
"CREATE NEW CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary); _("CREATE NEW CUSTOM COLLECTION"), Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary);
auto bracketNewCollection = std::make_shared<ImageComponent>(); auto bracketNewCollection = std::make_shared<ImageComponent>();
bracketNewCollection->setResize( bracketNewCollection->setResize(
glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()}); glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
@ -224,15 +225,15 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
const float verticalPosition { const float verticalPosition {
mRenderer->getIsVerticalOrientation() ? getMenu().getPosition().y : 0.0f}; mRenderer->getIsVerticalOrientation() ? getMenu().getPosition().y : 0.0f};
mWindow->pushGui(new GuiTextEditKeyboardPopup( mWindow->pushGui(new GuiTextEditKeyboardPopup(
getHelpStyle(), verticalPosition, "New Collection Name", "", createCollectionCall, getHelpStyle(), verticalPosition, _("NEW COLLECTION NAME"), "",
false, "CREATE", "CREATE COLLECTION?")); createCollectionCall, false, _("CREATE"), _("CREATE COLLECTION?")));
}); });
} }
else { else {
row.makeAcceptInputHandler([this, createCollectionCall] { row.makeAcceptInputHandler([this, createCollectionCall] {
mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), "New Collection Name", "", mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), _("NEW COLLECTION NAME"), "",
createCollectionCall, false, "CREATE", createCollectionCall, false, _("CREATE"),
"CREATE COLLECTION?")); _("CREATE COLLECTION?")));
}); });
} }
addRow(row); addRow(row);
@ -240,7 +241,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
// Delete custom collection. // Delete custom collection.
row.elements.clear(); row.elements.clear();
auto deleteCollection = std::make_shared<TextComponent>( auto deleteCollection = std::make_shared<TextComponent>(
"DELETE CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary); _("DELETE CUSTOM COLLECTION"), Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary);
auto bracketDeleteCollection = std::make_shared<ImageComponent>(); auto bracketDeleteCollection = std::make_shared<ImageComponent>();
bracketDeleteCollection->setResize( bracketDeleteCollection->setResize(
glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()}); glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
@ -249,7 +250,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
row.addElement(deleteCollection, true); row.addElement(deleteCollection, true);
row.addElement(bracketDeleteCollection, false); row.addElement(bracketDeleteCollection, false);
row.makeAcceptInputHandler([this, customSystems] { row.makeAcceptInputHandler([this, customSystems] {
auto ss = new GuiSettings("COLLECTION TO DELETE"); auto ss = new GuiSettings(_("COLLECTION TO DELETE"));
std::shared_ptr<OptionListComponent<std::string>> customCollections { std::shared_ptr<OptionListComponent<std::string>> customCollections {
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), "", true)}; std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), "", true)};
for (std::map<std::string, CollectionSystemData, StringComparator>::const_iterator it = for (std::map<std::string, CollectionSystemData, StringComparator>::const_iterator it =
@ -317,17 +318,18 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
// Custom collections grouping. // Custom collections grouping.
auto collectionCustomGrouping = std::make_shared<OptionListComponent<std::string>>( auto collectionCustomGrouping = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "GROUP CUSTOM COLLECTIONS", false); getHelpStyle(), _("GROUP CUSTOM COLLECTIONS"), false);
const std::string& selectedCustomGrouping { const std::string& selectedCustomGrouping {
Settings::getInstance()->getString("CollectionCustomGrouping")}; Settings::getInstance()->getString("CollectionCustomGrouping")};
collectionCustomGrouping->add("IF UNTHEMED", "unthemed", selectedCustomGrouping == "unthemed"); collectionCustomGrouping->add(_("IF UNTHEMED"), "unthemed",
collectionCustomGrouping->add("ALWAYS", "always", selectedCustomGrouping == "always"); selectedCustomGrouping == "unthemed");
collectionCustomGrouping->add("NEVER", "never", selectedCustomGrouping == "never"); collectionCustomGrouping->add(_("ALWAYS"), "always", selectedCustomGrouping == "always");
collectionCustomGrouping->add(_("NEVER"), "never", selectedCustomGrouping == "never");
// If there are no objects returned, then there must be a manually modified entry in the // If there are no objects returned, then there must be a manually modified entry in the
// configuration file. Simply set custom collections grouping to "unthemed" in this case. // configuration file. Simply set custom collections grouping to "unthemed" in this case.
if (collectionCustomGrouping->getSelectedObjects().size() == 0) if (collectionCustomGrouping->getSelectedObjects().size() == 0)
collectionCustomGrouping->selectEntry(0); collectionCustomGrouping->selectEntry(0);
addWithLabel("GROUP CUSTOM COLLECTIONS", collectionCustomGrouping); addWithLabel(_("GROUP CUSTOM COLLECTIONS"), collectionCustomGrouping);
addSaveFunc([this, collectionCustomGrouping] { addSaveFunc([this, collectionCustomGrouping] {
if (collectionCustomGrouping->getSelected() != if (collectionCustomGrouping->getSelected() !=
Settings::getInstance()->getString("CollectionCustomGrouping")) { Settings::getInstance()->getString("CollectionCustomGrouping")) {
@ -348,7 +350,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
// Sort favorites on top for custom collections. // Sort favorites on top for custom collections.
auto fav_first_custom = std::make_shared<SwitchComponent>(); auto fav_first_custom = std::make_shared<SwitchComponent>();
fav_first_custom->setState(Settings::getInstance()->getBool("FavFirstCustom")); fav_first_custom->setState(Settings::getInstance()->getBool("FavFirstCustom"));
addWithLabel("SORT FAVORITES ON TOP FOR CUSTOM COLLECTIONS", fav_first_custom); addWithLabel(_("SORT FAVORITES ON TOP FOR CUSTOM COLLECTIONS"), fav_first_custom);
addSaveFunc([this, fav_first_custom] { addSaveFunc([this, fav_first_custom] {
if (fav_first_custom->getState() != Settings::getInstance()->getBool("FavFirstCustom")) { if (fav_first_custom->getState() != Settings::getInstance()->getBool("FavFirstCustom")) {
Settings::getInstance()->setBool("FavFirstCustom", fav_first_custom->getState()); Settings::getInstance()->setBool("FavFirstCustom", fav_first_custom->getState());
@ -363,7 +365,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
// Display star markings for custom collections. // Display star markings for custom collections.
auto fav_star_custom = std::make_shared<SwitchComponent>(); auto fav_star_custom = std::make_shared<SwitchComponent>();
fav_star_custom->setState(Settings::getInstance()->getBool("FavStarCustom")); fav_star_custom->setState(Settings::getInstance()->getBool("FavStarCustom"));
addWithLabel("DISPLAY STAR MARKINGS FOR CUSTOM COLLECTIONS", fav_star_custom); addWithLabel(_("DISPLAY STAR MARKINGS FOR CUSTOM COLLECTIONS"), fav_star_custom);
addSaveFunc([this, fav_star_custom] { addSaveFunc([this, fav_star_custom] {
if (fav_star_custom->getState() != Settings::getInstance()->getBool("FavStarCustom")) { if (fav_star_custom->getState() != Settings::getInstance()->getBool("FavStarCustom")) {
Settings::getInstance()->setBool("FavStarCustom", fav_star_custom->getState()); Settings::getInstance()->setBool("FavStarCustom", fav_star_custom->getState());

View file

@ -21,7 +21,7 @@
GuiGamelistFilter::GuiGamelistFilter(SystemData* system, GuiGamelistFilter::GuiGamelistFilter(SystemData* system,
std::function<void(bool)> filterChangedCallback) std::function<void(bool)> filterChangedCallback)
: mMenu {"FILTER GAMELIST"} : mMenu {_("FILTER GAMELIST")}
, mSystem {system} , mSystem {system}
, mFiltersChangedCallback {filterChangedCallback} , mFiltersChangedCallback {filterChangedCallback}
, mFiltersChanged {false} , mFiltersChanged {false}
@ -40,8 +40,8 @@ void GuiGamelistFilter::initializeMenu()
// Show filtered menu. // Show filtered menu.
row.elements.clear(); row.elements.clear();
row.addElement(std::make_shared<TextComponent>("RESET ALL FILTERS", Font::get(FONT_SIZE_MEDIUM), row.addElement(std::make_shared<TextComponent>(_("RESET ALL FILTERS"),
mMenuColorPrimary), Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary),
true); true);
row.makeAcceptInputHandler(std::bind(&GuiGamelistFilter::resetAllFilters, this)); row.makeAcceptInputHandler(std::bind(&GuiGamelistFilter::resetAllFilters, this));
mMenu.addRow(row); mMenu.addRow(row);
@ -49,7 +49,7 @@ void GuiGamelistFilter::initializeMenu()
addFiltersToMenu(); addFiltersToMenu();
mMenu.addButton("BACK", "back", std::bind(&GuiGamelistFilter::applyFilters, this)); mMenu.addButton(_("BACK"), _("back"), std::bind(&GuiGamelistFilter::applyFilters, this));
mMenu.setPosition((Renderer::getScreenWidth() - mMenu.getSize().x) / 2.0f, mMenu.setPosition((Renderer::getScreenWidth() - mMenu.getSize().x) / 2.0f,
Renderer::getScreenHeight() * 0.13f); Renderer::getScreenHeight() * 0.13f);
@ -88,7 +88,7 @@ void GuiGamelistFilter::addFiltersToMenu()
ComponentListRow row; ComponentListRow row;
auto lbl = std::make_shared<TextComponent>( auto lbl = std::make_shared<TextComponent>(
Utils::String::toUpper(ViewController::KEYBOARD_CHAR + " GAME NAME"), Utils::String::toUpper(ViewController::KEYBOARD_CHAR + " " + _("GAME NAME")),
Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary); Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary);
mTextFilterField = std::make_shared<TextComponent>("", Font::get(FONT_SIZE_MEDIUM), mTextFilterField = std::make_shared<TextComponent>("", Font::get(FONT_SIZE_MEDIUM),
@ -123,15 +123,15 @@ void GuiGamelistFilter::addFiltersToMenu()
const float verticalPosition { const float verticalPosition {
Renderer::getIsVerticalOrientation() ? mMenu.getPosition().y : 0.0f}; Renderer::getIsVerticalOrientation() ? mMenu.getPosition().y : 0.0f};
mWindow->pushGui(new GuiTextEditKeyboardPopup( mWindow->pushGui(new GuiTextEditKeyboardPopup(
getHelpStyle(), verticalPosition, "GAME NAME", mTextFilterField->getValue(), getHelpStyle(), verticalPosition, _("GAME NAME"), mTextFilterField->getValue(),
updateVal, false, "OK", "APPLY CHANGES?")); updateVal, false, _("OK"), _("APPLY CHANGES?")));
}); });
} }
else { else {
row.makeAcceptInputHandler([this, updateVal] { row.makeAcceptInputHandler([this, updateVal] {
mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), "GAME NAME", mWindow->pushGui(new GuiTextEditPopup(getHelpStyle(), _("GAME NAME"),
mTextFilterField->getValue(), updateVal, false, mTextFilterField->getValue(), updateVal, false,
"OK", "APPLY CHANGES?")); _("OK"), _("APPLY CHANGES?")));
}); });
} }
@ -181,7 +181,7 @@ void GuiGamelistFilter::addFiltersToMenu()
if (allKeys->size() == 1 || allKeys->empty()) { if (allKeys->size() == 1 || allKeys->empty()) {
optionList->setEnabled(false); optionList->setEnabled(false);
optionList->setOpacity(DISABLED_OPACITY); optionList->setOpacity(DISABLED_OPACITY);
optionList->setOverrideMultiText("NOTHING TO FILTER"); optionList->setOverrideMultiText(_("NOTHING TO FILTER"));
} }
if (type == CONTROLLER_FILTER) { if (type == CONTROLLER_FILTER) {
@ -195,9 +195,17 @@ void GuiGamelistFilter::addFiltersToMenu()
} }
} }
else { else {
for (auto it : *allKeys) if (type == FAVORITES_FILTER || type == COMPLETED_FILTER || type == KIDGAME_FILTER ||
optionList->add(it.first, it.first, type == HIDDEN_FILTER || type == BROKEN_FILTER) {
mFilterIndex->isKeyBeingFilteredBy(it.first, type)); for (auto it : *allKeys)
optionList->add(_(it.first.c_str()), it.first,
mFilterIndex->isKeyBeingFilteredBy(it.first, type));
}
else {
for (auto it : *allKeys)
optionList->add(it.first, it.first,
mFilterIndex->isKeyBeingFilteredBy(it.first, type));
}
} }
if (allKeys->size() == 0) if (allKeys->size() == 0)

View file

@ -239,7 +239,7 @@ GuiGamelistOptions::GuiGamelistOptions(SystemData* system)
if (file->getType() == FOLDER && file->metadata.get("folderlink") != "") { if (file->getType() == FOLDER && file->metadata.get("folderlink") != "") {
row.elements.clear(); row.elements.clear();
row.addElement(std::make_shared<TextComponent>("ENTER FOLDER (OVERRIDE FOLDER LINK)", row.addElement(std::make_shared<TextComponent>(_("ENTER FOLDER (OVERRIDE FOLDER LINK)"),
Font::get(FONT_SIZE_MEDIUM), Font::get(FONT_SIZE_MEDIUM),
mMenuColorPrimary), mMenuColorPrimary),
true); true);

View file

@ -12,23 +12,24 @@
#include "Settings.h" #include "Settings.h"
#include "components/OptionListComponent.h" #include "components/OptionListComponent.h"
#include "components/SwitchComponent.h" #include "components/SwitchComponent.h"
#include "utils/LocalizationUtil.h"
GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title) GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
: GuiSettings {title} : GuiSettings {title}
{ {
// Help prompts. // Help prompts.
auto mediaViewerHelpPrompts = auto mediaViewerHelpPrompts = std::make_shared<OptionListComponent<std::string>>(
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), "HELP PROMPTS", false); getHelpStyle(), _("HELP PROMPTS"), false);
std::string selectedHelpPrompts {Settings::getInstance()->getString("MediaViewerHelpPrompts")}; std::string selectedHelpPrompts {Settings::getInstance()->getString("MediaViewerHelpPrompts")};
mediaViewerHelpPrompts->add("TOP", "top", selectedHelpPrompts == "top"); mediaViewerHelpPrompts->add(_("TOP"), "top", selectedHelpPrompts == "top");
mediaViewerHelpPrompts->add("BOTTOM", "bottom", selectedHelpPrompts == "bottom"); mediaViewerHelpPrompts->add(_("BOTTOM"), "bottom", selectedHelpPrompts == "bottom");
mediaViewerHelpPrompts->add("DISABLED", "disabled", selectedHelpPrompts == "disabled"); mediaViewerHelpPrompts->add(_("DISABLED"), "disabled", selectedHelpPrompts == "disabled");
// If there are no objects returned, then there must be a manually modified entry in the // If there are no objects returned, then there must be a manually modified entry in the
// configuration file. Simply set the help prompts to "top" in this case. // configuration file. Simply set the help prompts to "top" in this case.
if (mediaViewerHelpPrompts->getSelectedObjects().size() == 0) if (mediaViewerHelpPrompts->getSelectedObjects().size() == 0)
mediaViewerHelpPrompts->selectEntry(0); mediaViewerHelpPrompts->selectEntry(0);
addWithLabel("HELP PROMPTS", mediaViewerHelpPrompts); addWithLabel(_("HELP PROMPTS"), mediaViewerHelpPrompts);
addSaveFunc([mediaViewerHelpPrompts, this] { addSaveFunc([mediaViewerHelpPrompts, this] {
if (mediaViewerHelpPrompts->getSelected() != if (mediaViewerHelpPrompts->getSelected() !=
Settings::getInstance()->getString("MediaViewerHelpPrompts")) { Settings::getInstance()->getString("MediaViewerHelpPrompts")) {
@ -41,7 +42,7 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
// Display media types. // Display media types.
auto mediaViewerShowTypes = std::make_shared<SwitchComponent>(); auto mediaViewerShowTypes = std::make_shared<SwitchComponent>();
mediaViewerShowTypes->setState(Settings::getInstance()->getBool("MediaViewerShowTypes")); mediaViewerShowTypes->setState(Settings::getInstance()->getBool("MediaViewerShowTypes"));
addWithLabel("DISPLAY MEDIA TYPES", mediaViewerShowTypes); addWithLabel(_("DISPLAY MEDIA TYPES"), mediaViewerShowTypes);
addSaveFunc([mediaViewerShowTypes, this] { addSaveFunc([mediaViewerShowTypes, this] {
if (mediaViewerShowTypes->getState() != if (mediaViewerShowTypes->getState() !=
Settings::getInstance()->getBool("MediaViewerShowTypes")) { Settings::getInstance()->getBool("MediaViewerShowTypes")) {
@ -54,7 +55,7 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
// Keep videos running when viewing images. // Keep videos running when viewing images.
auto keepVideoRunning = std::make_shared<SwitchComponent>(); auto keepVideoRunning = std::make_shared<SwitchComponent>();
keepVideoRunning->setState(Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")); keepVideoRunning->setState(Settings::getInstance()->getBool("MediaViewerKeepVideoRunning"));
addWithLabel("KEEP VIDEOS RUNNING WHEN VIEWING IMAGES", keepVideoRunning); addWithLabel(_("KEEP VIDEOS RUNNING WHEN VIEWING IMAGES"), keepVideoRunning);
addSaveFunc([keepVideoRunning, this] { addSaveFunc([keepVideoRunning, this] {
if (keepVideoRunning->getState() != if (keepVideoRunning->getState() !=
Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")) { Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")) {
@ -67,7 +68,7 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
// Stretch videos to screen resolution. // Stretch videos to screen resolution.
auto stretchVideos = std::make_shared<SwitchComponent>(); auto stretchVideos = std::make_shared<SwitchComponent>();
stretchVideos->setState(Settings::getInstance()->getBool("MediaViewerStretchVideos")); stretchVideos->setState(Settings::getInstance()->getBool("MediaViewerStretchVideos"));
addWithLabel("STRETCH VIDEOS TO SCREEN RESOLUTION", stretchVideos); addWithLabel(_("STRETCH VIDEOS TO SCREEN RESOLUTION"), stretchVideos);
addSaveFunc([stretchVideos, this] { addSaveFunc([stretchVideos, this] {
if (stretchVideos->getState() != if (stretchVideos->getState() !=
Settings::getInstance()->getBool("MediaViewerStretchVideos")) { Settings::getInstance()->getBool("MediaViewerStretchVideos")) {
@ -79,7 +80,7 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
// Render scanlines for videos using a shader. // Render scanlines for videos using a shader.
auto videoScanlines = std::make_shared<SwitchComponent>(); auto videoScanlines = std::make_shared<SwitchComponent>();
videoScanlines->setState(Settings::getInstance()->getBool("MediaViewerVideoScanlines")); videoScanlines->setState(Settings::getInstance()->getBool("MediaViewerVideoScanlines"));
addWithLabel("RENDER SCANLINES FOR VIDEOS", videoScanlines); addWithLabel(_("RENDER SCANLINES FOR VIDEOS"), videoScanlines);
addSaveFunc([videoScanlines, this] { addSaveFunc([videoScanlines, this] {
if (videoScanlines->getState() != if (videoScanlines->getState() !=
Settings::getInstance()->getBool("MediaViewerVideoScanlines")) { Settings::getInstance()->getBool("MediaViewerVideoScanlines")) {
@ -92,7 +93,7 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
// Render blur for videos using a shader. // Render blur for videos using a shader.
auto videoBlur = std::make_shared<SwitchComponent>(); auto videoBlur = std::make_shared<SwitchComponent>();
videoBlur->setState(Settings::getInstance()->getBool("MediaViewerVideoBlur")); videoBlur->setState(Settings::getInstance()->getBool("MediaViewerVideoBlur"));
addWithLabel("RENDER BLUR FOR VIDEOS", videoBlur); addWithLabel(_("RENDER BLUR FOR VIDEOS"), videoBlur);
addSaveFunc([videoBlur, this] { addSaveFunc([videoBlur, this] {
if (videoBlur->getState() != Settings::getInstance()->getBool("MediaViewerVideoBlur")) { if (videoBlur->getState() != Settings::getInstance()->getBool("MediaViewerVideoBlur")) {
Settings::getInstance()->setBool("MediaViewerVideoBlur", videoBlur->getState()); Settings::getInstance()->setBool("MediaViewerVideoBlur", videoBlur->getState());
@ -104,7 +105,7 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
auto screenshotScanlines = std::make_shared<SwitchComponent>(); auto screenshotScanlines = std::make_shared<SwitchComponent>();
screenshotScanlines->setState( screenshotScanlines->setState(
Settings::getInstance()->getBool("MediaViewerScreenshotScanlines")); Settings::getInstance()->getBool("MediaViewerScreenshotScanlines"));
addWithLabel("RENDER SCANLINES FOR SCREENSHOTS AND TITLES", screenshotScanlines); addWithLabel(_("RENDER SCANLINES FOR SCREENSHOTS AND TITLES"), screenshotScanlines);
addSaveFunc([screenshotScanlines, this] { addSaveFunc([screenshotScanlines, this] {
if (screenshotScanlines->getState() != if (screenshotScanlines->getState() !=
Settings::getInstance()->getBool("MediaViewerScreenshotScanlines")) { Settings::getInstance()->getBool("MediaViewerScreenshotScanlines")) {

View file

@ -17,6 +17,7 @@
#include "guis/GuiMsgBox.h" #include "guis/GuiMsgBox.h"
#include "guis/GuiTextEditKeyboardPopup.h" #include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h" #include "guis/GuiTextEditPopup.h"
#include "utils/LocalizationUtil.h"
GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title) GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
: GuiSettings {title} : GuiSettings {title}
@ -25,7 +26,7 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
auto screensaverTimer = std::make_shared<SliderComponent>(0.0f, 30.0f, 1.0f, "m"); auto screensaverTimer = std::make_shared<SliderComponent>(0.0f, 30.0f, 1.0f, "m");
screensaverTimer->setValue( screensaverTimer->setValue(
static_cast<float>(Settings::getInstance()->getInt("ScreensaverTimer") / (1000 * 60))); static_cast<float>(Settings::getInstance()->getInt("ScreensaverTimer") / (1000 * 60)));
addWithLabel("START SCREENSAVER AFTER (MINUTES)", screensaverTimer); addWithLabel(_("START SCREENSAVER AFTER (MINUTES)"), screensaverTimer);
addSaveFunc([screensaverTimer, this] { addSaveFunc([screensaverTimer, this] {
if (static_cast<int>(std::round(screensaverTimer->getValue()) * (1000 * 60)) != if (static_cast<int>(std::round(screensaverTimer->getValue()) * (1000 * 60)) !=
Settings::getInstance()->getInt("ScreensaverTimer")) { Settings::getInstance()->getInt("ScreensaverTimer")) {
@ -38,17 +39,17 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
// Screensaver type. // Screensaver type.
auto screensaverType = std::make_shared<OptionListComponent<std::string>>( auto screensaverType = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "SCREENSAVER TYPE", false); getHelpStyle(), _("SCREENSAVER TYPE"), false);
std::string selectedScreensaver {Settings::getInstance()->getString("ScreensaverType")}; std::string selectedScreensaver {Settings::getInstance()->getString("ScreensaverType")};
screensaverType->add("DIM", "dim", selectedScreensaver == "dim"); screensaverType->add(_("DIM"), "dim", selectedScreensaver == "dim");
screensaverType->add("BLACK", "black", selectedScreensaver == "black"); screensaverType->add(_("BLACK"), "black", selectedScreensaver == "black");
screensaverType->add("SLIDESHOW", "slideshow", selectedScreensaver == "slideshow"); screensaverType->add(_("SLIDESHOW"), "slideshow", selectedScreensaver == "slideshow");
screensaverType->add("VIDEO", "video", selectedScreensaver == "video"); screensaverType->add(_("VIDEO"), "video", selectedScreensaver == "video");
// If there are no objects returned, then there must be a manually modified entry in the // If there are no objects returned, then there must be a manually modified entry in the
// configuration file. Simply set the screensaver type to "dim" in this case. // configuration file. Simply set the screensaver type to "dim" in this case.
if (screensaverType->getSelectedObjects().size() == 0) if (screensaverType->getSelectedObjects().size() == 0)
screensaverType->selectEntry(0); screensaverType->selectEntry(0);
addWithLabel("SCREENSAVER TYPE", screensaverType); addWithLabel(_("SCREENSAVER TYPE"), screensaverType);
addSaveFunc([screensaverType, this] { addSaveFunc([screensaverType, this] {
if (screensaverType->getSelected() != if (screensaverType->getSelected() !=
Settings::getInstance()->getString("ScreensaverType")) { Settings::getInstance()->getString("ScreensaverType")) {
@ -60,7 +61,7 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
// Whether to enable screensaver controls. // Whether to enable screensaver controls.
auto screensaverControls = std::make_shared<SwitchComponent>(); auto screensaverControls = std::make_shared<SwitchComponent>();
screensaverControls->setState(Settings::getInstance()->getBool("ScreensaverControls")); screensaverControls->setState(Settings::getInstance()->getBool("ScreensaverControls"));
addWithLabel("ENABLE SCREENSAVER CONTROLS", screensaverControls); addWithLabel(_("ENABLE SCREENSAVER CONTROLS"), screensaverControls);
addSaveFunc([screensaverControls, this] { addSaveFunc([screensaverControls, this] {
if (screensaverControls->getState() != if (screensaverControls->getState() !=
Settings::getInstance()->getBool("ScreensaverControls")) { Settings::getInstance()->getBool("ScreensaverControls")) {
@ -73,7 +74,7 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
// Show filtered menu. // Show filtered menu.
ComponentListRow row; ComponentListRow row;
row.elements.clear(); row.elements.clear();
row.addElement(std::make_shared<TextComponent>("SLIDESHOW SCREENSAVER SETTINGS", row.addElement(std::make_shared<TextComponent>(_("SLIDESHOW SCREENSAVER SETTINGS"),
Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary), Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary),
true); true);
row.addElement(getMenu().makeArrow(), false); row.addElement(getMenu().makeArrow(), false);
@ -82,7 +83,7 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
addRow(row); addRow(row);
row.elements.clear(); row.elements.clear();
row.addElement(std::make_shared<TextComponent>("VIDEO SCREENSAVER SETTINGS", row.addElement(std::make_shared<TextComponent>(_("VIDEO SCREENSAVER SETTINGS"),
Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary), Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary),
true); true);
row.addElement(getMenu().makeArrow(), false); row.addElement(getMenu().makeArrow(), false);
@ -95,13 +96,13 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
void GuiScreensaverOptions::openSlideshowScreensaverOptions() void GuiScreensaverOptions::openSlideshowScreensaverOptions()
{ {
auto s = new GuiSettings("SLIDESHOW SCREENSAVER"); auto s = new GuiSettings(_("SLIDESHOW SCREENSAVER"));
// Timer for swapping images (in seconds). // Timer for swapping images (in seconds).
auto screensaverSwapImageTimeout = std::make_shared<SliderComponent>(2.0f, 120.0f, 2.0f, "s"); auto screensaverSwapImageTimeout = std::make_shared<SliderComponent>(2.0f, 120.0f, 2.0f, "s");
screensaverSwapImageTimeout->setValue(static_cast<float>( screensaverSwapImageTimeout->setValue(static_cast<float>(
Settings::getInstance()->getInt("ScreensaverSwapImageTimeout") / (1000))); Settings::getInstance()->getInt("ScreensaverSwapImageTimeout") / (1000)));
s->addWithLabel("SWAP IMAGES AFTER (SECONDS)", screensaverSwapImageTimeout); s->addWithLabel(_("SWAP IMAGES AFTER (SECONDS)"), screensaverSwapImageTimeout);
s->addSaveFunc([screensaverSwapImageTimeout, s] { s->addSaveFunc([screensaverSwapImageTimeout, s] {
if (screensaverSwapImageTimeout->getValue() != if (screensaverSwapImageTimeout->getValue() !=
static_cast<float>(Settings::getInstance()->getInt("ScreensaverSwapImageTimeout") / static_cast<float>(Settings::getInstance()->getInt("ScreensaverSwapImageTimeout") /
@ -117,7 +118,7 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
auto screensaverSlideshowOnlyFavorites = std::make_shared<SwitchComponent>(); auto screensaverSlideshowOnlyFavorites = std::make_shared<SwitchComponent>();
screensaverSlideshowOnlyFavorites->setState( screensaverSlideshowOnlyFavorites->setState(
Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites")); Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites"));
s->addWithLabel("ONLY INCLUDE FAVORITE GAMES", screensaverSlideshowOnlyFavorites); s->addWithLabel(_("ONLY INCLUDE FAVORITE GAMES"), screensaverSlideshowOnlyFavorites);
s->addSaveFunc([screensaverSlideshowOnlyFavorites, s] { s->addSaveFunc([screensaverSlideshowOnlyFavorites, s] {
if (screensaverSlideshowOnlyFavorites->getState() != if (screensaverSlideshowOnlyFavorites->getState() !=
Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites")) { Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites")) {
@ -131,7 +132,7 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
auto screensaverStretchImages = std::make_shared<SwitchComponent>(); auto screensaverStretchImages = std::make_shared<SwitchComponent>();
screensaverStretchImages->setState( screensaverStretchImages->setState(
Settings::getInstance()->getBool("ScreensaverStretchImages")); Settings::getInstance()->getBool("ScreensaverStretchImages"));
s->addWithLabel("STRETCH IMAGES TO SCREEN RESOLUTION", screensaverStretchImages); s->addWithLabel(_("STRETCH IMAGES TO SCREEN RESOLUTION"), screensaverStretchImages);
s->addSaveFunc([screensaverStretchImages, s] { s->addSaveFunc([screensaverStretchImages, s] {
if (screensaverStretchImages->getState() != if (screensaverStretchImages->getState() !=
Settings::getInstance()->getBool("ScreensaverStretchImages")) { Settings::getInstance()->getBool("ScreensaverStretchImages")) {
@ -145,7 +146,7 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
auto screensaverSlideshowGameInfo = std::make_shared<SwitchComponent>(); auto screensaverSlideshowGameInfo = std::make_shared<SwitchComponent>();
screensaverSlideshowGameInfo->setState( screensaverSlideshowGameInfo->setState(
Settings::getInstance()->getBool("ScreensaverSlideshowGameInfo")); Settings::getInstance()->getBool("ScreensaverSlideshowGameInfo"));
s->addWithLabel("DISPLAY GAME INFO OVERLAY", screensaverSlideshowGameInfo); s->addWithLabel(_("DISPLAY GAME INFO OVERLAY"), screensaverSlideshowGameInfo);
s->addSaveFunc([screensaverSlideshowGameInfo, s] { s->addSaveFunc([screensaverSlideshowGameInfo, s] {
if (screensaverSlideshowGameInfo->getState() != if (screensaverSlideshowGameInfo->getState() !=
Settings::getInstance()->getBool("ScreensaverSlideshowGameInfo")) { Settings::getInstance()->getBool("ScreensaverSlideshowGameInfo")) {
@ -159,7 +160,7 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
auto screensaverSlideshowScanlines = std::make_shared<SwitchComponent>(); auto screensaverSlideshowScanlines = std::make_shared<SwitchComponent>();
screensaverSlideshowScanlines->setState( screensaverSlideshowScanlines->setState(
Settings::getInstance()->getBool("ScreensaverSlideshowScanlines")); Settings::getInstance()->getBool("ScreensaverSlideshowScanlines"));
s->addWithLabel("RENDER SCANLINES", screensaverSlideshowScanlines); s->addWithLabel(_("RENDER SCANLINES"), screensaverSlideshowScanlines);
s->addSaveFunc([screensaverSlideshowScanlines, s] { s->addSaveFunc([screensaverSlideshowScanlines, s] {
if (screensaverSlideshowScanlines->getState() != if (screensaverSlideshowScanlines->getState() !=
Settings::getInstance()->getBool("ScreensaverSlideshowScanlines")) { Settings::getInstance()->getBool("ScreensaverSlideshowScanlines")) {
@ -173,7 +174,7 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
auto screensaverSlideshowCustomImages = std::make_shared<SwitchComponent>(); auto screensaverSlideshowCustomImages = std::make_shared<SwitchComponent>();
screensaverSlideshowCustomImages->setState( screensaverSlideshowCustomImages->setState(
Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages")); Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages"));
s->addWithLabel("USE CUSTOM IMAGES", screensaverSlideshowCustomImages); s->addWithLabel(_("USE CUSTOM IMAGES"), screensaverSlideshowCustomImages);
s->addSaveFunc([screensaverSlideshowCustomImages, s] { s->addSaveFunc([screensaverSlideshowCustomImages, s] {
if (screensaverSlideshowCustomImages->getState() != if (screensaverSlideshowCustomImages->getState() !=
Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages")) { Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages")) {
@ -187,7 +188,7 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
auto screensaverSlideshowRecurse = std::make_shared<SwitchComponent>(); auto screensaverSlideshowRecurse = std::make_shared<SwitchComponent>();
screensaverSlideshowRecurse->setState( screensaverSlideshowRecurse->setState(
Settings::getInstance()->getBool("ScreensaverSlideshowRecurse")); Settings::getInstance()->getBool("ScreensaverSlideshowRecurse"));
s->addWithLabel("CUSTOM IMAGE DIRECTORY RECURSIVE SEARCH", screensaverSlideshowRecurse); s->addWithLabel(_("CUSTOM IMAGE DIRECTORY RECURSIVE SEARCH"), screensaverSlideshowRecurse);
s->addSaveFunc([screensaverSlideshowRecurse, s] { s->addSaveFunc([screensaverSlideshowRecurse, s] {
if (screensaverSlideshowRecurse->getState() != if (screensaverSlideshowRecurse->getState() !=
Settings::getInstance()->getBool("ScreensaverSlideshowRecurse")) { Settings::getInstance()->getBool("ScreensaverSlideshowRecurse")) {
@ -200,7 +201,7 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
// Custom image directory. // Custom image directory.
ComponentListRow rowCustomImageDir; ComponentListRow rowCustomImageDir;
auto ScreensaverSlideshowCustomDir = std::make_shared<TextComponent>( auto ScreensaverSlideshowCustomDir = std::make_shared<TextComponent>(
"CUSTOM IMAGE DIRECTORY", Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary); _("CUSTOM IMAGE DIRECTORY"), Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary);
auto bracketCustomImageDir = std::make_shared<ImageComponent>(); auto bracketCustomImageDir = std::make_shared<ImageComponent>();
bracketCustomImageDir->setResize( bracketCustomImageDir->setResize(
glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()}); glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
@ -208,8 +209,8 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
bracketCustomImageDir->setColorShift(mMenuColorPrimary); bracketCustomImageDir->setColorShift(mMenuColorPrimary);
rowCustomImageDir.addElement(ScreensaverSlideshowCustomDir, true); rowCustomImageDir.addElement(ScreensaverSlideshowCustomDir, true);
rowCustomImageDir.addElement(bracketCustomImageDir, false); rowCustomImageDir.addElement(bracketCustomImageDir, false);
const std::string titleCustomImageDir {"CUSTOM IMAGE DIRECTORY"}; const std::string titleCustomImageDir {_("CUSTOM IMAGE DIRECTORY")};
const std::string defaultImageDirStaticText {"Default directory:"}; const std::string defaultImageDirStaticText {_("Default directory:")};
const std::string defaultImageDirText {Utils::FileSystem::getAppDataDirectory() + const std::string defaultImageDirText {Utils::FileSystem::getAppDataDirectory() +
"/screensavers/custom_slideshow"}; "/screensavers/custom_slideshow"};
const std::string initValueMediaDir { const std::string initValueMediaDir {
@ -225,15 +226,15 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
mWindow->pushGui(new GuiTextEditKeyboardPopup( mWindow->pushGui(new GuiTextEditKeyboardPopup(
getHelpStyle(), s->getMenu().getPosition().y, titleCustomImageDir, getHelpStyle(), s->getMenu().getPosition().y, titleCustomImageDir,
Settings::getInstance()->getString("ScreensaverSlideshowCustomDir"), Settings::getInstance()->getString("ScreensaverSlideshowCustomDir"),
updateValMediaDir, false, "SAVE", "SAVE CHANGES?", defaultImageDirStaticText, updateValMediaDir, false, _("SAVE"), _("SAVE CHANGES?"), defaultImageDirStaticText,
defaultImageDirText, "load default directory")); defaultImageDirText, _("load default directory")));
} }
else { else {
mWindow->pushGui(new GuiTextEditPopup( mWindow->pushGui(new GuiTextEditPopup(
getHelpStyle(), titleCustomImageDir, getHelpStyle(), titleCustomImageDir,
Settings::getInstance()->getString("ScreensaverSlideshowCustomDir"), Settings::getInstance()->getString("ScreensaverSlideshowCustomDir"),
updateValMediaDir, false, "SAVE", "SAVE CHANGES?", defaultImageDirStaticText, updateValMediaDir, false, _("SAVE"), _("SAVE CHANGES?"), defaultImageDirStaticText,
defaultImageDirText, "load default directory")); defaultImageDirText, _("load default directory")));
} }
}); });
s->addRow(rowCustomImageDir); s->addRow(rowCustomImageDir);
@ -244,13 +245,13 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
void GuiScreensaverOptions::openVideoScreensaverOptions() void GuiScreensaverOptions::openVideoScreensaverOptions()
{ {
auto s = new GuiSettings("VIDEO SCREENSAVER"); auto s = new GuiSettings(_("VIDEO SCREENSAVER"));
// Timer for swapping videos (in seconds). // Timer for swapping videos (in seconds).
auto screensaverSwapVideoTimeout = std::make_shared<SliderComponent>(0.0f, 120.0f, 2.0f, "s"); auto screensaverSwapVideoTimeout = std::make_shared<SliderComponent>(0.0f, 120.0f, 2.0f, "s");
screensaverSwapVideoTimeout->setValue(static_cast<float>( screensaverSwapVideoTimeout->setValue(static_cast<float>(
Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout") / (1000))); Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout") / (1000)));
s->addWithLabel("SWAP VIDEOS AFTER (SECONDS)", screensaverSwapVideoTimeout); s->addWithLabel(_("SWAP VIDEOS AFTER (SECONDS)"), screensaverSwapVideoTimeout);
s->addSaveFunc([screensaverSwapVideoTimeout, s] { s->addSaveFunc([screensaverSwapVideoTimeout, s] {
if (screensaverSwapVideoTimeout->getValue() != if (screensaverSwapVideoTimeout->getValue() !=
static_cast<float>(Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout") / static_cast<float>(Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout") /
@ -266,7 +267,7 @@ void GuiScreensaverOptions::openVideoScreensaverOptions()
auto screensaverVideoOnlyFavorites = std::make_shared<SwitchComponent>(); auto screensaverVideoOnlyFavorites = std::make_shared<SwitchComponent>();
screensaverVideoOnlyFavorites->setState( screensaverVideoOnlyFavorites->setState(
Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites")); Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites"));
s->addWithLabel("ONLY INCLUDE FAVORITE GAMES", screensaverVideoOnlyFavorites); s->addWithLabel(_("ONLY INCLUDE FAVORITE GAMES"), screensaverVideoOnlyFavorites);
s->addSaveFunc([screensaverVideoOnlyFavorites, s] { s->addSaveFunc([screensaverVideoOnlyFavorites, s] {
if (screensaverVideoOnlyFavorites->getState() != if (screensaverVideoOnlyFavorites->getState() !=
Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites")) { Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites")) {
@ -280,7 +281,7 @@ void GuiScreensaverOptions::openVideoScreensaverOptions()
auto screensaverStretchVideos = std::make_shared<SwitchComponent>(); auto screensaverStretchVideos = std::make_shared<SwitchComponent>();
screensaverStretchVideos->setState( screensaverStretchVideos->setState(
Settings::getInstance()->getBool("ScreensaverStretchVideos")); Settings::getInstance()->getBool("ScreensaverStretchVideos"));
s->addWithLabel("STRETCH VIDEOS TO SCREEN RESOLUTION", screensaverStretchVideos); s->addWithLabel(_("STRETCH VIDEOS TO SCREEN RESOLUTION"), screensaverStretchVideos);
s->addSaveFunc([screensaverStretchVideos, s] { s->addSaveFunc([screensaverStretchVideos, s] {
if (screensaverStretchVideos->getState() != if (screensaverStretchVideos->getState() !=
Settings::getInstance()->getBool("ScreensaverStretchVideos")) { Settings::getInstance()->getBool("ScreensaverStretchVideos")) {
@ -294,7 +295,7 @@ void GuiScreensaverOptions::openVideoScreensaverOptions()
auto screensaverVideoGameInfo = std::make_shared<SwitchComponent>(); auto screensaverVideoGameInfo = std::make_shared<SwitchComponent>();
screensaverVideoGameInfo->setState( screensaverVideoGameInfo->setState(
Settings::getInstance()->getBool("ScreensaverVideoGameInfo")); Settings::getInstance()->getBool("ScreensaverVideoGameInfo"));
s->addWithLabel("DISPLAY GAME INFO OVERLAY", screensaverVideoGameInfo); s->addWithLabel(_("DISPLAY GAME INFO OVERLAY"), screensaverVideoGameInfo);
s->addSaveFunc([screensaverVideoGameInfo, s] { s->addSaveFunc([screensaverVideoGameInfo, s] {
if (screensaverVideoGameInfo->getState() != if (screensaverVideoGameInfo->getState() !=
Settings::getInstance()->getBool("ScreensaverVideoGameInfo")) { Settings::getInstance()->getBool("ScreensaverVideoGameInfo")) {
@ -308,7 +309,7 @@ void GuiScreensaverOptions::openVideoScreensaverOptions()
auto screensaverVideoScanlines = std::make_shared<SwitchComponent>(); auto screensaverVideoScanlines = std::make_shared<SwitchComponent>();
screensaverVideoScanlines->setState( screensaverVideoScanlines->setState(
Settings::getInstance()->getBool("ScreensaverVideoScanlines")); Settings::getInstance()->getBool("ScreensaverVideoScanlines"));
s->addWithLabel("RENDER SCANLINES", screensaverVideoScanlines); s->addWithLabel(_("RENDER SCANLINES"), screensaverVideoScanlines);
s->addSaveFunc([screensaverVideoScanlines, s] { s->addSaveFunc([screensaverVideoScanlines, s] {
if (screensaverVideoScanlines->getState() != if (screensaverVideoScanlines->getState() !=
Settings::getInstance()->getBool("ScreensaverVideoScanlines")) { Settings::getInstance()->getBool("ScreensaverVideoScanlines")) {
@ -321,7 +322,7 @@ void GuiScreensaverOptions::openVideoScreensaverOptions()
// Render blur using a shader. // Render blur using a shader.
auto screensaverVideoBlur = std::make_shared<SwitchComponent>(); auto screensaverVideoBlur = std::make_shared<SwitchComponent>();
screensaverVideoBlur->setState(Settings::getInstance()->getBool("ScreensaverVideoBlur")); screensaverVideoBlur->setState(Settings::getInstance()->getBool("ScreensaverVideoBlur"));
s->addWithLabel("RENDER BLUR", screensaverVideoBlur); s->addWithLabel(_("RENDER BLUR"), screensaverVideoBlur);
s->addSaveFunc([screensaverVideoBlur, s] { s->addSaveFunc([screensaverVideoBlur, s] {
if (screensaverVideoBlur->getState() != if (screensaverVideoBlur->getState() !=
Settings::getInstance()->getBool("ScreensaverVideoBlur")) { Settings::getInstance()->getBool("ScreensaverVideoBlur")) {

View file

@ -215,10 +215,10 @@ std::vector<HelpPrompt> SystemView::getHelpPrompts()
prompts.push_back(HelpPrompt("a", _("select"))); prompts.push_back(HelpPrompt("a", _("select")));
if (Settings::getInstance()->getString("RandomEntryButton") == "gamessystems") if (Settings::getInstance()->getString("RandomEntryButton") == "gamessystems")
prompts.push_back(HelpPrompt("thumbstickclick", "random")); prompts.push_back(HelpPrompt("thumbstickclick", _("random")));
if (Settings::getInstance()->getBool("ScreensaverControls")) if (Settings::getInstance()->getBool("ScreensaverControls"))
prompts.push_back(HelpPrompt("x", "screensaver")); prompts.push_back(HelpPrompt("x", _("screensaver")));
return prompts; return prompts;
} }

View file

@ -366,13 +366,16 @@ void ViewController::invalidAlternativeEmulatorDialog()
{ {
cancelViewTransitions(); cancelViewTransitions();
mWindow->pushGui(new GuiMsgBox(getHelpStyle(), mWindow->pushGui(new GuiMsgBox(getHelpStyle(),
"AT LEAST ONE OF YOUR SYSTEMS HAS AN\n" _("AT LEAST ONE OF YOUR SYSTEMS HAS AN "
"INVALID ALTERNATIVE EMULATOR CONFIGURED\n" "INVALID ALTERNATIVE EMULATOR CONFIGURED "
"WITH NO MATCHING ENTRY IN THE SYSTEMS\n" "WITH NO MATCHING ENTRY IN THE SYSTEMS "
"CONFIGURATION FILE, PLEASE REVIEW YOUR\n" "CONFIGURATION FILE, PLEASE REVIEW YOUR "
"SETUP USING THE 'ALTERNATIVE EMULATORS'\n" "SETUP USING THE 'ALTERNATIVE EMULATORS' "
"INTERFACE IN THE 'OTHER SETTINGS' MENU", "INTERFACE IN THE 'OTHER SETTINGS' MENU"),
"OK", nullptr, "", nullptr, "", nullptr, nullptr, true, true)); _("OK"), nullptr, "", nullptr, "", nullptr, nullptr, true, true,
(mRenderer->getIsVerticalOrientation() ?
0.70f :
0.45f * (1.778f / mRenderer->getScreenAspectRatio()))));
} }
void ViewController::updateAvailableDialog() void ViewController::updateAvailableDialog()
@ -1533,7 +1536,7 @@ std::vector<HelpPrompt> ViewController::getHelpPrompts()
prompts = mCurrentView->getHelpPrompts(); prompts = mCurrentView->getHelpPrompts();
if (!(UIModeController::getInstance()->isUIModeKid() && if (!(UIModeController::getInstance()->isUIModeKid() &&
!Settings::getInstance()->getBool("EnableMenuKidMode"))) !Settings::getInstance()->getBool("EnableMenuKidMode")))
prompts.push_back(HelpPrompt("start", "menu")); prompts.push_back(HelpPrompt("start", _("menu")));
return prompts; return prompts;
} }

View file

@ -114,8 +114,8 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
addChild(&mBackground); addChild(&mBackground);
addChild(&mGrid); addChild(&mGrid);
mTitle = std::make_shared<TextComponent>( mTitle = std::make_shared<TextComponent>(title, Font::get(FONT_SIZE_LARGE), mMenuColorTitle,
Utils::String::toUpper(title), Font::get(FONT_SIZE_LARGE), mMenuColorTitle, ALIGN_CENTER); ALIGN_CENTER);
std::vector<std::vector<std::string>> kbLayout; std::vector<std::vector<std::string>> kbLayout;

View file

@ -45,8 +45,8 @@ GuiTextEditPopup::GuiTextEditPopup(const HelpStyle& helpstyle,
addChild(&mBackground); addChild(&mBackground);
addChild(&mGrid); addChild(&mGrid);
mTitle = std::make_shared<TextComponent>( mTitle = std::make_shared<TextComponent>(title, Font::get(FONT_SIZE_MEDIUM), mMenuColorTitle,
Utils::String::toUpper(title), Font::get(FONT_SIZE_MEDIUM), mMenuColorTitle, ALIGN_CENTER); ALIGN_CENTER);
if (mComplexMode) { if (mComplexMode) {
mInfoString = std::make_shared<TextComponent>(infoString, Font::get(FONT_SIZE_SMALL), mInfoString = std::make_shared<TextComponent>(infoString, Font::get(FONT_SIZE_SMALL),
@ -66,7 +66,7 @@ GuiTextEditPopup::GuiTextEditPopup(const HelpStyle& helpstyle,
})); }));
if (mComplexMode) { if (mComplexMode) {
buttons.push_back( buttons.push_back(
std::make_shared<ButtonComponent>("load", loadBtnHelpText, [this, defaultValue] { std::make_shared<ButtonComponent>(_("LOAD"), loadBtnHelpText, [this, defaultValue] {
mText->setValue(defaultValue); mText->setValue(defaultValue);
mText->setCursor(0); mText->setCursor(0);
mText->setCursor(defaultValue.size()); mText->setCursor(defaultValue.size());