diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-03-21 16:46:36 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-22 12:02:48 -0700 |
commit | a109a283672e8e57c1dd85eb681e71a32d4c97bf (patch) | |
tree | f7f3fc5a9f2d65e7e02f76a83d34a901aba511b4 /commands/command_divelist.cpp | |
parent | e6cbb28a9fbac6b58b60d1715e86948869e62607 (diff) | |
download | subsurface-a109a283672e8e57c1dd85eb681e71a32d4c97bf.tar.gz |
translations: qualify tr function to get correct context
The way inheritance is implemented for the undo commands confuses the Qt
translation tooling - with the result that the context assumed by the
tools used to extract the strings doesn't match the context calculated
at runtime - so all the translations for the strings in undo commands
fail (including creating proper numerus forms).
This change forces a consistant context tag, at the price of creating a
significant delta for the source strings (the strings themselves stay
the same, but the context for a lot of them changes). I am hoping that
Transifex is smart enough to automagically add the correct translations
for these, but I guess I won't know until I try.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'commands/command_divelist.cpp')
-rw-r--r-- | commands/command_divelist.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/commands/command_divelist.cpp b/commands/command_divelist.cpp index 93689d44a..8f6189c1e 100644 --- a/commands/command_divelist.cpp +++ b/commands/command_divelist.cpp @@ -396,7 +396,7 @@ void DiveListBase::redo() AddDive::AddDive(dive *d, bool autogroup, bool newNumber) { - setText(tr("add dive")); + setText(Command::Base::tr("add dive")); // By convention, d is a pointer to "displayed dive" or a temporary variable and can be overwritten. d->maxdepth.mm = 0; d->dc.maxdepth.mm = 0; @@ -465,7 +465,7 @@ void AddDive::undoit() ImportDives::ImportDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites, int flags, const QString &source) { - setText(tr("import %n dive(s) from %1", "", dives->nr).arg(source)); + setText(Command::Base::tr("import %n dive(s) from %1", "", dives->nr).arg(source)); // this only matters if undoit were called before redoit currentDive = nullptr; @@ -546,7 +546,7 @@ void ImportDives::undoit() DeleteDive::DeleteDive(const QVector<struct dive*> &divesToDeleteIn) { divesToDelete.dives = std::vector<dive *>(divesToDeleteIn.begin(), divesToDeleteIn.end()); - setText(QStringLiteral("%1 [%2]").arg(tr("delete %n dive(s)", "", divesToDelete.dives.size())).arg(getListOfDives(divesToDelete.dives))); + setText(QStringLiteral("%1 [%2]").arg(Command::Base::tr("delete %n dive(s)", "", divesToDelete.dives.size())).arg(getListOfDives(divesToDelete.dives))); } bool DeleteDive::workToBeDone() @@ -582,7 +582,7 @@ void DeleteDive::redoit() ShiftTime::ShiftTime(std::vector<dive *> changedDives, int amount) : diveList(changedDives), timeChanged(amount) { - setText(QStringLiteral("%1 [%2]").arg(tr("shift time of %n dives", "", changedDives.size())).arg(getListOfDives(changedDives))); + setText(QStringLiteral("%1 [%2]").arg(Command::Base::tr("shift time of %n dives", "", changedDives.size())).arg(getListOfDives(changedDives))); } void ShiftTime::redoit() @@ -630,7 +630,7 @@ RenumberDives::RenumberDives(const QVector<QPair<dive *, int>> &divesToRenumberI dives.reserve(divesToRenumber.length()); for (QPair<dive *, int>divePlusNumber: divesToRenumber) dives.push_back(divePlusNumber.first); - setText(QStringLiteral("%1 [%2]").arg(tr("renumber %n dive(s)", "", divesToRenumber.count())).arg(getListOfDives(dives))); + setText(QStringLiteral("%1 [%2]").arg(Command::Base::tr("renumber %n dive(s)", "", divesToRenumber.count())).arg(getListOfDives(dives))); } void RenumberDives::undoit() @@ -682,7 +682,7 @@ void TripBase::undoit() RemoveDivesFromTrip::RemoveDivesFromTrip(const QVector<dive *> &divesToRemove) { - setText(QStringLiteral("%1 [%2]").arg(tr("remove %n dive(s) from trip", "", divesToRemove.size())).arg(getListOfDives(divesToRemove))); + setText(QStringLiteral("%1 [%2]").arg(Command::Base::tr("remove %n dive(s) from trip", "", divesToRemove.size())).arg(getListOfDives(divesToRemove))); divesToMove.divesToMove.reserve(divesToRemove.size()); for (dive *d: divesToRemove) { // If a user manually removes a dive from a trip, don't autogroup this dive. @@ -694,7 +694,7 @@ RemoveDivesFromTrip::RemoveDivesFromTrip(const QVector<dive *> &divesToRemove) RemoveAutogenTrips::RemoveAutogenTrips() { - setText(tr("remove autogenerated trips")); + setText(Command::Base::tr("remove autogenerated trips")); // TODO: don't touch core-innards directly int i; struct dive *dive; @@ -706,14 +706,14 @@ RemoveAutogenTrips::RemoveAutogenTrips() AddDivesToTrip::AddDivesToTrip(const QVector<dive *> &divesToAddIn, dive_trip *trip) { - setText(QStringLiteral("%1 [%2]").arg(tr("add %n dives to trip", "", divesToAddIn.size())).arg(getListOfDives(divesToAddIn))); + setText(QStringLiteral("%1 [%2]").arg(Command::Base::tr("add %n dives to trip", "", divesToAddIn.size())).arg(getListOfDives(divesToAddIn))); for (dive *d: divesToAddIn) divesToMove.divesToMove.push_back( {d, trip} ); } CreateTrip::CreateTrip(const QVector<dive *> &divesToAddIn) { - setText(tr("create trip")); + setText(Command::Base::tr("create trip")); if (divesToAddIn.isEmpty()) return; @@ -726,7 +726,7 @@ CreateTrip::CreateTrip(const QVector<dive *> &divesToAddIn) AutogroupDives::AutogroupDives() { - setText(tr("autogroup dives")); + setText(Command::Base::tr("autogroup dives")); dive_trip *trip; bool alloc; @@ -821,7 +821,7 @@ static std::array<dive *, 2> doSplitDives(const dive *d, duration_t time) SplitDives::SplitDives(dive *d, duration_t time) : SplitDivesBase(d, doSplitDives(d, time)) { - setText(tr("split dive")); + setText(Command::Base::tr("split dive")); } static std::array<dive *, 2> splitDiveComputer(const dive *d, int dc_num) @@ -839,7 +839,7 @@ static std::array<dive *, 2> splitDiveComputer(const dive *d, int dc_num) SplitDiveComputer::SplitDiveComputer(dive *d, int dc_num) : SplitDivesBase(d, splitDiveComputer(d, dc_num)) { - setText(tr("split dive computer")); + setText(Command::Base::tr("split dive computer")); } DiveComputerBase::DiveComputerBase(dive *old_dive, dive *new_dive, int dc_nr_after_in) : dc_nr_before(dc_number), @@ -895,18 +895,18 @@ void DiveComputerBase::undoit() MoveDiveComputerToFront::MoveDiveComputerToFront(dive *d, int dc_num) : DiveComputerBase(d, make_first_dc(d, dc_num), 0) { - setText(tr("move dive computer to front")); + setText(Command::Base::tr("move dive computer to front")); } DeleteDiveComputer::DeleteDiveComputer(dive *d, int dc_num) : DiveComputerBase(d, clone_delete_divecomputer(d, dc_num), std::min(count_divecomputers(d) - 1, dc_num)) { - setText(tr("delete dive computer")); + setText(Command::Base::tr("delete dive computer")); } MergeDives::MergeDives(const QVector <dive *> &dives) { - setText(tr("merge dive")); + setText(Command::Base::tr("merge dive")); // Just a safety check - if there's not two or more dives - do nothing // The caller should have made sure that this doesn't happen. |