Translatable Compatibility Status (#2304)

* qt_gui: Made compatibility status translatable

* Translations: Added English and Spanish translation for compatibility status
This commit is contained in:
pdaloxd 2025-02-01 10:58:05 +01:00 committed by GitHub
parent 84c27eea2a
commit 83671ebf76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 75 additions and 8 deletions

View file

@ -260,3 +260,22 @@ void CompatibilityInfoClass::ExtractCompatibilityInfo(QByteArray response) {
return; return;
} }
const QString CompatibilityInfoClass::GetCompatStatusString(const CompatibilityStatus status) {
switch (status) {
case CompatibilityStatus::Unknown:
return tr("Unknown");
case CompatibilityStatus::Nothing:
return tr("Nothing");
case CompatibilityStatus::Boots:
return tr("Boots");
case CompatibilityStatus::Menus:
return tr("Menus");
case CompatibilityStatus::Ingame:
return tr("Ingame");
case CompatibilityStatus::Playable:
return tr("Playable");
default:
return tr("Unknown");
}
}

View file

@ -69,13 +69,6 @@ public:
{QStringLiteral("os-windows"), OSType::Win32}, {QStringLiteral("os-windows"), OSType::Win32},
}; };
inline static const std::unordered_map<CompatibilityStatus, QString> CompatStatusToString = {
{CompatibilityStatus::Unknown, QStringLiteral("Unknown")},
{CompatibilityStatus::Nothing, QStringLiteral("Nothing")},
{CompatibilityStatus::Boots, QStringLiteral("Boots")},
{CompatibilityStatus::Menus, QStringLiteral("Menus")},
{CompatibilityStatus::Ingame, QStringLiteral("Ingame")},
{CompatibilityStatus::Playable, QStringLiteral("Playable")}};
inline static const std::unordered_map<OSType, QString> OSTypeToString = { inline static const std::unordered_map<OSType, QString> OSTypeToString = {
{OSType::Linux, QStringLiteral("os-linux")}, {OSType::Linux, QStringLiteral("os-linux")},
{OSType::macOS, QStringLiteral("os-macOS")}, {OSType::macOS, QStringLiteral("os-macOS")},
@ -87,6 +80,7 @@ public:
void UpdateCompatibilityDatabase(QWidget* parent = nullptr, bool forced = false); void UpdateCompatibilityDatabase(QWidget* parent = nullptr, bool forced = false);
bool LoadCompatibilityFile(); bool LoadCompatibilityFile();
CompatibilityEntry GetCompatibilityInfo(const std::string& serial); CompatibilityEntry GetCompatibilityInfo(const std::string& serial);
const QString GetCompatStatusString(const CompatibilityStatus status);
void ExtractCompatibilityInfo(QByteArray response); void ExtractCompatibilityInfo(QByteArray response);
static bool WaitForReply(QNetworkReply* reply); static bool WaitForReply(QNetworkReply* reply);
QNetworkReply* FetchPage(int page_num); QNetworkReply* FetchPage(int page_num);

View file

@ -289,7 +289,7 @@ void GameListFrame::SetCompatibilityItem(int row, int column, CompatibilityEntry
QLabel* dotLabel = new QLabel("", widget); QLabel* dotLabel = new QLabel("", widget);
dotLabel->setPixmap(circle_pixmap); dotLabel->setPixmap(circle_pixmap);
QLabel* label = new QLabel(m_compat_info->CompatStatusToString.at(entry.status), widget); QLabel* label = new QLabel(m_compat_info->GetCompatStatusString(entry.status), widget);
label->setStyleSheet("color: white; font-size: 16px; font-weight: bold;"); label->setStyleSheet("color: white; font-size: 16px; font-weight: bold;");

View file

@ -1414,4 +1414,31 @@
<translation>TB</translation> <translation>TB</translation>
</message> </message>
</context> </context>
<context>
<name>CompatibilityInfoClass</name>
<message>
<source>Unknown</source>
<translation>Unknown</translation>
</message>
<message>
<source>Nothing</source>
<translation>Nothing</translation>
</message>
<message>
<source>Boots</source>
<translation>Boots</translation>
</message>
<message>
<source>Menus</source>
<translation>Menus</translation>
</message>
<message>
<source>Ingame</source>
<translation>Ingame</translation>
</message>
<message>
<source>Playable</source>
<translation>Playable</translation>
</message>
</context>
</TS> </TS>

View file

@ -1405,4 +1405,31 @@
<translation>TB</translation> <translation>TB</translation>
</message> </message>
</context> </context>
<context>
<name>CompatibilityInfoClass</name>
<message>
<source>Unknown</source>
<translation>Desconocido</translation>
</message>
<message>
<source>Nothing</source>
<translation>Nada</translation>
</message>
<message>
<source>Boots</source>
<translation>Inicia</translation>
</message>
<message>
<source>Menus</source>
<translation>Menús</translation>
</message>
<message>
<source>Ingame</source>
<translation>En el juego</translation>
</message>
<message>
<source>Playable</source>
<translation>Jugable</translation>
</message>
</context>
</TS> </TS>