From 9a18a5c81682ee8eee64b7ae402cd6ccf38ea3d5 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 1 Sep 2024 12:27:23 +0200 Subject: [PATCH] Added translations for the name and fullname systemdata properties for the text element --- es-app/src/views/SystemView.cpp | 51 ++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index 2ca215d86..a1027d354 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -797,25 +797,56 @@ void SystemView::populate() if (mGrid != nullptr) mGrid->calculateLayout(); +#if defined(GETTEXT_DUMMY_ENTRIES) + _p("theme", "all"); + _p("theme", "all games"); + _p("theme", "recent"); + _p("theme", "last played"); + _p("theme", "favorites"); + _p("theme", "collections"); +#endif + for (auto& elements : mSystemElements) { for (auto& text : elements.textComponents) { if (text->getThemeSystemdata() != "") { - if (text->getThemeSystemdata() == "name") - text->setValue(elements.name); - else if (text->getThemeSystemdata() == "fullname") - text->setValue(elements.fullName); - else + const bool translate {elements.system->isCollection() && + !elements.system->isCustomCollection()}; + if (text->getThemeSystemdata() == "name") { + if (translate) + text->setValue(_p("theme", elements.name.c_str())); + else + text->setValue(elements.name); + } + else if (text->getThemeSystemdata() == "fullname") { + if (translate) + text->setValue(_p("theme", elements.fullName.c_str())); + else + text->setValue(elements.fullName); + } + else { text->setValue(text->getThemeSystemdata()); + } } } for (auto& containerText : elements.containerTextComponents) { if (containerText->getThemeSystemdata() != "") { - if (containerText->getThemeSystemdata() == "name") - containerText->setValue(elements.name); - else if (containerText->getThemeSystemdata() == "fullname") - containerText->setValue(elements.fullName); - else + const bool translate {elements.system->isCollection() && + !elements.system->isCustomCollection()}; + if (containerText->getThemeSystemdata() == "name") { + if (translate) + containerText->setValue(_p("theme", elements.name.c_str())); + else + containerText->setValue(elements.name); + } + else if (containerText->getThemeSystemdata() == "fullname") { + if (translate) + containerText->setValue(_p("theme", elements.fullName.c_str())); + else + containerText->setValue(elements.fullName); + } + else { containerText->setValue(containerText->getThemeSystemdata()); + } } } }