From 729709ba879d1ab77d756f5b2a219d405e6a7053 Mon Sep 17 00:00:00 2001 From: Humdinger Date: Mon, 15 Jul 2019 10:15:30 +0200 Subject: [PATCH] HaikuDepot: Improved translatability using BStringFormat The string "(%count% more to download)" is sensitive to different plural forms in other languages. For example, in German one could have: "1 weiterer Download" and "12 weitere Downloads" Change-Id: I3ab98cca6ae5066f7558e9ce22c97b6c37ec4a9c Reviewed-on: https://review.haiku-os.org/c/1593 Reviewed-by: waddlesplash --- src/apps/haikudepot/ui/WorkStatusView.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/apps/haikudepot/ui/WorkStatusView.cpp b/src/apps/haikudepot/ui/WorkStatusView.cpp index 87b0376f3e..7e5ade2039 100644 --- a/src/apps/haikudepot/ui/WorkStatusView.cpp +++ b/src/apps/haikudepot/ui/WorkStatusView.cpp @@ -146,7 +146,7 @@ WorkStatusView::_SetTextPendingDownloads() { BString text; static BStringFormat format(B_TRANSLATE("{0, plural," - "one{1 package to download}" + "one{1 package to download}" "other{# packages to download}}")); format.Format(text, fPendingPackages.size()); @@ -161,11 +161,12 @@ WorkStatusView::_SetTextDownloading(const BString& title) text.ReplaceFirst("%name%", title); if (!fPendingPackages.empty()) { - BString count; - count << fPendingPackages.size(); - BString more(" "); - more += B_TRANSLATE("(%count% more to download)"); - more.ReplaceFirst("%count%", count); + BString more; + static BStringFormat format(B_TRANSLATE("{0, plural," + "one{(1 more to download)}" + "other{(# more to download)}}")); + format.Format(more, fPendingPackages.size()); + text += " "; text += more; } SetText(text);