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 0000000..6e43974 Binary files /dev/null and b/translations/kdiskinfo_el_GR.qm differ 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