diff --git a/src/AddIntervalDialog.cpp b/src/AddIntervalDialog.cpp index 38538d30b..97e455a68 100644 --- a/src/AddIntervalDialog.cpp +++ b/src/AddIntervalDialog.cpp @@ -113,14 +113,14 @@ AddIntervalDialog::AddIntervalDialog(Context *context) : hrsSpinBox = new QDoubleSpinBox(this); hrsSpinBox->setDecimals(0); hrsSpinBox->setMinimum(0.0); - hrsSpinBox->setSuffix(" hrs"); + hrsSpinBox->setSuffix(tr(" hrs")); hrsSpinBox->setSingleStep(1.0); hrsSpinBox->setAlignment(Qt::AlignRight); intervalTimeLayout->addWidget(hrsSpinBox); minsSpinBox = new QDoubleSpinBox(this); minsSpinBox->setDecimals(0); minsSpinBox->setRange(0.0, 59.0); - minsSpinBox->setSuffix(" mins"); + minsSpinBox->setSuffix(tr(" mins")); minsSpinBox->setSingleStep(1.0); minsSpinBox->setWrapping(true); minsSpinBox->setAlignment(Qt::AlignRight); @@ -129,7 +129,7 @@ AddIntervalDialog::AddIntervalDialog(Context *context) : secsSpinBox = new QDoubleSpinBox(this); secsSpinBox->setDecimals(0); secsSpinBox->setRange(0.0, 59.0); - secsSpinBox->setSuffix(" secs"); + secsSpinBox->setSuffix(tr(" secs")); secsSpinBox->setSingleStep(1.0); secsSpinBox->setWrapping(true); secsSpinBox->setAlignment(Qt::AlignRight); @@ -521,7 +521,7 @@ AddIntervalDialog::createClicked() struct AddedInterval add; add.start = ride->dataPoints()[peaks[i].x()]->secs; add.stop = ride->dataPoints()[peaks[i+1].x()]->secs; - add.name = QString("Climb #%1 (%2m)").arg(counter) + add.name = QString(tr("Climb #%1 (%2m)")).arg(counter) .arg(ascent); results << add; @@ -786,7 +786,7 @@ AddIntervalDialog::findBests(bool typeTime, const RideFile *ride, double windowS if (!overlaps) { QString name = prefix; if (prefix == "") { - name = "Best %2%3 #%1"; + name = tr("Best %2%3 #%1"); name = name.arg(_results.count()+1); if (typeTime) { // best n mins diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index 1298b4894..f392a0744 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -1624,7 +1624,7 @@ AllPlotWindow::plotPickerMoved(const QPoint &pos) // we don't do selection in compare mode if (isCompare()) return; - QString name = QString("Selection #%1 ").arg(selection); + QString name = QString(tr("Selection #%1 ")).arg(selection); // which picker and plot send this signal? QwtPlotPicker* pick = qobject_cast(sender()); diff --git a/src/ComparePane.cpp b/src/ComparePane.cpp index 123471dfc..57dd755c6 100644 --- a/src/ComparePane.cpp +++ b/src/ComparePane.cpp @@ -65,8 +65,8 @@ class CTableWidgetItem : public QTableWidgetItem switch(column()) { case 2 : return text() < other.text(); // athlete - case 3 : return QDate::fromString(text(), "dd, MMM yyyy") < - QDate::fromString(other.text(), "dd, MMM yyyy"); // date + case 3 : return QDate::fromString(text(), QObject::tr("dd, MMM yyyy")) < + QDate::fromString(other.text(), QObject::tr("dd, MMM yyyy")); // date case 4 : // date or time depending on which view if (text().contains(":")) { @@ -75,8 +75,8 @@ class CTableWidgetItem : public QTableWidgetItem } else { - return QDate::fromString(text(), "dd, MMM yyyy") < - QDate::fromString(other.text(), "dd, MMM yyyy"); // date + return QDate::fromString(text(), QObject::tr("dd, MMM yyyy")) < + QDate::fromString(other.text(), QObject::tr("dd, MMM yyyy")); // date } case 5 : return QTime::fromString(text(), "hh:mm") < // Duration @@ -174,9 +174,9 @@ ComparePane::refreshTable() QStringList list; list << "" // checkbox << "" // color - << "Athlete" - << "Date" - << "Time"; + << tr("Athlete") + << tr("Date") + << tr("Time"); QStringList worklist; // metrics to compute RideMetricFactory &factory = RideMetricFactory::instance(); @@ -188,7 +188,9 @@ ComparePane::refreshTable() if (m) { worklist << metric; QString units; - if (m->units(context->athlete->useMetricUnits) != "seconds") units = m->units(context->athlete->useMetricUnits); + // check for both original and translated + if (!(m->units(context->athlete->useMetricUnits) == "seconds" || m->units(context->athlete->useMetricUnits) == tr("seconds"))) + units = m->units(context->athlete->useMetricUnits); if (units != "") list << QString("%1 (%2)").arg(m->name()).arg(units); else list << QString("%1").arg(m->name()); } @@ -248,7 +250,7 @@ ComparePane::refreshTable() // date t = new CTableWidgetItem; - t->setText(x.data->startTime().date().toString("dd MMM, yyyy")); + t->setText(x.data->startTime().date().toString(tr("dd MMM, yyyy"))); t->setFlags(t->flags() & (~Qt::ItemIsEditable)); table->setItem(counter, 3, t); @@ -341,9 +343,9 @@ ComparePane::refreshTable() QStringList list; list << "" // checkbox << "" // color - << "Athlete" - << "From" - << "To"; + << tr("Athlete") + << tr("From") + << tr("To"); QStringList worklist; // metrics to compute RideMetricFactory &factory = RideMetricFactory::instance(); @@ -355,13 +357,14 @@ ComparePane::refreshTable() if (m) { worklist << metric; QString units; - if (m->units(context->athlete->useMetricUnits) != "seconds") units = m->units(context->athlete->useMetricUnits); + if (!(m->units(context->athlete->useMetricUnits) == "seconds" || m->units(context->athlete->useMetricUnits) == tr("seconds"))) + units = m->units(context->athlete->useMetricUnits); if (units != "") list << QString("%1 (%2)").arg(m->name()).arg(units); else list << QString("%1").arg(m->name()); } } - list << "Date Range"; + list << tr("Date Range"); table->setColumnCount(list.count()+1); table->horizontalHeader()->setSectionHidden(list.count(), true); @@ -402,13 +405,13 @@ ComparePane::refreshTable() // date from t = new CTableWidgetItem; - t->setText(x.start.toString("dd MMM, yyyy")); + t->setText(x.start.toString(tr("dd MMM, yyyy"))); t->setFlags(t->flags() & (~Qt::ItemIsEditable)); table->setItem(counter, 3, t); // date to t = new CTableWidgetItem; - t->setText(x.end.toString("dd MMM, yyyy")); + t->setText(x.end.toString(tr("dd MMM, yyyy"))); t->setFlags(t->flags() & (~Qt::ItemIsEditable)); table->setItem(counter, 4, t); diff --git a/src/TabView.h b/src/TabView.h index e456a3582..b89357b0e 100644 --- a/src/TabView.h +++ b/src/TabView.h @@ -164,8 +164,8 @@ protected: #ifdef Q_OS_MAC QtMacButton *newclear() { if (clearbutton) delete clearbutton; // we only need one! - clearbutton = new QtMacButton("Clear", this); - clearbutton->setFixedWidth(60); + clearbutton = new QtMacButton(tr("Clear"), this); +// clearbutton->setFixedWidth(60); // no fixed length to allow translation clearbutton->setFixedHeight(20); clearbutton->setFocusPolicy(Qt::NoFocus); connect(clearbutton, SIGNAL(clicked()), this, SLOT(clearClicked())); @@ -174,8 +174,8 @@ protected: #else QPushButton *newclear() { if (clearbutton) delete clearbutton; // we only need one! - clearbutton = new QPushButton("Clear", this); - clearbutton->setFixedWidth(60); + clearbutton = new QPushButton(tr("Clear"), this); +// clearbutton->setFixedWidth(60); // no fixed length to allow translation clearbutton->setFixedHeight(20); clearbutton->setFocusPolicy(Qt::NoFocus); connect(clearbutton, SIGNAL(clicked()), this, SLOT(clearClicked())); @@ -187,8 +187,8 @@ protected: #ifdef Q_OS_MAC QtMacButton *newtoggle() { if (toggle) delete toggle; // we only need one! - toggle = new QtMacButton("OFF", this); - toggle->setFixedWidth(40); + toggle = new QtMacButton(tr("OFF"), this); +// toggle->setFixedWidth(40); // no fixed length to allow translation toggle->setFixedHeight(20); toggle->setFocusPolicy(Qt::NoFocus); connect(toggle, SIGNAL(clicked()), this, SLOT(toggled())); @@ -198,10 +198,10 @@ protected: #else QPushButton *newtoggle() { if (toggle) delete toggle; // we only need one! - toggle = new QPushButton("OFF", this); + toggle = new QPushButton(tr("OFF"), this); toggle->setCheckable(true); toggle->setChecked(false); - toggle->setFixedWidth(40); +// toggle->setFixedWidth(40); // no fixed length to allow translation toggle->setFixedHeight(20); toggle->setFocusPolicy(Qt::NoFocus); connect(toggle, SIGNAL(clicked()), this, SLOT(toggled())); @@ -274,12 +274,12 @@ public slots: font.setWeight(QFont::Bold); toggle->setFont(font); toggle->setStyleSheet("color: red"); - toggle->setText("ON"); + toggle->setText(tr("ON")); } else { font.setWeight(QFont::Normal); toggle->setFont(font); toggle->setStyleSheet(""); - toggle->setText("OFF"); + toggle->setText(tr("OFF")); } // we started compare mode emit compareChanged(toggle->isChecked());