From 7fe7ce67487516f39aa10b8857726e97dee031f2 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 8 Oct 2014 10:54:00 +0200 Subject: [PATCH] Another use of BMessageFormat for plural support. Spotted by Diver. Thanks! --- src/apps/haikudepot/ui/PackageListView.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/apps/haikudepot/ui/PackageListView.cpp b/src/apps/haikudepot/ui/PackageListView.cpp index 7eea276ad1..4496492dc0 100644 --- a/src/apps/haikudepot/ui/PackageListView.cpp +++ b/src/apps/haikudepot/ui/PackageListView.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -396,7 +397,6 @@ PackageColumn::CompareFields(BField* field1, BField* field2) } - float PackageColumn::GetPreferredWidth(BField *_field, BView* parent) const { @@ -610,10 +610,8 @@ private: BString _GetLabel() const { BString label; - if (fItemCount == 1) - label = B_TRANSLATE("1 item"); - else - label.SetToFormat(B_TRANSLATE("%ld items"), fItemCount); + BMessageFormat().Format(label, B_TRANSLATE("{0, plural, one{# item} " + "other{# items}}"), fItemCount); return label; }