[haiku-commits] Change in haiku[master]: Notifications prefs: Fixed pluralization

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 14 Jun 2020 16:09:51 +0000

From humdinger <humdingerb@xxxxxxxxx>:

humdinger has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2918 ;)


Change subject: Notifications prefs: Fixed pluralization
......................................................................

Notifications prefs: Fixed pluralization

Fixes #16119
---
M src/preferences/notifications/GeneralView.cpp
1 file changed, 10 insertions(+), 8 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/18/2918/1

diff --git a/src/preferences/notifications/GeneralView.cpp 
b/src/preferences/notifications/GeneralView.cpp
index bde3688..d37fe8c 100644
--- a/src/preferences/notifications/GeneralView.cpp
+++ b/src/preferences/notifications/GeneralView.cpp
@@ -27,6 +27,7 @@
 #include <Query.h>
 #include <Roster.h>
 #include <String.h>
+#include <StringFormat.h>
 #include <SymLink.h>
 #include <Volume.h>
 #include <VolumeRoster.h>
@@ -347,10 +348,11 @@
 void
 GeneralView::_SetTimeoutLabel(int32 value)
 {
-       BString label(B_TRANSLATE("Timeout:"));
-       label.Append(" ");
-       label << value;
-       label.Append(" ").Append(B_TRANSLATE("seconds"));
+       static BStringFormat format(B_TRANSLATE("{0, plural, "
+               "=1{Timeout: # second}"
+               "other{Timeout: # seconds}}"));
+       BString label;
+       format.Format(label, value);
        fDurationSlider->SetLabel(label.String());
 }

@@ -358,10 +360,10 @@
 void
 GeneralView::_SetWidthLabel(int32 value)
 {
-       BString label(B_TRANSLATE("Width:"));
-       label.Append(" ");
-       label << value;
-       label.Append(" ").Append(B_TRANSLATE("pixels"));
+       BString width;
+       width << value;
+       BString label(B_TRANSLATE("Width: %x% pixels"));
+       label.ReplaceFirst("%x%", width);
        fWidthSlider->SetLabel(label.String());
 }


--
To view, visit https://review.haiku-os.org/c/haiku/+/2918
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ie23f1ab52f46fde12479ba47934c247e37f367a6
Gerrit-Change-Number: 2918
Gerrit-PatchSet: 1
Gerrit-Owner: humdinger <humdingerb@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts: