Updated to use B_TRANSLATE* macros. relates to #5408.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36697 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-05-07 00:30:00 +00:00
parent dccc528d64
commit 733c3ae489
2 changed files with 39 additions and 32 deletions
@@ -64,9 +64,10 @@ byte_string(int64 size)
static char string[256]; static char string[256];
if (value < 1024) if (value < 1024)
snprintf(string, sizeof(string), TR("%Ld B"), size); snprintf(string, sizeof(string), B_TRANSLATE("%Ld B"), size);
else { else {
static const char *units[] = {TR_MARK("KB"), TR_MARK("MB"), TR_MARK("GB"), NULL}; static const char *units[] = {B_TRANSLATE_MARK("KB"),
B_TRANSLATE_MARK("MB"), B_TRANSLATE_MARK("GB"), NULL};
int32 i = -1; int32 i = -1;
do { do {
@@ -75,7 +76,7 @@ byte_string(int64 size)
} while (value >= 1024 && units[i + 1]); } while (value >= 1024 && units[i + 1]);
off_t rounded = off_t(value * 100LL); off_t rounded = off_t(value * 100LL);
sprintf(string, "%g %s", rounded / 100.0, TR(units[i])); sprintf(string, "%g %s", rounded / 100.0, B_TRANSLATE(units[i]));
} }
return string; return string;
@@ -112,14 +113,14 @@ SizeSlider::UpdateText() const
SettingsWindow::SettingsWindow() SettingsWindow::SettingsWindow()
: BWindow(BRect(0, 0, 269, 172), TR("VirtualMemory"), B_TITLED_WINDOW, : BWindow(BRect(0, 0, 269, 172), B_TRANSLATE("VirtualMemory"),
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS
| B_AUTO_UPDATE_SIZE_LIMITS) | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{ {
BView* view = new BGroupView(); BView* view = new BGroupView();
fSwapEnabledCheckBox = new BCheckBox("enable swap", fSwapEnabledCheckBox = new BCheckBox("enable swap",
TR("Enable virtual memory"), B_TRANSLATE("Enable virtual memory"),
new BMessage(kMsgSwapEnabledUpdate)); new BMessage(kMsgSwapEnabledUpdate));
fSwapEnabledCheckBox->SetValue(fSettings.SwapEnabled()); fSwapEnabledCheckBox->SetValue(fSettings.SwapEnabled());
@@ -129,11 +130,11 @@ SettingsWindow::SettingsWindow()
system_info info; system_info info;
get_system_info(&info); get_system_info(&info);
BString string = TR("Physical memory: "); BString string = B_TRANSLATE("Physical memory: ");
string << byte_string((off_t)info.max_pages * B_PAGE_SIZE); string << byte_string((off_t)info.max_pages * B_PAGE_SIZE);
BStringView* memoryView = new BStringView("physical memory", string.String()); BStringView* memoryView = new BStringView("physical memory", string.String());
string = TR("Current swap file size: "); string = B_TRANSLATE("Current swap file size: ");
string << byte_string(fSettings.SwapSize()); string << byte_string(fSettings.SwapSize());
BStringView* swapfileView = new BStringView("current swap size", string.String()); BStringView* swapfileView = new BStringView("current swap size", string.String());
@@ -157,23 +158,25 @@ SettingsWindow::SettingsWindow()
item->SetMarked(true); item->SetMarked(true);
} }
BMenuField* field = new BMenuField("devices", TR("Use volume:"), menu); BMenuField* field = new BMenuField("devices", B_TRANSLATE("Use volume:"),
menu);
field->SetEnabled(false); field->SetEnabled(false);
off_t minSize, maxSize; off_t minSize, maxSize;
_GetSwapFileLimits(minSize, maxSize); _GetSwapFileLimits(minSize, maxSize);
fSizeSlider = new SizeSlider("size slider", TR("Requested swap file size:"), fSizeSlider = new SizeSlider("size slider",
B_TRANSLATE("Requested swap file size:"),
new BMessage(kMsgSliderUpdate), minSize / kMegaByte, maxSize / kMegaByte, new BMessage(kMsgSliderUpdate), minSize / kMegaByte, maxSize / kMegaByte,
B_WILL_DRAW | B_FRAME_EVENTS); B_WILL_DRAW | B_FRAME_EVENTS);
fSizeSlider->SetLimitLabels(TR("999 MB"), TR("999 MB")); fSizeSlider->SetLimitLabels(B_TRANSLATE("999 MB"), B_TRANSLATE("999 MB"));
fSizeSlider->SetViewColor(255, 0, 255); fSizeSlider->SetViewColor(255, 0, 255);
fWarningStringView = new BStringView("", ""); fWarningStringView = new BStringView("", "");
fWarningStringView->SetAlignment(B_ALIGN_CENTER); fWarningStringView->SetAlignment(B_ALIGN_CENTER);
view->SetLayout(new BGroupLayout(B_HORIZONTAL)); view->SetLayout(new BGroupLayout(B_HORIZONTAL));
view->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) view->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.AddGroup(B_HORIZONTAL) .AddGroup(B_HORIZONTAL)
.Add(memoryView) .Add(memoryView)
.AddGlue() .AddGlue()
@@ -194,22 +197,24 @@ SettingsWindow::SettingsWindow()
// Add "Defaults" and "Revert" buttons // Add "Defaults" and "Revert" buttons
fDefaultsButton = new BButton("defaults", TR("Defaults"), new BMessage(kMsgDefaults)); fDefaultsButton = new BButton("defaults", B_TRANSLATE("Defaults"),
new BMessage(kMsgDefaults));
fDefaultsButton->SetEnabled(fSettings.IsDefaultable()); fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
fRevertButton = new BButton("revert", TR("Revert"), new BMessage(kMsgRevert)); fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
new BMessage(kMsgRevert));
fRevertButton->SetEnabled(false); fRevertButton->SetEnabled(false);
SetLayout(new BGroupLayout(B_HORIZONTAL)); SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(box) .Add(box)
.AddGroup(B_HORIZONTAL, 10) .AddGroup(B_HORIZONTAL, 10)
.Add(fDefaultsButton) .Add(fDefaultsButton)
.Add(fRevertButton) .Add(fRevertButton)
.AddGlue() .AddGlue()
.End() .End()
.SetInsets(10, 10, 10, 10) .SetInsets(10, 10, 10, 10)
); );
_Update(); _Update();
@@ -265,7 +270,8 @@ SettingsWindow::_Update()
if (fRevertButton->IsEnabled() != changed) { if (fRevertButton->IsEnabled() != changed) {
fRevertButton->SetEnabled(changed); fRevertButton->SetEnabled(changed);
if (changed) if (changed)
fWarningStringView->SetText(TR("Changes will take effect on restart!")); fWarningStringView->SetText(
B_TRANSLATE("Changes will take effect on restart!"));
else else
fWarningStringView->SetText(""); fWarningStringView->SetText("");
} }
@@ -339,12 +345,13 @@ SettingsWindow::MessageReceived(BMessage* message)
// as Be did, but I thought a proper warning could be helpful // as Be did, but I thought a proper warning could be helpful
// (for those that want to change that anyway) // (for those that want to change that anyway)
int32 choice = (new BAlert("VirtualMemory", int32 choice = (new BAlert("VirtualMemory",
TR("Disabling virtual memory will have unwanted effects on " B_TRANSLATE(
"Disabling virtual memory will have unwanted effects on "
"system stability once the memory is used up.\n" "system stability once the memory is used up.\n"
"Virtual memory does not affect system performance " "Virtual memory does not affect system performance "
"until this point is reached.\n\n" "until this point is reached.\n\n"
"Are you really sure you want to turn it off?"), "Are you really sure you want to turn it off?"),
TR("Turn off"), TR("Keep enabled"), NULL, B_TRANSLATE("Turn off"), B_TRANSLATE("Keep enabled"), NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
if (choice == 1) { if (choice == 1) {
fSwapEnabledCheckBox->SetValue(1); fSwapEnabledCheckBox->SetValue(1);
@@ -38,9 +38,9 @@ VirtualMemory::ReadyToRun()
void void
VirtualMemory::AboutRequested() VirtualMemory::AboutRequested()
{ {
BAlert* alert = new BAlert("about", TR("VirtualMemory\n" BAlert* alert = new BAlert("about", B_TRANSLATE("VirtualMemory\n"
"\twritten by Axel Dörfler\n" "\twritten by Axel Dörfler\n"
"\tCopyright 2005, Haiku.\n"), TR("OK")); "\tCopyright 2005, Haiku.\n"), B_TRANSLATE("OK"));
BTextView* view = alert->TextView(); BTextView* view = alert->TextView();
BFont font; BFont font;
@@ -48,7 +48,7 @@ VirtualMemory::AboutRequested()
view->GetFont(&font); view->GetFont(&font);
font.SetSize(18); font.SetSize(18);
font.SetFace(B_BOLD_FACE); font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, 13, &font); view->SetFontAndColor(0, 13, &font);
alert->Go(); alert->Go();