More uses of BMessageFormat.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <Catalog.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <MessageFormat.h>
|
||||
#include <Node.h>
|
||||
#include <String.h>
|
||||
#include <StringForSize.h>
|
||||
@@ -83,7 +84,7 @@ StatusView::StatusView()
|
||||
.Add(fCountView)
|
||||
.Add(divider2)
|
||||
.Add(fSizeView)
|
||||
.End()
|
||||
.End()
|
||||
.End()
|
||||
.AddStrut(kSmallHMargin)
|
||||
.Add(fRefreshBtn)
|
||||
@@ -150,9 +151,9 @@ StatusView::ShowInfo(const FileInfo* info)
|
||||
fSizeView->SetText(label);
|
||||
|
||||
if (info->count > 0) {
|
||||
char label[256];
|
||||
snprintf(label, sizeof(label), (info->count == 1) ?
|
||||
B_TRANSLATE("%d file") : B_TRANSLATE("%d files"), info->count);
|
||||
BString label;
|
||||
BMessageFormat().Format(label, B_TRANSLATE("{0, plural, one{# file}, "
|
||||
"other{# files}}"), info->count);
|
||||
fCountView->SetText(label);
|
||||
} else {
|
||||
fCountView->SetText(kEmptyStr);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <Locale.h>
|
||||
#include <MenuItem.h>
|
||||
#include <MenuField.h>
|
||||
#include <MessageFormat.h>
|
||||
#include <Path.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Screen.h>
|
||||
@@ -828,17 +829,16 @@ TInfoView::Draw(BRect updateRect)
|
||||
|
||||
MovePenTo(10, fFontHeight + 5);
|
||||
|
||||
BString dimensionsInfo(
|
||||
B_TRANSLATE("%width x %height @ %pixelSize pixels/pixel"));
|
||||
BString dimensionsInfo;
|
||||
BMessageFormat().Format(dimensionsInfo,
|
||||
B_TRANSLATE("%width x %height @ {0, plural, one{# pixel/pixel} "
|
||||
"other{# pixels/pixel}}"), pixelSize);
|
||||
BString rep;
|
||||
rep << hPixelCount;
|
||||
dimensionsInfo.ReplaceAll("%width", rep);
|
||||
rep = "";
|
||||
rep << vPixelCount;
|
||||
dimensionsInfo.ReplaceAll("%height", rep);
|
||||
rep = "";
|
||||
rep << pixelSize;
|
||||
dimensionsInfo.ReplaceAll("%pixelSize", rep);
|
||||
invalRect.Set(10, 5, 10 + StringWidth(fInfoStr), fFontHeight+7);
|
||||
SetHighColor(ViewColor());
|
||||
FillRect(invalRect);
|
||||
|
||||
Reference in New Issue
Block a user