Added localization support for the theme game counter

This commit is contained in:
Leon Styhre 2024-08-31 13:17:11 +02:00
parent ff091a9d83
commit f845b5f031

View file

@ -829,19 +829,26 @@ void SystemView::updateGameCount(SystemData* system)
const bool recentSystem {sourceSystem->getName() == "recent"}; const bool recentSystem {sourceSystem->getName() == "recent"};
if (sourceSystem->isCollection() && favoriteSystem) { if (sourceSystem->isCollection() && favoriteSystem) {
ss << gameCount.first << " Game" << (gameCount.first == 1 ? " " : "s"); ss << Utils::String::format(_np("theme", "%i game", "%i games", gameCount.first),
gameCount.first);
} }
else if (sourceSystem->isCollection() && recentSystem) { else if (sourceSystem->isCollection() && recentSystem) {
// The "recent" gamelist has probably been trimmed after sorting, so we'll cap it at // The "recent" gamelist has probably been trimmed after sorting, so we'll cap it at
// its maximum limit of 50 games. // its maximum limit of 50 games.
ss << (gameCount.first > 50 ? 50 : gameCount.first) << " Game" const unsigned int count {gameCount.first > 50 ? 50 : gameCount.first};
<< (gameCount.first == 1 ? " " : "s"); ss << Utils::String::format(_np("theme", "%i game", "%i games", count), count);
} }
else { else {
ss << gameCount.first << " Game" << (gameCount.first == 1 ? " " : "s ") << "(" ss << Utils::String::format(_np("theme", "%i game", "%i games", gameCount.first),
<< gameCount.second << " Favorite" << (gameCount.second == 1 ? ")" : "s)"); gameCount.first)
ssGames << gameCount.first << " Game" << (gameCount.first == 1 ? "" : "s"); << " "
ssFavorites << gameCount.second << " Favorite" << (gameCount.second == 1 ? "" : "s"); << Utils::String::format(
_np("theme", "(%i favorite)", "(%i favorites)", gameCount.second),
gameCount.second);
ssGames << Utils::String::format(_np("theme", "%i game", "%i games", gameCount.first),
gameCount.first);
ssFavorites << Utils::String::format(
_np("theme", "%i favorite", "%i favorites", gameCount.second), gameCount.second);
games = true; games = true;
} }