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 <GroupLayout.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <Locale.h> #include <Locale.h>
#include <MessageFormat.h>
#include <Path.h> #include <Path.h>
#include <Roster.h> #include <Roster.h>
#include <Screen.h> #include <Screen.h>
@@ -151,17 +152,12 @@ ZippoWindow::MessageReceived(BMessage* message)
// being created (added to) or if we're updating an // being created (added to) or if we're updating an
// already existing archive. // already existing archive.
static BMessageFormat format(B_TRANSLATE("{0, plural, "
"one{# file added.} other{# files added.}}"));
BString output; BString output;
fFileCount++; format.Format(output, fFileCount);
BString count;
count << fFileCount;
if (fFileCount == 1) { fFileCount++;
output << B_TRANSLATE("1 file added.");
} else {
output << B_TRANSLATE("%ld files added.");
output.ReplaceFirst("%ld", count.String());
}
fZipOutputView->SetText(output.String()); fZipOutputView->SetText(output.String());
} else { } else {
@@ -21,6 +21,7 @@
#include <Locale.h> #include <Locale.h>
#include <MenuField.h> #include <MenuField.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <MessageFormat.h>
#include <Mime.h> #include <Mime.h>
#include <NodeInfo.h> #include <NodeInfo.h>
#include <Path.h> #include <Path.h>
@@ -353,11 +354,12 @@ ApplicationTypesWindow::_RemoveUninstalled()
progressWindow->PostMessage(B_QUIT_REQUESTED); progressWindow->PostMessage(B_QUIT_REQUESTED);
char message[512]; static BMessageFormat format(B_TRANSLATE("{0, plural, "
// TODO: Use ICU to properly format this. "one{# Application type could be removed} "
snprintf(message, sizeof(message), "other{# Application types could be removed}}"));
B_TRANSLATE("%ld Application type%s could be removed."), BString message;
removed, removed == 1 ? "" : "s"); format.Format(message, removed);
error_alert(message, B_OK, B_INFO_ALERT); error_alert(message, B_OK, B_INFO_ALERT);
} }