Added theme contextual hinting to the custom collection summary text in CollectionSystemsManager

Also added translation support for a string that was previously missed
This commit is contained in:
Leon Styhre 2024-08-31 13:33:54 +02:00
parent f845b5f031
commit 2446e9d91c

View file

@ -885,7 +885,7 @@ FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* s
switch (gameCount) { switch (gameCount) {
case 1: { case 1: {
desc = Utils::String::format( desc = Utils::String::format(
_("This collection contains 1 game: '%s [%s]'"), _p("theme", "This collection contains 1 game: '%s [%s]'"),
gamesList[0]->metadata.get("name").c_str(), gamesList[0]->metadata.get("name").c_str(),
caseConversion(gamesList[0]->getSourceFileData()->getSystem()->getName()) caseConversion(gamesList[0]->getSourceFileData()->getSystem()->getName())
.c_str()); .c_str());
@ -893,7 +893,7 @@ FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* s
} }
case 2: { case 2: {
desc = Utils::String::format( desc = Utils::String::format(
_("This collection contains 2 games: '%s [%s]' and '%s [%s]'"), _p("theme", "This collection contains 2 games: '%s [%s]' and '%s [%s]'"),
gamesList[0]->metadata.get("name").c_str(), gamesList[0]->metadata.get("name").c_str(),
caseConversion(gamesList[0]->getSourceFileData()->getSystem()->getName()) caseConversion(gamesList[0]->getSourceFileData()->getSystem()->getName())
.c_str(), .c_str(),
@ -904,7 +904,8 @@ FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* s
} }
case 3: { case 3: {
desc = Utils::String::format( desc = Utils::String::format(
_("This collection contains 3 games: '%s [%s]', '%s [%s]' and '%s [%s]'"), _p("theme",
"This collection contains 3 games: '%s [%s]', '%s [%s]' and '%s [%s]'"),
gamesList[0]->metadata.get("name").c_str(), gamesList[0]->metadata.get("name").c_str(),
caseConversion(gamesList[0]->getSourceFileData()->getSystem()->getName()) caseConversion(gamesList[0]->getSourceFileData()->getSystem()->getName())
.c_str(), .c_str(),
@ -918,11 +919,14 @@ FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* s
} }
default: { default: {
desc = Utils::String::format( desc = Utils::String::format(
_n("This collection contains %i games: '%s [%s]', '%s [%s]' and '%s [%s]', " _np("theme",
"among others", "This collection contains %i games: '%s [%s]', '%s [%s]' and '%s "
"This collection contains %i games: '%s [%s]', '%s [%s]' and '%s [%s]', " "[%s]', "
"among others", "among others",
gameCount), "This collection contains %i games: '%s [%s]', '%s [%s]' and '%s "
"[%s]', "
"among others",
gameCount),
gameCount, gamesList[0]->metadata.get("name").c_str(), gameCount, gamesList[0]->metadata.get("name").c_str(),
caseConversion(gamesList[0]->getSourceFileData()->getSystem()->getName()) caseConversion(gamesList[0]->getSourceFileData()->getSystem()->getName())
.c_str(), .c_str(),
@ -939,20 +943,21 @@ FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* s
else { else {
switch (gameCount) { switch (gameCount) {
case 1: { case 1: {
desc = Utils::String::format(_("This collection contains 1 game: '%s'"), desc =
gamesList[0]->metadata.get("name").c_str()); Utils::String::format(_p("theme", "This collection contains 1 game: '%s'"),
gamesList[0]->metadata.get("name").c_str());
break; break;
} }
case 2: { case 2: {
desc = desc = Utils::String::format(
Utils::String::format(_("This collection contains 2 games: '%s' and '%s'"), _p("theme", "This collection contains 2 games: '%s' and '%s'"),
gamesList[0]->metadata.get("name").c_str(), gamesList[0]->metadata.get("name").c_str(),
gamesList[1]->metadata.get("name").c_str()); gamesList[1]->metadata.get("name").c_str());
break; break;
} }
case 3: { case 3: {
desc = Utils::String::format( desc = Utils::String::format(
_("This collection contains 3 games: '%s', '%s' and '%s'"), _p("theme", "This collection contains 3 games: '%s', '%s' and '%s'"),
gamesList[0]->metadata.get("name").c_str(), gamesList[0]->metadata.get("name").c_str(),
gamesList[1]->metadata.get("name").c_str(), gamesList[1]->metadata.get("name").c_str(),
gamesList[2]->metadata.get("name").c_str()); gamesList[2]->metadata.get("name").c_str());
@ -960,9 +965,10 @@ FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* s
} }
default: { default: {
desc = Utils::String::format( desc = Utils::String::format(
_n("This collection contains %i games: '%s', '%s' and '%s', among others", _np("theme",
"This collection contains %i games: '%s', '%s' and '%s', among others", "This collection contains %i games: '%s', '%s' and '%s', among others",
gameCount), "This collection contains %i games: '%s', '%s' and '%s', among others",
gameCount),
gameCount, gamesList[0]->metadata.get("name").c_str(), gameCount, gamesList[0]->metadata.get("name").c_str(),
gamesList[1]->metadata.get("name").c_str(), gamesList[1]->metadata.get("name").c_str(),
gamesList[2]->metadata.get("name").c_str()); gamesList[2]->metadata.get("name").c_str());
@ -973,9 +979,9 @@ FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* s
} }
if (idx->isFiltered()) { if (idx->isFiltered()) {
desc.append("\n\n'") desc.append("\n\n").append(Utils::String::format(
.append(rootFolder->getSystem()->getFullName()) _p("theme", "'%s' is filtered so there may be more games available"),
.append("' is filtered so there may be more games available"); rootFolder->getSystem()->getFullName().c_str()));
} }
rootFolder->metadata.set("desc", desc); rootFolder->metadata.set("desc", desc);