add calls to tr() for translation

This commit is contained in:
Mitsukuni Sato
2009-12-18 08:44:44 +09:00
committed by Sean Rhea
parent 32471598ce
commit 009c013521
17 changed files with 55 additions and 51 deletions

View File

@@ -22,7 +22,7 @@
ChooseCyclistDialog::ChooseCyclistDialog(const QDir &home, bool allowNew) :
home(home)
{
setWindowTitle("Choose a Cyclist");
setWindowTitle(tr("Choose a Cyclist"));
listWidget = new QListWidget(this);
listWidget->setSelectionMode(QAbstractItemView::SingleSelection);

View File

@@ -141,11 +141,13 @@ void ConfigDialog::save_Clicked()
settings->setValue(GC_LANG, "en");
else if (configPage->langCombo->currentIndex()==1)
settings->setValue(GC_LANG, "fr");
else if (configPage->langCombo->currentIndex()==2)
settings->setValue(GC_LANG, "ja");
if (configPage->unitCombo->currentIndex()==0)
settings->setValue(GC_UNIT, "Metric");
else if (configPage->unitCombo->currentIndex()==1)
settings->setValue(GC_UNIT, "English");
settings->setValue(GC_UNIT, "Imperial");
settings->setValue(GC_ALLRIDES_ASCENDING, configPage->allRidesAscending->checkState());
settings->setValue(GC_CRANKLENGTH, configPage->crankLengthCombo->currentText());

View File

@@ -710,7 +710,7 @@ CpintPlot::calculate(RideItem *rideItem)
}
if (maxNonZero > 1) {
thisCurve = new QwtPlotCurve(
dateTime.toString("ddd MMM d, yyyy h:mm AP"));
dateTime.toString(tr("ddd MMM d, yyyy h:mm AP")));
thisCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
thisCurve->setPen(QPen(Qt::black));
thisCurve->attach(this);

View File

@@ -223,7 +223,7 @@ CriticalPowerWindow::pickerMoved(const QPoint &pos)
label = QString("%1 kJ (%2)").arg(watts * minutes * 60.0 / 1000.0, 0, 'f', 0);
else
label = QString("%1 watts (%2)").arg(watts);
label = label.arg(date.isValid() ? date.toString("MM/dd/yyyy") : tr("no date"));
label = label.arg(date.isValid() ? date.toString(tr("MM/dd/yyyy")) : tr("no date"));
}
else
label = tr("no data");

View File

@@ -43,11 +43,11 @@ HistogramWindow::HistogramWindow(MainWindow *mainWindow) :
binWidthLayout->addWidget(binWidthSlider);
lnYHistCheckBox = new QCheckBox;
lnYHistCheckBox->setText("Log y");
lnYHistCheckBox->setText(tr("Log Y"));
binWidthLayout->addWidget(lnYHistCheckBox);
withZerosCheckBox = new QCheckBox;
withZerosCheckBox->setText("With zeros");
withZerosCheckBox->setText(tr("With zeros"));
binWidthLayout->addWidget(withZerosCheckBox);
histParameterCombo = new QComboBox();
binWidthLayout->addWidget(histParameterCombo);

View File

@@ -253,7 +253,7 @@ MainWindow::MainWindow(const QDir &home) :
//////////////////////// Power Histogram Tab ////////////////////////
histogramWindow = new HistogramWindow(this);
tabWidget->addTab(histogramWindow, "Histogram Analysis");
tabWidget->addTab(histogramWindow, tr("Histogram Analysis"));
//////////////////////// Pedal Force/Velocity Plot ////////////////////////
@@ -269,7 +269,7 @@ MainWindow::MainWindow(const QDir &home) :
//////////////////////// Performance Manager ////////////////////////
performanceManagerWindow = new PerformanceManagerWindow(this);
tabWidget->addTab(performanceManagerWindow, "Performance Manager");
tabWidget->addTab(performanceManagerWindow, tr("Performance Manager"));
//////////////////////// Realtime ////////////////////////
@@ -557,7 +557,7 @@ MainWindow::exportCSV()
// Ask the user if they prefer to export with English or metric units.
QStringList items;
items << tr("Metric") << tr("English");
items << tr("Metric") << tr("Imperial");
bool ok;
QString units = QInputDialog::getItem(
this, tr("Select Units"), tr("Units:"), items, 0, false, &ok);

View File

@@ -18,6 +18,7 @@ ConfigurationPage::ConfigurationPage()
langCombo = new QComboBox();
langCombo->addItem(tr("English"));
langCombo->addItem(tr("French"));
langCombo->addItem(tr("Japanese"));
QVariant lang = settings->value(GC_LANG);
@@ -25,6 +26,8 @@ ConfigurationPage::ConfigurationPage()
langCombo->setCurrentIndex(0);
else if(lang.toString() == "fr")
langCombo->setCurrentIndex(1);
else if(lang.toString() == "ja")
langCombo->setCurrentIndex(2);
else // default : English
langCombo->setCurrentIndex(0);
@@ -32,7 +35,7 @@ ConfigurationPage::ConfigurationPage()
unitCombo = new QComboBox();
unitCombo->addItem(tr("Metric"));
unitCombo->addItem(tr("English"));
unitCombo->addItem(tr("Imperial"));
QVariant unit = settings->value(GC_UNIT);
@@ -80,7 +83,7 @@ ConfigurationPage::ConfigurationPage()
if(crankLength.toString() == "185")
crankLengthCombo->setCurrentIndex(10);
allRidesAscending = new QCheckBox("Sort ride list ascending.", this);
allRidesAscending = new QCheckBox(tr("Sort ride list ascending."), this);
QVariant isAscending = settings->value(GC_ALLRIDES_ASCENDING,Qt::Checked); // default is ascending sort
if(isAscending.toInt() > 0 ){
allRidesAscending->setCheckState(Qt::Checked);
@@ -119,8 +122,8 @@ ConfigurationPage::ConfigurationPage()
QLabel *BSModeLabel = new QLabel(tr("BikeScore estimate mode: "));
bsModeCombo = new QComboBox();
bsModeCombo->addItem("time");
bsModeCombo->addItem("distance");
bsModeCombo->addItem(tr("time"));
bsModeCombo->addItem(tr("distance"));
if (BSmode.toString() == "time")
bsModeCombo->setCurrentIndex(0);
else

View File

@@ -219,7 +219,7 @@ PerformanceManagerWindow::PMpickerMoved(const QPoint &pos)
if (day >= perfplot->min() && day < perfplot->max()) {
// set the date string
PMDayValue->setText(perfplot->getStartDate().addDays(day).toString("MMM d yyyy"));
PMDayValue->setText(perfplot->getStartDate().addDays(day).toString(tr("MMM d yyyy")));
sts = perfplot->getSTS(day);
@@ -249,8 +249,8 @@ void
PerformanceManagerWindow::setPMSliderDates()
{
PMdateRangefrom->setText(
perfplot->getStartDate().addDays(PMleftSlider->value()).toString("MMM d yyyy"));
perfplot->getStartDate().addDays(PMleftSlider->value()).toString(tr("MMM d yyyy")));
PMdateRangeto->setText(
perfplot->getEndDate().addDays(PMrightSlider->value() - perfplot->n()).toString("MMM d yyyy"));
perfplot->getEndDate().addDays(PMrightSlider->value() - perfplot->n()).toString(tr("MMM d yyyy")));
}

View File

@@ -38,10 +38,10 @@ PfPvWindow::PfPvWindow(MainWindow *mainWindow) :
QLabel *qaClLabel = new QLabel(tr("Crank Length (m):"), this);
qaClValue = new QLineEdit(QString("%1").arg(1000 * pfPvPlot->getCL()));
shadeZonesPfPvCheckBox = new QCheckBox;
shadeZonesPfPvCheckBox->setText("Shade zones");
shadeZonesPfPvCheckBox->setText(tr("Shade zones"));
shadeZonesPfPvCheckBox->setCheckState(Qt::Checked);
mergeIntervalPfPvCheckBox = new QCheckBox;
mergeIntervalPfPvCheckBox->setText("Merge intervals");
mergeIntervalPfPvCheckBox->setText(tr("Merge intervals"));
mergeIntervalPfPvCheckBox->setCheckState(Qt::Unchecked);
qaLayout->addWidget(qaCPLabel);

View File

@@ -89,9 +89,9 @@ RealtimeWindow::RealtimeWindow(MainWindow *parent, const QDir &home) : QWidget(
streamSelector = new QComboBox(this);
workoutSelector = new QComboBox(this);
workoutSelector->addItem("Manual Mode", 0);
workoutSelector->addItem("Workout Mode", 1);
workoutSelector->addItem("Slope Mode", 2);
workoutSelector->addItem(tr("Manual Mode"), 0);
workoutSelector->addItem(tr("Workout Mode"), 1);
workoutSelector->addItem(tr("Slope Mode"), 2);
// get configured devices
DeviceConfigurations all;
@@ -113,7 +113,7 @@ RealtimeWindow::RealtimeWindow(MainWindow *parent, const QDir &home) : QWidget(
streamSelector->setCurrentIndex(0);
recordSelector = new QCheckBox(this);
recordSelector->setText("Save");
recordSelector->setText(tr("Save"));
recordSelector->setChecked(Qt::Checked);
startButton = new QPushButton(tr("Start"), this);

View File

@@ -709,7 +709,7 @@ RideImportWizard::abortClicked()
}
tableWidget->setSortingEnabled(true); // so you can browse through errors etc
QString donemessage = QString("Import Complete. %1 of %2 successful.")
QString donemessage = QString(tr("Import Complete. %1 of %2 successful."))
.arg(completed, 1, 10, zero)
.arg(filenames.count(), 1, 10, zero);
progressBar->setValue(progressBar->maximum());
@@ -798,7 +798,7 @@ QWidget *RideDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
// edit that date!
QDateEdit *dateEdit = new QDateEdit(parent);
dateEdit->setDisplayFormat("dd MMM yyyy");
dateEdit->setDisplayFormat(tr("dd MMM yyyy"));
connect(dateEdit, SIGNAL(editingFinished()), this, SLOT(commitAndCloseDateEditor()));
return dateEdit;
} else if (index.column() == dateColumn+1) {
@@ -835,7 +835,7 @@ void RideDelegate::setEditorData(QWidget *editor, const QModelIndex &index) cons
// stored as text field
if (index.column() == dateColumn) {
QDateEdit *dateEdit = qobject_cast<QDateEdit *>(editor);
QDate date = QDate().fromString(index.model()->data(index, Qt::DisplayRole).toString(), "dd MMM yyyy");;
QDate date = QDate().fromString(index.model()->data(index, Qt::DisplayRole).toString(), tr("dd MMM yyyy"));
dateEdit->setDate(date);
} else if (index.column() == dateColumn+1) {
QTimeEdit *timeEdit = qobject_cast<QTimeEdit *>(editor);
@@ -851,7 +851,7 @@ void RideDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, cons
// stored as text field
if (index.column() == dateColumn) {
QDateEdit *dateEdit = qobject_cast<QDateEdit *>(editor);
QString value = dateEdit->date().toString("dd MMM yyyy");
QString value = dateEdit->date().toString(tr("dd MMM yyyy"));
// Place in the view
model->setData(index, value, Qt::DisplayRole);
} else if (index.column() == dateColumn+1) {

View File

@@ -174,8 +174,8 @@ RideSummaryWindow::htmlSummary() const
return summary;
}
summary = ("<p><center><h2>"
+ rideItem->dateTime.toString("dddd MMMM d, yyyy, h:mm AP")
+ "</h2><h3>Device Type: " + ride->deviceType() + "</h3>");
+ rideItem->dateTime.toString(tr("dddd MMMM d, yyyy, h:mm AP"))
+ "</h2><h3>" + tr("Device Type: ") + ride->deviceType() + "</h3>");
rideItem->computeMetrics();
@@ -309,7 +309,7 @@ RideSummaryWindow::htmlSummary() const
QVector<double> time_in_zone(rideItem->numZones());
for (int i = 0; i < rideItem->numZones(); ++i)
time_in_zone[i] = rideItem->timeInZone(i);
summary += "<h2>Power Zones</h2>";
summary += tr("<h2>Power Zones</h2>");
summary += mainWindow->zones()->summarize(rideItem->zoneRange(), time_in_zone);
}
@@ -324,17 +324,17 @@ RideSummaryWindow::htmlSummary() const
summary += "cellspacing=0 border=0><tr>";
summary += "<td align=\"center\">Interval</td>";
summary += "<td align=\"center\"></td>";
summary += "<td align=\"center\">Distance</td>";
summary += "<td align=\"center\">Work</td>";
summary += "<td align=\"center\">Max Power</td>";
summary += "<td align=\"center\">Avg Power</td>";
summary += "<td align=\"center\">95% HR</td>";
summary += "<td align=\"center\">Avg HR</td>";
summary += "<td align=\"center\">Avg Cadence</td>";
summary += "<td align=\"center\">Avg Speed</td>";
summary += tr("<td align=\"center\">Distance</td>");
summary += tr("<td align=\"center\">Work</td>");
summary += tr("<td align=\"center\">Max Power</td>");
summary += tr("<td align=\"center\">Avg Power</td>");
summary += tr("<td align=\"center\">95% HR</td>");
summary += tr("<td align=\"center\">Avg HR</td>");
summary += tr("<td align=\"center\">Avg Cadence</td>");
summary += tr("<td align=\"center\">Avg Speed</td>");
summary += "</tr><tr>";
summary += "<td align=\"center\">Number</td>";
summary += "<td align=\"center\">Duration</td>";
summary += tr("<td align=\"center\">Number</td>");
summary += tr("<td align=\"center\">Duration</td>");
if(unit.toString() == "Metric")
summary += "<td align=\"center\">(km)</td>";
else
@@ -355,7 +355,7 @@ RideSummaryWindow::htmlSummary() const
}
if (!errors.empty()) {
summary += "<p><h2>Errors reading file:</h2><ul>";
summary += tr("<p><h2>Errors reading file:</h2><ul>");
QStringListIterator i(errors);
while(i.hasNext())
summary += " <li>" + i.next();

View File

@@ -163,7 +163,7 @@ MainWindow::saveSilent(RideItem *rideItem)
SaveSingleDialogWidget::SaveSingleDialogWidget(MainWindow *mainWindow, RideItem *rideItem) :
QDialog(mainWindow, Qt::Dialog), mainWindow(mainWindow), rideItem(rideItem)
{
setWindowTitle("Save and Conversion");
setWindowTitle(tr("Save and Conversion"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
// Warning text

View File

@@ -260,8 +260,6 @@ WeeklySummaryWindow::refresh()
int hours = minutes / 60;
minutes %= 60;
const char *dateFormat = "MM/dd/yyyy";
QString summary;
summary =
tr(
@@ -279,8 +277,8 @@ WeeklySummaryWindow::refresh()
"<tr><td>Daily Average work (kJ):</td>"
" <td align=\"right\">%9</td></tr>"
)
.arg(wstart.toString(dateFormat))
.arg(wstart.addDays(6).toString(dateFormat))
.arg(wstart.toString(tr("MM/dd/yyyy")))
.arg(wstart.addDays(6).toString(tr("MM/dd/yyyy")))
.arg(hours)
.arg(minutes, 2, 10, QLatin1Char('0'))
.arg(seconds, 2, 10, QLatin1Char('0'))

View File

@@ -602,11 +602,11 @@ QString Zones::summarize(int rnum, QVector<double> &time_in_zone) const
summary += "<table align=\"center\" width=\"70%\" ";
summary += "border=\"0\">";
summary += "<tr>";
summary += "<td align=\"center\">Zone</td>";
summary += "<td align=\"center\">Description</td>";
summary += "<td align=\"center\">Low</td>";
summary += "<td align=\"center\">High</td>";
summary += "<td align=\"center\">Time</td>";
summary += tr("<td align=\"center\">Zone</td>");
summary += tr("<td align=\"center\">Description</td>");
summary += tr("<td align=\"center\">Low</td>");
summary += tr("<td align=\"center\">High</td>");
summary += tr("<td align=\"center\">Time</td>");
summary += "</tr>";
QColor color = QApplication::palette().alternateBase().color();
color = QColor::fromHsv(color.hue(), color.saturation() * 2, color.value());

View File

@@ -8,5 +8,6 @@
<file>images/gc.png</file>
<file>images/config.png</file>
<file>translations/gc_fr.qm</file>
<file>translations/gc_ja.qm</file>
</qresource>
</RCC>

View File

@@ -194,5 +194,5 @@ SOURCES += \
RESOURCES = application.qrc
TRANSLATIONS = translations/gc_fr.ts
TRANSLATIONS = translations/gc_fr.ts translations/gc_ja.ts