More BMessageFormat rework.

I'm stopping this now, I heard we want to leave those as GCI tasks.
This commit is contained in:
Adrien Destugues
2014-10-08 17:26:12 +02:00
parent 961fdd8cc3
commit 4b947a07d3
2 changed files with 12 additions and 14 deletions
@@ -21,6 +21,7 @@
#include <GroupLayout.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <MessageFormat.h>
#include <Path.h>
#include <Roster.h>
#include <Screen.h>
@@ -151,17 +152,12 @@ ZippoWindow::MessageReceived(BMessage* message)
// being created (added to) or if we're updating an
// already existing archive.
static BMessageFormat format(B_TRANSLATE("{0, plural, "
"one{# file added.} other{# files added.}}"));
BString output;
fFileCount++;
BString count;
count << fFileCount;
format.Format(output, fFileCount);
if (fFileCount == 1) {
output << B_TRANSLATE("1 file added.");
} else {
output << B_TRANSLATE("%ld files added.");
output.ReplaceFirst("%ld", count.String());
}
fFileCount++;
fZipOutputView->SetText(output.String());
} else {
@@ -21,6 +21,7 @@
#include <Locale.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <MessageFormat.h>
#include <Mime.h>
#include <NodeInfo.h>
#include <Path.h>
@@ -353,11 +354,12 @@ ApplicationTypesWindow::_RemoveUninstalled()
progressWindow->PostMessage(B_QUIT_REQUESTED);
char message[512];
// TODO: Use ICU to properly format this.
snprintf(message, sizeof(message),
B_TRANSLATE("%ld Application type%s could be removed."),
removed, removed == 1 ? "" : "s");
static BMessageFormat format(B_TRANSLATE("{0, plural, "
"one{# Application type could be removed} "
"other{# Application types could be removed}}"));
BString message;
format.Format(message, removed);
error_alert(message, B_OK, B_INFO_ALERT);
}