From 2816cf060c4e039b0f1b078e5e713089842fa82f Mon Sep 17 00:00:00 2001 From: Spiros Date: Sat, 15 Jun 2024 18:32:36 +0300 Subject: [PATCH] Add Greek tranlation and use it --- .gitignore | 1 - src/main.cpp | 8 + src/mainwindow.cpp | 57 ++++--- src/resources.qrc | 3 + translations/kdiskinfo_el_GR.qm | Bin 0 -> 8283 bytes translations/kdiskinfo_el_GR.ts | 259 ++++++++++++++++++-------------- 6 files changed, 191 insertions(+), 137 deletions(-) create mode 100644 translations/kdiskinfo_el_GR.qm diff --git a/.gitignore b/.gitignore index 5620586..0f68cac 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ ui_*.h *.jsc Makefile* *build-* -*.qm *.prl # Qt unit tests diff --git a/src/main.cpp b/src/main.cpp index c9001a9..2fe1919 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,10 +1,18 @@ #include "mainwindow.h" #include +#include +#include int main(int argc, char *argv[]) { QApplication a(argc, argv); + + QTranslator translator; + if (translator.load(QLocale(), QLatin1String("kdiskinfo"), QLatin1String("_"), QLatin1String(":/translations"))) { + a.installTranslator(&translator); + } + MainWindow w; w.setWindowIcon(QIcon(":/icons/icon.svg")); w.show(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 325600f..e500e5b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -52,11 +52,11 @@ MainWindow::MainWindow(QWidget *parent) menuDevice = ui->menuDevice; menuDisk = ui->menuDisk; - selfTestMenu = new QMenu("Start Self Test", this); + selfTestMenu = new QMenu(tr("Start Self Test"), this); menuDevice->addMenu(selfTestMenu); selfTestMenu->setToolTipsVisible(true); - selfTestLogAction = new QAction("Self Test Log", this); + selfTestLogAction = new QAction(tr("Self Test Log"), this); menuDevice->addAction(selfTestLogAction); disksGroup = new QActionGroup(this); @@ -259,16 +259,16 @@ void MainWindow::updateUI() } if (healthPassed && !caution && !bad) { - health = "Good"; + health = tr("Good"); healthColor = goodColor; } else if (healthPassed && caution && !bad) { - health = "Caution"; + health = tr("Caution"); healthColor = cautionColor; } else if ((bad || !healthPassed) && !modelName.isEmpty()){ - health = "Bad"; + health = tr("Bad"); healthColor = badColor; } else { - health = "Unknown"; + health = tr("Unknown"); healthColor = naColor; } @@ -355,11 +355,13 @@ void MainWindow::selfTestHandler(const QString &mode, const QString &name, const break; } } + percentage.replace("remaining", tr("remaining")); + percentage.replace("completed", tr("completed")); if (exitStatus == 4) { QMessageBox msgBox; msgBox.setWindowTitle(tr("Test Already Running")); - msgBox.setText(tr("A self-test is already being performed ") + percentage + tr("\nYou can press the Ok button in order to abort the test that is currently running")); + msgBox.setText(tr("A self-test is already being performed") + " " + percentage + "\n" + tr("You can press the Ok button in order to abort the test that is currently running")); msgBox.setIcon(QMessageBox::Warning); msgBox.addButton(QMessageBox::Cancel); @@ -373,7 +375,7 @@ void MainWindow::selfTestHandler(const QString &mode, const QString &name, const } else if (exitStatus == 0) { QString infoMessage = tr("A self-test has been requested successfully"); if (minutes != "0") { - infoMessage = infoMessage + tr("\nIt will be completed after ") + minutes + tr(" minutes"); + infoMessage = infoMessage + "\n" + tr("It will be completed after") + " " + minutes + " " + tr("minutes"); } QMessageBox::information(this, tr("Test Requested"), infoMessage); } else { @@ -481,7 +483,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal int powerCycleCountInt = localObj["power_cycle_count"].toInt(-1); QString powerCycleCount; if (powerCycleCountInt >= 0) { - powerCycleCount = QString::number(powerCycleCountInt) + " count"; + powerCycleCount = QString::number(powerCycleCountInt) + " " + tr("count"); } else { powerCycleCount = "Unknown"; } @@ -492,7 +494,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal int powerOnTimeInt = localObj["power_on_time"].toObject().value("hours").toInt(-1); QString powerOnTime; if (powerOnTimeInt >= 0) { - powerOnTime = QString::number(powerOnTimeInt) + " hours"; + powerOnTime = QString::number(powerOnTimeInt) + " " + tr("hours"); } else { powerOnTime = "Unknown"; } @@ -638,11 +640,11 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal temperatureValue->setAlignment(Qt::AlignCenter); - if (health == "Bad") { + if (health == tr("Bad")) { healthStatusValue->setStyleSheet("background-color: " + badColor.name() + ";"); - } else if (health == "Caution"){ + } else if (health == tr("Caution")){ healthStatusValue->setStyleSheet("background-color: " + cautionColor.name() + ";"); - } else if (health == "Good") { + } else if (health == tr("Good")) { healthStatusValue->setStyleSheet("background-color: " + goodColor.name() + ";"); } else { healthStatusValue->setStyleSheet("background-color: " + naColor.name() + ";"); @@ -668,8 +670,17 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal int i = 0; for (const QString& key : keys) { QString minutes = QString::number(static_cast(pollingMinutes[key].toInt())); - QString actionLabel = key + " (" + minutes + tr(" Min.)"); - actionLabel[0] = actionLabel[0].toUpper(); + QString keyTranslated; + if (key == "short") { + keyTranslated = tr("Short"); + } else if (key == "extended") { + keyTranslated = tr("Extended"); + } else { + keyTranslated = key; + keyTranslated = keyTranslated[0].toUpper(); + qDebug() << minutes; + } + QString actionLabel = keyTranslated + " (" + minutes + " " + tr("Min.)"); QAction *action = new QAction(actionLabel, this); selfTestMenu->addAction(action); @@ -701,13 +712,13 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal selfTestMenu->clear(); selfTestMenu->setEnabled(true); - QAction *actionShort = new QAction("Short", this); + QAction *actionShort = new QAction(tr("Short"), this); selfTestMenu->addAction(actionShort); connect(actionShort, &QAction::triggered, this, [this, mode = "short", name, minutes = "0"]() { selfTestHandler(mode, name, minutes); }); - QAction *actionLong = new QAction("Extended", this); + QAction *actionLong = new QAction(tr("Extended"), this); selfTestMenu->addAction(actionLong); connect(actionLong , &QAction::triggered, this, [this, mode = "long", name, minutes = "0"]() { selfTestHandler(mode, name, minutes); @@ -730,7 +741,7 @@ void MainWindow::addNvmeLogTable(const QVector>& nvmeLogOrde QString warningMessage = ""; tableWidget->setColumnCount(4); - tableWidget->setHorizontalHeaderLabels({"", "ID", "Attribute Name", "Raw Values"}); + tableWidget->setHorizontalHeaderLabels({"", tr("ID"), tr("Attribute Name"), tr("Raw Values")}); tableWidget->verticalHeader()->setVisible(false); tableWidget->setItemDelegateForColumn(0, new StatusDot(tableWidget)); tableWidget->setRowCount(nvmeLogOrdered.size()); @@ -834,7 +845,7 @@ void MainWindow::addNvmeLogTable(const QVector>& nvmeLogOrde void MainWindow::addSmartAttributesTable(const QJsonArray &attributes) { tableWidget->setColumnCount(7); - tableWidget->setHorizontalHeaderLabels({"", "ID", "Attribute Name", "Current", "Worst", "Threshold", "Raw Values"}); + tableWidget->setHorizontalHeaderLabels({"", tr("ID"), tr("Attribute Name"), tr("Current"), tr("Worst"), tr("Threshold"), tr("Raw Values")}); tableWidget->verticalHeader()->setVisible(false); tableWidget->setItemDelegateForColumn(0, new StatusDot(tableWidget)); tableWidget->setRowCount(attributes.size()); @@ -1048,11 +1059,11 @@ void MainWindow::on_actionRescan_Refresh_triggered() void MainWindow::on_actionAbout_triggered() { - QString message = "An ATA and NVMe S.M.A.R.T. data viewer for Linux\n\n"; - message += "Licensed under the GNU G.P.L. Version 3\n\n"; - message += "Made by Samantas5855"; + QString message = tr("An ATA and NVMe S.M.A.R.T. data viewer for Linux") + "\n\n"; + message += tr("Licensed under the GNU G.P.L. Version 3") + "\n\n"; + message += tr("Made by Samantas5855"); - QMessageBox::about(this, "About KDiskInfo", message); + QMessageBox::about(this, tr("About KDiskInfo"), message); } void MainWindow::on_actionIgnore_C4_Reallocation_Event_Count_toggled(bool enabled) diff --git a/src/resources.qrc b/src/resources.qrc index 474bfc3..06f0355 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -2,4 +2,7 @@ icon.svg + + ../translations/kdiskinfo_el_GR.qm + diff --git a/translations/kdiskinfo_el_GR.qm b/translations/kdiskinfo_el_GR.qm new file mode 100644 index 0000000000000000000000000000000000000000..6e43974e09a7472af6c7008211d6bd0ce6c6cb0a GIT binary patch literal 8283 zcmcgxYiu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-uWkcnl zp^D;TLS1MB@qH2;AJ53iR^kaMpDG}F=}CPLRTtLyDKL`K@H)+~l8A(+Fx)Fz`G@eHHa{=#KQFbXhX4Qo literal 0 HcmV?d00001 diff --git a/translations/kdiskinfo_el_GR.ts b/translations/kdiskinfo_el_GR.ts index 1b21658..d45f6f0 100644 --- a/translations/kdiskinfo_el_GR.ts +++ b/translations/kdiskinfo_el_GR.ts @@ -5,164 +5,118 @@ MainWindow - - KDiskInfo - - <html><head/><body><p align="center"><span style=" font-size:14pt; font-weight:700;">Hard Drive Name</span></p></body></html> - - <html><head/><body><p align="center">Health Status</p></body></html> - <html><head/><body><p align="center">Κατάσταση Υγείας</p></body></html> + <html><head/><body><p align="center">Υγεία</p></body></html> - - <html><head/><body><p align="center"><span style=" font-size:12pt; font-weight:700; color:#000000;">Good</span></p><p align="center"><span style=" font-size:12pt; font-weight:700; color:#000000;">100 %</span></p></body></html> - - <html><head/><body><p align="center">Temperature</p></body></html> <html><head/><body><p align="center">Θερμοκρασία</p></body></html> - - <html><head/><body><p align="center"><span style=" font-size:12pt; font-weight:700; color:#000000;">23° C</span></p></body></html> - - Firmware Λογισμικό - - Serial Number Σειριακός Αριθμός - - Protocol Πρωτόκολλο - - Device Node Διαδρομή - - - + Type Τύπος - - Total Host Reads Συνολικές Αναγνώσεις - - Total Host Writes Συνολικές Εγγραφές - - Rotation Rate Ρυθμός Περιστροφής - - Power On Count Μετρητής Λειτουργίας - - - + Power On Hours Ώρες Λειτουργίας - - File Αρχείο - - Settings Ρυθμίσεις - - &Quit Έξοδος - - &Refresh Devices Ανανέωση Συσκευών - - &Convert Raw values to HEX Μετατροπή των τιμών σε δεκαεξαδικές - - Self Test Αυτοδιάγνωση - - Cyclic Navigation Κυκλική Πλοήγηση @@ -172,29 +126,21 @@ - - &Help Βοήθεια - - De&vice Συσκευή - - Disk - Δίσκος + Δίσκος - - &Save JSON Αποθήκευση JSON @@ -208,22 +154,16 @@ - - &GitHub - - &About Σχετικά - - &Ignore C4 (Reallocated Event Count) Αγνόησε το C4 (Reallocated Event Count) @@ -233,54 +173,66 @@ - - &Use Fahrenheit Χρήση Fahrenheit + + Good - Καλή + Καλή + + Caution - Προσοχή + Προσοχή + + Bad - Κακή + Κακή + Unknown - Άγνωστη + Άγνωστη + + Attribute Name - Ιδιότητα + Ιδιότητα + + Raw Values - Τιμή + Τιμή + Current - Τρέχουσα + Τρέχουσα + Worst - Χειρότερη + Χειρότερη + Threshold - Όριο + Όριο - - - - + + + + KDiskInfo Error Σφάλμα KDiskInfo @@ -300,136 +252,215 @@ Το KDiskInfo χρειάζεται δικαιώματα υπερχρήστη για να εκτελέσει την αυτοδιάγνωση! - + Test Already Running Μία αυτοδιάγνωση είναι ήδη σε εκτέλεση - A self-test is already being performed - Μία αυτοδιάγνωση εκτελείτε αυτή τη στιγμή + Μία αυτοδιάγνωση εκτελείτε αυτή τη στιγμή - You can press the Ok button in order to abort the test that is currently running - Μπορείτε να πατήσετε το κουμπί Εντάξει για να ακυρώσετε την τρέχουσα αυτοδιάγνωση + Μπορείτε να πατήσετε το κουμπί Εντάξει για να ακυρώσετε την τρέχουσα αυτοδιάγνωση - + A self-test has been requested successfully Η αυτοδιάγνωση ξεκίνησε επιτυχώς - It will be completed after - Θα τελειώσει μετά από + Θα τελειώσει μετά από - minutes - λεπτά + λεπτά - - + + Test Requested Η αυτοδιάγνωση ξεκίνησε - - + + Error: Something went wrong Σφάλμα: Κάτι πήγε στραβά - + Status Κατάσταση - + + Self Test Log Καταγραφολόγιο Αυτοδιάγνωσης - + + Start Self Test + Εκκίνηση Αυτοδιάγνωσης + + Min.) + Λεπ.) + + + + A self-test is already being performed + Μία αυτοδιάγνωση εκτελείτε αυτή τη στιγμή + + + + You can press the Ok button in order to abort the test that is currently running + Μπορείτε να πατήσετε το κουμπί Εντάξει για να ακυρώσετε την τρέχουσα αυτοδιάγνωση + + + +It will be completed after + Θα τελειώσει μετά από + + + + minutes + λεπτά + + + + Min.) Λεπ.) - + + + Short + Σύντομο + + + + remaining + απομένει + + + + completed + ολοκληρώθηκε + + + + It will be completed after + Θα τελειώσει μετά από + + + + count + + + + + hours + ώρες + + + + + Extended + Εμπεριστατωμένο + + + + + ID + + + + Available spare capacity has fallen below the threshold Η υγεία του δίσκου έχει πέσει κάτω από το όριο - + Temperature error (Overheat or Overcool) Σφάλμα θερμοκρασίας (Υπερθέρμανση ή Υπερψύξη) - + NVM subsystem reliability has been degraded Η αξιοπιστία του NVMe έχει μειωθεί - + Media has been placed in Read Only Mode Το μέσο έχει τεθεί αποκλειστικά σε λειτουργία ανάγνωσης - + Volatile memory backup device has Failed Η δημιουργία αρχείου επαναφοράς της μη διατηρήσιμης μνήμης απέτυχε - + Persistent memory region has become Read-Only Η διατηρήσιμη μνήμη έχει μεταβεί αποκλειστικά σε λειτουργία ανάγνωσης - + Critical Warning Σημαντική Προειδοποίηση - + KDiskInfo needs root access in order to read S.M.A.R.T. data! Το KDiskInfo χρειάζεται δικαιώματα υπερχρήστη για να προσπελάσει τα δεδομένα S.M.A.R.T.! - + Empty JSON Κενό JSON - + The JSON is empty Αυτό το JSON είναι κενό - + Save JSON Αποθήκευση JSON - + JSON (*.json);;All Files (*) JSON (*.json);;;Όλα τα αρχεία (*) - + Unable to open file for writing Δεν είναι δυνατό το άνοιγμα αυτού του αρχείου για εγγραφή - + + An ATA and NVMe S.M.A.R.T. data viewer for Linux + Ένας αναγνώστης S.M.A.R.T. για τα Linux + + + + Licensed under the GNU G.P.L. Version 3 + Διατίθεται υπό την άδεια GNU G.P.L. Έκδοση 3 + + + KDiskInfo needs root access in order to abort a self-test! Το KDiskInfo χρειάζεται δικαιώματα υπερχρήστη για να ακυρώσει μία αυτοδιάγνωση! - + The self-test has been aborted Η τρέχουσα αυτοδιάγνωση ακυρώθηκε @@ -446,12 +477,14 @@ It will be completed after Διατίθεται υπό την άδεια GNU G.P.L. Έκδοση 3 + Made by Samantas5855 - Δημιουργήθηκε από τον Samantas5855 + Δημιουργήθηκε από τον Samantas5855 + About KDiskInfo - Σχετικά με το KDiskInfo + Σχετικά με το KDiskInfo