Skip to content

Commit

Permalink
fix: fixed incorrect plural display
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Nov 27, 2023
1 parent 4fd60f2 commit b44748c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libonboard/Onboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void Onboard::toggleBackgroundService(bool enable)

if(enable) {
_pollTimer.setSingleShot(false);
_pollTimer.setInterval(4000);
_pollTimer.setInterval(2000);
_pollTimer.start();
pollData();
}
Expand Down
4 changes: 2 additions & 2 deletions plasmoid/lib/OnboardApplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ void OnboardApplet::onTrainStatusUpdated()
if(hasArrived) {
setStatusIcon(QIcon::fromTheme(currentStationIconName));
setStatusText(tr("At platform %2 in %1").arg(nextStation).arg(platform));
setSecondaryStatusText(tr("%1 km/h | Departure in %2%n minute(s)", "", std::abs(departingInMin)).arg(status->speed()).arg(departingInMin < 0 ? "-" : ""));
setSecondaryStatusText(tr("%1 km/h | Departure in %2%3").arg(status->speed()).arg(departingInMin < 0 ? "-" : "").arg(tr("%n minute(s)", "", std::abs(departingInMin))));
}
else {
setStatusIcon(QIcon::fromTheme(nextStationIconName));
setStatusText(tr("%1 in %2%n minute(s)", "", std::abs(arrivingInMin)).arg(nextStation).arg(arrivingInMin < 0 ? "-" : ""));
setStatusText(tr("%1 in %2%3").arg(nextStation).arg(arrivingInMin < 0 ? "-" : "").arg(tr("%n minute(s)", "", std::abs(arrivingInMin))));
setSecondaryStatusText(tr("%1 km/h | %2 km remaining | Platform %3").arg(status->speed()).arg(distanceToNext).arg(platform));
}

Expand Down
19 changes: 17 additions & 2 deletions plasmoid/translations/onboardplasmoid_de_DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,33 @@ Hinweis: </translation>
</message>
<message numerus="yes">
<source>%1 km/h | Departure in %2%n minute(s)</source>
<translation>
<translation type="vanished">
<numerusform>%1 km/h | Abfahrt in %2%n Minute</numerusform>
<numerusform>%1 km/h | Abfahrt in %2%n Minuten</numerusform>
</translation>
</message>
<message numerus="yes">
<source>%1 in %2%n minute(s)</source>
<translation>
<translation type="vanished">
<numerusform>%1 in %2%n Minute</numerusform>
<numerusform>%1 in %2%n Minuten</numerusform>
</translation>
</message>
<message>
<source>%1 km/h | Departure in %2%3</source>
<translation>%1 km/h | Abfahrt in %2%3</translation>
</message>
<message>
<source>%1 in %2%3</source>
<translation>%1 in %2%3</translation>
</message>
<message numerus="yes">
<source>%n minute(s)</source>
<translation>
<numerusform>%n Minute</numerusform>
<numerusform>%n Minuten</numerusform>
</translation>
</message>
</context>
<context>
<name>config</name>
Expand Down
19 changes: 17 additions & 2 deletions plasmoid/translations/onboardplasmoid_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,33 @@ Notice: </source>
</message>
<message numerus="yes">
<source>%1 km/h | Departure in %2%n minute(s)</source>
<translation>
<translation type="vanished">
<numerusform>%1 km/h | Departure in %2%n minute</numerusform>
<numerusform>%1 km/h | Departure in %2%n minutes</numerusform>
</translation>
</message>
<message numerus="yes">
<source>%1 in %2%n minute(s)</source>
<translation>
<translation type="vanished">
<numerusform>%1 in %2%n minute</numerusform>
<numerusform>%1 in %2%n minutes</numerusform>
</translation>
</message>
<message>
<source>%1 km/h | Departure in %2%3</source>
<translation></translation>
</message>
<message>
<source>%1 in %2%3</source>
<translation></translation>
</message>
<message numerus="yes">
<source>%n minute(s)</source>
<translation>
<numerusform>%n minute</numerusform>
<numerusform>%n minutes</numerusform>
</translation>
</message>
</context>
<context>
<name>config</name>
Expand Down

0 comments on commit b44748c

Please sign in to comment.