apps/softwareupdater localization improvement Bug #14526

* Use BStringFormat to allow better translations of
   strings in alert

 * Reorganise alert: shorten title length, move number of
   updates into alert text

 * (code formatting) trailing whitespace removal

Change-Id: Ib239564c26a48225f97f9beb79537e82cc206af5
Reviewed-on: https://review.haiku-os.org/c/1023
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Rob Gill
2019-02-10 10:06:44 +00:00
committed by Stephan Aßmus
parent 1e82c5d927
commit c306c63c13
+11 -5
View File
@@ -24,6 +24,7 @@
#include <NodeInfo.h> #include <NodeInfo.h>
#include <Notification.h> #include <Notification.h>
#include <Roster.h> #include <Roster.h>
#include <StringFormat.h>
#include <package/manager/Exceptions.h> #include <package/manager/Exceptions.h>
#include <package/solver/SolverPackage.h> #include <package/solver/SolverPackage.h>
@@ -152,11 +153,16 @@ CheckManager::ConfirmChanges(bool fromMostSpecific)
printf("Update count=%" B_PRId32 "\n", updateCount); printf("Update count=%" B_PRId32 "\n", updateCount);
if (updateCount > 0) { if (updateCount > 0) {
BString title(B_TRANSLATE("%count% packages have available updates")); BString title;
BString count; static BStringFormat formatTitle(B_TRANSLATE(
count << updateCount; "Software {0, plural, one{update} other{updates}} available"));
title.ReplaceFirst("%count%", count); formatTitle.Format(title, updateCount);
BString text(B_TRANSLATE("Click here to install updates.")); BString text;
static BStringFormat formatText(B_TRANSLATE("Click here to "
"install {0, plural, one{# updated package} "
"other{# updated packages}}."));
formatText.Format(text, updateCount);
_SendNotification(title.String(), text.String()); _SendNotification(title.String(), text.String());
} }
throw BAbortedByUserException(); throw BAbortedByUserException();