added zh_CN translation

This commit is contained in:
SunnySlopes 2023-06-24 17:19:24 +08:00
parent f9fe594388
commit d9f1115a43
22 changed files with 5435 additions and 258 deletions

View File

@ -209,7 +209,9 @@ RESOURCES += \
# ----- translations (pluralization) -----
TRANSLATIONS += \
rc/lang/en_US.ts
rc/lang/en_US.ts \
rc/lang/de_DE.ts \
rc/lang/zh_CN.ts
translations: {
# automatically run lupdate for pluralization default translation

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,5 +2,6 @@
<qresource prefix="/">
<file>lang/en_US.qm</file>
<file>lang/de_DE.qm</file>
<file>lang/zh_CN.qm</file>
</qresource>
</RCC>

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
rc/lang/zh_CN.qm Normal file

Binary file not shown.

4802
rc/lang/zh_CN.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -883,10 +883,10 @@ void ConditionDialog::on_buttonAreaInfo_clicked()
"example a centered square with side 3 will go from -2 to 1 for both "
"the X and Z axes."
"</p><p>"
"Important to note is that some filters have a scaling associtated with "
"Important to note is that some filters have a scaling associated with "
"them. This means that the area is not defined in blocks, but on a grid "
"with the given spacing (such as chunks instead of blocks). A scaling "
"of 1:16, for example, means that the aformentioned centered square of "
"of 1:16, for example, means that the aforementioned centered square of "
"side 3 will range from -32 to 31 in block coordinates. (Chunk 1 has "
"blocks 16 to 31.)"
"</p></body></html>"
@ -1234,9 +1234,9 @@ void ConditionDialog::on_lineBiomeSize_textChanged(const QString &)
double area = ui->lineBiomeSize->text().toInt();
QString s;
if (filterindex == F_BIOME_CENTER_256)
s = QString::asprintf("(~%g sq. chunks)", area * 256);
s = QString::asprintf(tr("(~%g sq. chunks)").toStdString().c_str(), area * 256);
else
s = QString::asprintf("(%g sq. chunks)", area / 16.0);
s = QString::asprintf(tr("(%g sq. chunks)").toStdString().c_str(), area / 16.0);
ui->labelBiomeSize->setText(s);
}

View File

@ -725,7 +725,7 @@ QPushButton:hover {
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Locate boime center</string>
<string>Locate biome center</string>
</property>
<layout class="QGridLayout" name="gridLayout_19">
<item row="3" column="0">

View File

@ -3,6 +3,7 @@
#include <QMutex>
#include <QString>
#include <QApplication>
#include <random>
@ -14,28 +15,28 @@ inline const char* struct2str(int stype)
{
switch (stype)
{
case Desert_Pyramid: return "desert_pyramid";
case Jungle_Temple: return "jungle_temple";
case Swamp_Hut: return "swamp_hut";
case Igloo: return "igloo";
case Village: return "village";
case Ocean_Ruin: return "ocean_ruin";
case Shipwreck: return "shipwreck";
case Monument: return "monument";
case Mansion: return "mansion";
case Outpost: return "outpost";
case Treasure: return "treasure";
case Mineshaft: return "mineshaft";
case Desert_Well: return "desert_well";
case Ruined_Portal: return "ruined_portal";
case Ruined_Portal_N: return "ruined_portal (nether)";
case Geode: return "amethyst_geode";
case Ancient_City: return "ancient_city";
case Trail_Ruin: return "trail_ruins";
case Fortress: return "fortress";
case Bastion: return "bastion";
case End_City: return "end_city";
case End_Gateway: return "end_gateway";
case Desert_Pyramid: return QApplication::translate("StructureDialog", "desert_pyramid").toUtf8().data();
case Jungle_Temple: return QApplication::translate("StructureDialog", "jungle_temple").toUtf8().data();
case Swamp_Hut: return QApplication::translate("StructureDialog", "swamp_hut").toUtf8().data();
case Igloo: return QApplication::translate("StructureDialog", "igloo").toUtf8().data();
case Village: return QApplication::translate("StructureDialog", "village").toUtf8().data();
case Ocean_Ruin: return QApplication::translate("StructureDialog", "ocean_ruin").toUtf8().data();
case Shipwreck: return QApplication::translate("StructureDialog", "shipwreck").toUtf8().data();
case Monument: return QApplication::translate("StructureDialog", "monument").toUtf8().data();
case Mansion: return QApplication::translate("StructureDialog", "mansion").toUtf8().data();
case Outpost: return QApplication::translate("StructureDialog", "outpost").toUtf8().data();
case Treasure: return QApplication::translate("StructureDialog", "treasure").toUtf8().data();
case Mineshaft: return QApplication::translate("StructureDialog", "mineshaft").toUtf8().data();
case Desert_Well: return QApplication::translate("StructureDialog", "desert_well").toUtf8().data();
case Ruined_Portal: return QApplication::translate("StructureDialog", "ruined_portal").toUtf8().data();
case Ruined_Portal_N: return QApplication::translate("StructureDialog", "ruined_portal (nether)").toUtf8().data();
case Geode: return QApplication::translate("StructureDialog", "amethyst_geode").toUtf8().data();
case Ancient_City: return QApplication::translate("StructureDialog", "ancient_city").toUtf8().data();
case Trail_Ruin: return QApplication::translate("StructureDialog", "trail_ruins").toUtf8().data();
case Fortress: return QApplication::translate("StructureDialog", "fortress").toUtf8().data();
case Bastion: return QApplication::translate("StructureDialog", "bastion").toUtf8().data();
case End_City: return QApplication::translate("StructureDialog", "end_city").toUtf8().data();
case End_Gateway: return QApplication::translate("StructureDialog", "end_gateway").toUtf8().data();
}
return "?";
}

View File

@ -696,7 +696,7 @@ void FormSearchControl::searchFinish(bool done)
ui->progressBar->setValue(10000);
ui->progressBar->setFormat(tr("Done", "Progressbar when finished"));
}
ui->labelStatus->setText("Idle");
ui->labelStatus->setText(tr("Idle"));
proghist.clear();
searchLockUi(false);
}

View File

@ -3,6 +3,7 @@
#include "config.h"
#include <QApplication>
const char *getLayerOptionText(int mode, int disp)
{
@ -41,80 +42,80 @@ const char *getLayerOptionText(int mode, int disp)
{
case LOPT_BIOMES:
switch (disp) {
case 0: return "1:1";
case 1: return "1:4";
case 2: return "1:16";
case 3: return "1:64";
case 4: return "1:256";
case 0: return QApplication::translate("LayerDialog", "1:1").toUtf8().data();
case 1: return QApplication::translate("LayerDialog", "1:4").toUtf8().data();
case 2: return QApplication::translate("LayerDialog", "1:16").toUtf8().data();
case 3: return QApplication::translate("LayerDialog", "1:64").toUtf8().data();
case 4: return QApplication::translate("LayerDialog", "1:256").toUtf8().data();
default: return nullptr;
}
case LOPT_NOISE_T_4:
switch (disp) {
case 0: return "All";
case 1: return "+A[0] 1:4096 x0.952381";
case 2: return "+B[0] 1:4023 x0.952381";
case 3: return "+A[1] 1:1024 x0.158730";
case 4: return "+B[1] 1:1005 x0.158730";
case 0: return QApplication::translate("LayerDialog", "All").toUtf8().data();
case 1: return QApplication::translate("LayerDialog", "+A[0] 1:4096 x0.952381").toUtf8().data();
case 2: return QApplication::translate("LayerDialog", "+B[0] 1:4023 x0.952381").toUtf8().data();
case 3: return QApplication::translate("LayerDialog", "+A[1] 1:1024 x0.158730").toUtf8().data();
case 4: return QApplication::translate("LayerDialog", "+B[1] 1:1005 x0.158730").toUtf8().data();
default: return nullptr;
}
case LOPT_NOISE_H_4:
switch (disp) {
case 0: return "All";
case 1: return "+A[0] 1:1024 x0.564374";
case 2: return "+B[0] 1:1005 x0.564374";
case 3: return "+A[1] 1:512 x0.282187";
case 4: return "+B[1] 1:502 x0.282187";
case 0: return QApplication::translate("LayerDialog", "All").toUtf8().data();
case 1: return QApplication::translate("LayerDialog", "+A[0] 1:1024 x0.564374").toUtf8().data();
case 2: return QApplication::translate("LayerDialog", "+B[0] 1:1005 x0.564374").toUtf8().data();
case 3: return QApplication::translate("LayerDialog", "+A[1] 1:512 x0.282187").toUtf8().data();
case 4: return QApplication::translate("LayerDialog", "+B[1] 1:502 x0.282187").toUtf8().data();
default: return nullptr;
}
case LOPT_NOISE_C_4:
switch (disp) {
case 0: return "All";
case 1: return "+A[0] 1:2048 x0.751468";
case 2: return "+B[0] 1:2011 x0.751468";
case 3: return "+A[1] 1:1024 x0.375734";
case 4: return "+B[1] 1:1005 x0.375734";
case 5: return "+A[2] 1:512 x0.375734";
case 6: return "+B[2] 1:502 x0.375734";
case 7: return "+A[3] 1:256 x0.187867";
case 8: return "+B[3] 1:251 x0.187867";
case 9: return "+A[4] 1:128 x0.093933";
case 10: return "+B[4] 1:125 x0.093933";
case 11: return "+A[5] 1:64 x0.023483";
case 12: return "+B[5] 1:62 x0.023483";
case 13: return "+A[6] 1:32 x0.011742";
case 14: return "+B[6] 1:31 x0.011742";
case 0: return QApplication::translate("LayerDialog", "All").toUtf8().data();
case 1: return QApplication::translate("LayerDialog", "+A[0] 1:2048 x0.751468").toUtf8().data();
case 2: return QApplication::translate("LayerDialog", "+B[0] 1:2011 x0.751468").toUtf8().data();
case 3: return QApplication::translate("LayerDialog", "+A[1] 1:1024 x0.375734").toUtf8().data();
case 4: return QApplication::translate("LayerDialog", "+B[1] 1:1005 x0.375734").toUtf8().data();
case 5: return QApplication::translate("LayerDialog", "+A[2] 1:512 x0.375734").toUtf8().data();
case 6: return QApplication::translate("LayerDialog", "+B[2] 1:502 x0.375734").toUtf8().data();
case 7: return QApplication::translate("LayerDialog", "+A[3] 1:256 x0.187867").toUtf8().data();
case 8: return QApplication::translate("LayerDialog", "+B[3] 1:251 x0.187867").toUtf8().data();
case 9: return QApplication::translate("LayerDialog", "+A[4] 1:128 x0.093933").toUtf8().data();
case 10: return QApplication::translate("LayerDialog", "+B[4] 1:125 x0.093933").toUtf8().data();
case 11: return QApplication::translate("LayerDialog", "+A[5] 1:64 x0.023483").toUtf8().data();
case 12: return QApplication::translate("LayerDialog", "+B[5] 1:62 x0.023483").toUtf8().data();
case 13: return QApplication::translate("LayerDialog", "+A[6] 1:32 x0.011742").toUtf8().data();
case 14: return QApplication::translate("LayerDialog", "+B[6] 1:31 x0.011742").toUtf8().data();
default: return nullptr;
}
case LOPT_NOISE_E_4:
switch (disp) {
case 0: return "All";
case 1: return "+A[0] 1:2048 x0.716846";
case 2: return "+B[0] 1:2011 x0.716846";
case 3: return "+A[1] 1:1024 x0.358423";
case 4: return "+B[1] 1:1005 x0.358423";
case 5: return "+A[2] 1:256 x0.089606";
case 6: return "+B[2] 1:251 x0.089606";
case 7: return "+A[3] 1:128 x0.044803";
case 8: return "+B[3] 1:125 x0.044803";
case 0: return QApplication::translate("LayerDialog", "All").toUtf8().data();
case 1: return QApplication::translate("LayerDialog", "+A[0] 1:2048 x0.716846").toUtf8().data();
case 2: return QApplication::translate("LayerDialog", "+B[0] 1:2011 x0.716846").toUtf8().data();
case 3: return QApplication::translate("LayerDialog", "+A[1] 1:1024 x0.358423").toUtf8().data();
case 4: return QApplication::translate("LayerDialog", "+B[1] 1:1005 x0.358423").toUtf8().data();
case 5: return QApplication::translate("LayerDialog", "+A[2] 1:256 x0.089606").toUtf8().data();
case 6: return QApplication::translate("LayerDialog", "+B[2] 1:251 x0.089606").toUtf8().data();
case 7: return QApplication::translate("LayerDialog", "+A[3] 1:128 x0.044803").toUtf8().data();
case 8: return QApplication::translate("LayerDialog", "+B[3] 1:125 x0.044803").toUtf8().data();
default: return nullptr;
}
case LOPT_NOISE_W_4:
switch (disp) {
case 0: return "All";
case 1: return "+A[0] 1:512 x0.634921";
case 2: return "+B[0] 1:502 x0.634921";
case 3: return "+A[1] 1:256 x0.634921";
case 4: return "+B[1] 1:251 x0.634921";
case 5: return "+A[2] 1:128 x0.158730";
case 6: return "+B[2] 1:125 x0.158730";
case 0: return QApplication::translate("LayerDialog", "All").toUtf8().data();
case 1: return QApplication::translate("LayerDialog", "+A[0] 1:512 x0.634921").toUtf8().data();
case 2: return QApplication::translate("LayerDialog", "+B[0] 1:502 x0.634921").toUtf8().data();
case 3: return QApplication::translate("LayerDialog", "+A[1] 1:256 x0.634921").toUtf8().data();
case 4: return QApplication::translate("LayerDialog", "+B[1] 1:251 x0.634921").toUtf8().data();
case 5: return QApplication::translate("LayerDialog", "+A[2] 1:128 x0.158730").toUtf8().data();
case 6: return QApplication::translate("LayerDialog", "+B[2] 1:125 x0.158730").toUtf8().data();
default: return nullptr;
}
case LOPT_HEIGHT_4:
switch (disp) {
case 0: return "Grayscale";
case 1: return "Shaded biome map";
case 2: return "Contours on biomes";
case 3: return "Shaded with contours";
case 0: return QApplication::translate("LayerDialog", "Grayscale").toUtf8().data();
case 1: return QApplication::translate("LayerDialog", "Shaded biome map").toUtf8().data();
case 2: return QApplication::translate("LayerDialog", "Contours on biomes").toUtf8().data();
case 3: return QApplication::translate("LayerDialog", "Shaded with contours").toUtf8().data();
default: return nullptr;
}
default:

View File

@ -122,7 +122,7 @@ MainWindow::MainWindow(QWidget *parent)
addAction(act);
}
QAction *toorigin = new QAction(QIcon(":/icons/origin.png"), "Goto origin", this);
QAction *toorigin = new QAction(QIcon(":/icons/origin.png"), tr("Goto origin"), this);
connect(toorigin, &QAction::triggered, [=](){ this->mapGoto(0,0,16); });
ui->toolBar->addAction(toorigin);
ui->toolBar->addSeparator();
@ -243,7 +243,7 @@ MainWindow::MainWindow(QWidget *parent)
"</p></body></html>"
));
ui->collapseControl->init("Matching seeds", formControl, false);
ui->collapseControl->init(tr("Matching seeds"), formControl, false);
connect(formControl, &FormSearchControl::selectedSeedChanged, this, &MainWindow::onSelectedSeedChanged);
connect(formControl, &FormSearchControl::searchStatusChanged, this, &MainWindow::onSearchStatusChanged);
ui->collapseControl->setInfo(

View File

@ -246,7 +246,7 @@ void PresetDialog::on_buttonSave_clicked()
Preset preset;
preset.title = QInputDialog::getText(
this, tr("New Preset"),
tr("Preset titel:"), QLineEdit::Normal,
tr("Preset title:"), QLineEdit::Normal,
QString("Filter#%1").arg(n), &ok);
if (!ok || preset.title.isEmpty())
return;

View File

@ -222,7 +222,7 @@ lua_State *loadScript(QString path, QString *err)
}
if (lua_getglobal(L, "check") != LUA_TFUNCTION)
{
if (err) *err = QApplication::tr("function check() was not defined");
if (err) *err = QApplication::translate("Filter", "function check() was not defined");
break;
}
lua_pop(L, 1);

View File

@ -53,7 +53,7 @@ QString Condition::summary() const
if (scripts.contains(hash))
txts += ": " + QFileInfo(scripts.value(hash)).baseName();
else
txts += ": " + QApplication::tr("[script missing]");
txts += ": " + QApplication::translate("Filter", "[script missing]");
}
}
@ -218,12 +218,12 @@ QString SearchThreadEnv::init(int mc, bool large, ConditionTree *condtree)
if (c.type != F_LUA)
continue;
if (!scripts.contains(c.hash))
return QApplication::tr("missing script for condition %1").arg(c.save);
return QApplication::translate("Filter", "missing script for condition %1").arg(c.save);
QString err;
lua_State *L = loadScript(scripts.value(c.hash), &err);
if (!L)
{
QString s = QApplication::tr("Condition %1:\n").arg(c.save);
QString s = QApplication::translate("Filter", "Condition %1:\n").arg(c.save);
s += err;
return s;
}

View File

@ -251,7 +251,7 @@ static const struct FilterList
QT_TRANSLATE_NOOP("Filter",
"The lower 48-bits provide potential for four swamp huts in "
"spawning range, such that all of them are within 128 blocks "
"of a single AFK location, including a vertical tollerance "
"of a single AFK location, including a vertical tolerance "
"for a fall damage chute.")
};

View File

@ -85,7 +85,7 @@ bool SearchMaster::set(
if (c.relative && refbuf[c.relative] == 0)
{
QMessageBox::warning(parent, "Warning",
QMessageBox::warning(parent, tr("Warning"),
tr("Condition with ID %1 has a broken reference position:\n"
"condition missing or out of order.").arg(cid));
return false;

View File

@ -821,7 +821,7 @@ void TabBiomes::on_radioFullSample_toggled(bool checked)
void TabBiomes::on_lineBiomeSize_textChanged(const QString &text)
{
double area = text.toInt();
ui->labelBiomeSize->setText(QString::asprintf("(%g sq. chunks)", area / 16));
ui->labelBiomeSize->setText(QString::asprintf(tr("(%g sq. chunks)").toStdString().c_str(), area / 16));
}
void TabBiomes::on_treeLocate_itemClicked(QTreeWidgetItem *item, int column)

View File

@ -10,6 +10,7 @@
#include <QJsonParseError>
#include <QMessageBox>
#include <QDesktopServices>
#include <QApplication>
void replyFinished(QNetworkReply *reply, bool quiet)
@ -18,23 +19,23 @@ void replyFinished(QNetworkReply *reply, bool quiet)
{
if (!quiet)
{
QString msg = QObject::tr("Failed to check for updates:\n");
QString msg = QApplication::translate("UpdaterDialog", "Failed to check for updates:\n");
switch (reply->error())
{
case QNetworkReply::ConnectionRefusedError:
msg += QObject::tr("Connection refused.");
msg += QApplication::translate("UpdaterDialog", "Connection refused.");
break;
case QNetworkReply::HostNotFoundError:
msg += QObject::tr("Host not found.");
msg += QApplication::translate("UpdaterDialog", "Host not found.");
break;
case QNetworkReply::TimeoutError:
msg += QObject::tr("Connection timed out.");
msg += QApplication::translate("UpdaterDialog", "Connection timed out.");
break;
default:
msg += QObject::tr("Network error (%1).").arg(reply->error());
msg += QApplication::translate("UpdaterDialog", "Network error (%1).").arg(reply->error());
break;
}
QMessageBox::warning(NULL, QObject::tr("Connection Error"), msg, QMessageBox::Ok);
QMessageBox::warning(NULL, QApplication::translate("UpdaterDialog", "Connection Error"), msg, QMessageBox::Ok);
}
return;
}
@ -45,8 +46,8 @@ void replyFinished(QNetworkReply *reply, bool quiet)
if (jerr.error != QJsonParseError::NoError)
{
QMessageBox::warning(
NULL, QObject::tr("Json Error"),
QObject::tr("Failed to parse Json reply with:\n%1").arg(jerr.errorString()),
NULL, QApplication::translate("UpdaterDialog", "Json Error"),
QApplication::translate("UpdaterDialog", "Failed to parse Json reply with:\n%1").arg(jerr.errorString()),
QMessageBox::Ok);
return;
}
@ -75,15 +76,15 @@ void replyFinished(QNetworkReply *reply, bool quiet)
if (!quiet)
{
QMessageBox::information(
NULL, QObject::tr("No Updates"),
QObject::tr("You using the latest version of Cubiomes-Viewer."));
NULL, QApplication::translate("UpdaterDialog", "No Updates"),
QApplication::translate("UpdaterDialog", "You using the latest version of Cubiomes-Viewer."));
}
return;
}
QMessageBox::StandardButton answer = QMessageBox::question(
NULL, QObject::tr("New Version"),
QObject::tr("<p>A new version: <b>%1</b> is aviable.</p><p>Open the download page in browser?</p>").arg(newest),
NULL, QApplication::translate("UpdaterDialog", "New Version"),
QApplication::translate("UpdaterDialog", "<p>A new version: <b>%1</b> is available.</p><p>Open the download page in browser?</p>").arg(newest),
QMessageBox::Yes|QMessageBox::No);
if (answer == QMessageBox::Yes)