mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-24 04:57:45 +00:00
exdpart: Support localization
This commit is contained in:
parent
1eae14b239
commit
d3dfb9bcc0
2 changed files with 15 additions and 15 deletions
|
@ -5,6 +5,7 @@ add_library(exdpart STATIC)
|
|||
target_sources(exdpart PRIVATE exdpart.cpp)
|
||||
target_link_libraries(exdpart
|
||||
PUBLIC
|
||||
KF6::I18n
|
||||
Physis::Physis
|
||||
Qt6::Core
|
||||
Qt6::Widgets)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "exdpart.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <QFile>
|
||||
#include <QGroupBox>
|
||||
#include <QJsonArray>
|
||||
|
@ -40,8 +41,6 @@ void EXDPart::loadSheet(const QString &name, physis_Buffer buffer, const QString
|
|||
QFile definitionFile(definitionPath);
|
||||
definitionFile.open(QIODevice::ReadOnly);
|
||||
|
||||
qInfo() << definitionPath;
|
||||
|
||||
QJsonArray definitionList;
|
||||
if (definitionFile.isOpen()) {
|
||||
auto document = QJsonDocument::fromJson(definitionFile.readAll());
|
||||
|
@ -97,37 +96,37 @@ void EXDPart::loadSheet(const QString &name, physis_Buffer buffer, const QString
|
|||
QString columnType;
|
||||
switch (columnData.tag) {
|
||||
case physis_ColumnData::Tag::String:
|
||||
columnType = QStringLiteral("String");
|
||||
columnType = i18n("String");
|
||||
break;
|
||||
case physis_ColumnData::Tag::Bool:
|
||||
columnType = QStringLiteral("Bool");
|
||||
columnType = i18n("Bool");
|
||||
break;
|
||||
case physis_ColumnData::Tag::Int8:
|
||||
columnType = QStringLiteral("Int8");
|
||||
columnType = i18n("Int8");
|
||||
break;
|
||||
case physis_ColumnData::Tag::UInt8:
|
||||
columnType = QStringLiteral("UInt8");
|
||||
columnType = i18n("UInt8");
|
||||
break;
|
||||
case physis_ColumnData::Tag::Int16:
|
||||
columnType = QStringLiteral("Int16");
|
||||
columnType = i18n("Int16");
|
||||
break;
|
||||
case physis_ColumnData::Tag::UInt16:
|
||||
columnType = QStringLiteral("UInt16");
|
||||
columnType = i18n("UInt16");
|
||||
break;
|
||||
case physis_ColumnData::Tag::Int32:
|
||||
columnType = QStringLiteral("Int32");
|
||||
columnType = i18n("Int32");
|
||||
break;
|
||||
case physis_ColumnData::Tag::UInt32:
|
||||
columnType = QStringLiteral("UInt32");
|
||||
columnType = i18n("UInt32");
|
||||
break;
|
||||
case physis_ColumnData::Tag::Float32:
|
||||
columnType = QStringLiteral("Float32");
|
||||
columnType = i18n("Float32");
|
||||
break;
|
||||
case physis_ColumnData::Tag::Int64:
|
||||
columnType = QStringLiteral("Int64");
|
||||
columnType = i18n("Int64");
|
||||
break;
|
||||
case physis_ColumnData::Tag::UInt64:
|
||||
columnType = QStringLiteral("UInt64");
|
||||
columnType = i18n("UInt64");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -172,7 +171,7 @@ void EXDPart::loadSheet(const QString &name, physis_Buffer buffer, const QString
|
|||
|
||||
tableWidget->resizeColumnsToContents();
|
||||
|
||||
pageTabWidget->addTab(tableWidget, QStringLiteral("Page %1").arg(i));
|
||||
pageTabWidget->addTab(tableWidget, i18nc("@title:tab", "Page %1").arg(i));
|
||||
}
|
||||
|
||||
// Expand the tabs and hide the tab bar if there's only one page
|
||||
|
@ -201,7 +200,7 @@ std::pair<QString, int> EXDPart::getColumnData(physis_ColumnData &columnData)
|
|||
columnString = QString::fromStdString(columnData.string._0);
|
||||
break;
|
||||
case physis_ColumnData::Tag::Bool:
|
||||
columnString = columnData.bool_._0 ? QStringLiteral("True") : QStringLiteral("False");
|
||||
columnString = columnData.bool_._0 ? i18nc("Value is true", "True") : i18nc("Value is false", "False");
|
||||
break;
|
||||
case physis_ColumnData::Tag::Int8:
|
||||
columnString = QString::number(columnData.int8._0);
|
||||
|
|
Loading…
Add table
Reference in a new issue