From 5d9e1483e00ddcabf2b13f455f99cb6f175d1f76 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 9 Dec 2024 17:29:38 +0000 Subject: [PATCH] Fix translation of mod types on localization change --- launcher/modManager/modstateitemmodel_moc.cpp | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/launcher/modManager/modstateitemmodel_moc.cpp b/launcher/modManager/modstateitemmodel_moc.cpp index c81eab38c..fa82c8d39 100644 --- a/launcher/modManager/modstateitemmodel_moc.cpp +++ b/launcher/modManager/modstateitemmodel_moc.cpp @@ -32,34 +32,31 @@ QString ModStateItemModel::modIndexToName(const QModelIndex & index) const QString ModStateItemModel::modTypeName(QString modTypeID) const { - static const QMap modTypes = { - {"Translation", tr("Translation")}, - {"Town", tr("Town") }, - {"Test", tr("Test") }, - {"Templates", tr("Templates") }, - {"Spells", tr("Spells") }, - {"Music", tr("Music") }, - {"Maps", tr("Maps") }, - {"Sounds", tr("Sounds") }, - {"Skills", tr("Skills") }, - {"Other", tr("Other") }, - {"Objects", tr("Objects") }, - {"Mechanical", tr("Mechanics") }, - {"Mechanics", tr("Mechanics") }, - {"Themes", tr("Interface") }, - {"Interface", tr("Interface") }, - {"Heroes", tr("Heroes") }, - {"Graphic", tr("Graphical") }, - {"Graphical", tr("Graphical") }, - {"Expansion", tr("Expansion") }, - {"Creatures", tr("Creatures") }, - {"Compatibility", tr("Compatibility") }, - {"Artifacts", tr("Artifacts") }, - {"AI", tr("AI") }, + static const QStringList modTypes = { + QT_TR_NOOP("Translation"), + QT_TR_NOOP("Town"), + QT_TR_NOOP("Test"), + QT_TR_NOOP("Templates"), + QT_TR_NOOP("Spells"), + QT_TR_NOOP("Music"), + QT_TR_NOOP("Maps"), + QT_TR_NOOP("Sounds"), + QT_TR_NOOP("Skills"), + QT_TR_NOOP("Other"), + QT_TR_NOOP("Objects"), + QT_TR_NOOP("Mechanics"), + QT_TR_NOOP("Interface"), + QT_TR_NOOP("Heroes"), + QT_TR_NOOP("Graphical"), + QT_TR_NOOP("Expansion"), + QT_TR_NOOP("Creatures"), + QT_TR_NOOP("Compatibility") , + QT_TR_NOOP("Artifacts"), + QT_TR_NOOP("AI"), }; if (modTypes.contains(modTypeID)) - return modTypes[modTypeID]; + return tr(modTypeID.toStdString().c_str()); return tr("Other"); }