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

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36694 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-05-07 00:19:15 +00:00
parent f7ff55f1d4
commit cd59396f27
4 changed files with 81 additions and 71 deletions
+39 -39
View File
@@ -41,7 +41,7 @@
AddPrinterDialog::AddPrinterDialog(BWindow *parent) AddPrinterDialog::AddPrinterDialog(BWindow *parent)
: :
Inherited(BRect(78.0, 71.0, 400, 300), TR("Add printer"), Inherited(BRect(78.0, 71.0, 400, 300), B_TRANSLATE("Add printer"),
B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fPrintersPrefletMessenger(parent) fPrintersPrefletMessenger(parent)
@@ -64,29 +64,29 @@ void
AddPrinterDialog::MessageReceived(BMessage* msg) AddPrinterDialog::MessageReceived(BMessage* msg)
{ {
switch(msg->what) { switch(msg->what) {
case B_OK: case B_OK:
AddPrinter(msg); AddPrinter(msg);
PostMessage(B_QUIT_REQUESTED); PostMessage(B_QUIT_REQUESTED);
break; break;
case B_CANCEL: case B_CANCEL:
PostMessage(B_QUIT_REQUESTED); PostMessage(B_QUIT_REQUESTED);
break; break;
case kNameChangedMsg: case kNameChangedMsg:
fNameText = fName->Text(); fNameText = fName->Text();
Update(); Update();
break; break;
case kPrinterSelectedMsg: case kPrinterSelectedMsg:
StorePrinter(msg); StorePrinter(msg);
break; break;
case kTransportSelectedMsg: case kTransportSelectedMsg:
HandleChangedTransport(msg); HandleChangedTransport(msg);
break; break;
default: default:
Inherited::MessageReceived(msg); Inherited::MessageReceived(msg);
} }
@@ -99,8 +99,8 @@ AddPrinterDialog::AddPrinter(BMessage *msg)
BMessage m(PSRV_MAKE_PRINTER); BMessage m(PSRV_MAKE_PRINTER);
BMessenger msgr; BMessenger msgr;
if (GetPrinterServerMessenger(msgr) != B_OK) if (GetPrinterServerMessenger(msgr) != B_OK)
return; return;
BString transport; BString transport;
BString transportPath; BString transportPath;
if (fPrinterText != "Preview") { if (fPrinterText != "Preview") {
@@ -108,10 +108,10 @@ AddPrinterDialog::AddPrinter(BMessage *msg)
transport = fTransportText; transport = fTransportText;
transportPath = fTransportPathText; transportPath = fTransportPathText;
} }
m.AddString("driver", fPrinterText.String()); m.AddString("driver", fPrinterText.String());
m.AddString("transport", transport.String()); m.AddString("transport", transport.String());
m.AddString("transport path", transportPath.String()); m.AddString("transport path", transportPath.String());
m.AddString("printer name", fNameText.String()); m.AddString("printer name", fNameText.String());
m.AddString("connection", "Local"); m.AddString("connection", "Local");
msgr.SendMessage(&m); msgr.SendMessage(&m);
@@ -125,7 +125,7 @@ AddPrinterDialog::StorePrinter(BMessage *msg)
BString name; BString name;
if (msg->FindString("name", &name) != B_OK) if (msg->FindString("name", &name) != B_OK)
name = ""; name = "";
fPrinterText = name; fPrinterText = name;
Update(); Update();
} }
@@ -137,9 +137,9 @@ AddPrinterDialog::HandleChangedTransport(BMessage *msg)
BString name; BString name;
if (msg->FindString("name", &name) != B_OK) { if (msg->FindString("name", &name) != B_OK) {
name = ""; name = "";
} }
fTransportText = name; fTransportText = name;
BString path; BString path;
if (msg->FindString("path", &path) == B_OK) { if (msg->FindString("path", &path) == B_OK) {
// transport path selected // transport path selected
@@ -163,14 +163,14 @@ AddPrinterDialog::HandleChangedTransport(BMessage *msg)
} else { } else {
// transport selected // transport selected
fTransportPathText = ""; fTransportPathText = "";
// remove mark from item in sub menu of transport sub menu // remove mark from item in sub menu of transport sub menu
for (int32 i = fTransport->CountItems()-1; i >= 0; i --) { for (int32 i = fTransport->CountItems()-1; i >= 0; i --) {
BMenu* menu = fTransport->SubmenuAt(i); BMenu* menu = fTransport->SubmenuAt(i);
if (menu != NULL) { if (menu != NULL) {
BMenuItem* item = menu->FindMarked(); BMenuItem* item = menu->FindMarked();
if (item != NULL) if (item != NULL)
item->SetMarked(false); item->SetMarked(false);
} }
} }
} }
@@ -182,32 +182,32 @@ void
AddPrinterDialog::BuildGUI(int stage) AddPrinterDialog::BuildGUI(int stage)
{ {
// add a "printer name" input field // add a "printer name" input field
fName = new BTextControl("printer_name", TR("Printer name:"), B_EMPTY_STRING, fName = new BTextControl("printer_name", B_TRANSLATE("Printer name:"),
NULL); B_EMPTY_STRING, NULL);
fName->SetFont(be_bold_font); fName->SetFont(be_bold_font);
fName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); fName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
fName->SetModificationMessage(new BMessage(kNameChangedMsg)); fName->SetModificationMessage(new BMessage(kNameChangedMsg));
// add a "driver" popup menu field // add a "driver" popup menu field
fPrinter = new BPopUpMenu(TR("<pick one>")); fPrinter = new BPopUpMenu(B_TRANSLATE("<pick one>"));
BMenuField *printerMenuField = new BMenuField("drivers_list", BMenuField *printerMenuField = new BMenuField("drivers_list",
TR("Printer type:"), fPrinter); B_TRANSLATE("Printer type:"), fPrinter);
printerMenuField->SetAlignment(B_ALIGN_RIGHT); printerMenuField->SetAlignment(B_ALIGN_RIGHT);
FillMenu(fPrinter, "Print", kPrinterSelectedMsg); FillMenu(fPrinter, "Print", kPrinterSelectedMsg);
// add a "connected to" (aka transports list) menu field // add a "connected to" (aka transports list) menu field
fTransport = new BPopUpMenu(TR("<pick one>")); fTransport = new BPopUpMenu(B_TRANSLATE("<pick one>"));
BMenuField *transportMenuField = new BMenuField("transports_list", BMenuField *transportMenuField = new BMenuField("transports_list",
TR("Connected to:"), fTransport); B_TRANSLATE("Connected to:"), fTransport);
transportMenuField->SetAlignment(B_ALIGN_RIGHT); transportMenuField->SetAlignment(B_ALIGN_RIGHT);
FillTransportMenu(fTransport); FillTransportMenu(fTransport);
// add a "OK" button // add a "OK" button
fOk = new BButton(NULL, TR("Add"), new BMessage((uint32)B_OK), fOk = new BButton(NULL, B_TRANSLATE("Add"), new BMessage((uint32)B_OK),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
// add a "Cancel button // add a "Cancel button
BButton *cancel = new BButton(NULL, TR("Cancel"), new BMessage(B_CANCEL)); BButton *cancel = new BButton(NULL, B_TRANSLATE("Cancel"), new BMessage(B_CANCEL));
SetLayout(new BGridLayout()); SetLayout(new BGridLayout());
@@ -230,7 +230,7 @@ AddPrinterDialog::BuildGUI(int stage)
fOk->MakeDefault(true); fOk->MakeDefault(true);
fName->MakeFocus(true); fName->MakeFocus(true);
Update(); Update();
// Stage == 0 // Stage == 0
// init_icon 64x114 Add a Local or Network Printer // init_icon 64x114 Add a Local or Network Printer
@@ -298,14 +298,14 @@ AddPrinterDialog::FillMenu(BMenu* menu, const char* path, uint32 what)
BPath addonPath; BPath addonPath;
if (find_directory(gAddonDirs[i], &addonPath) != B_OK) if (find_directory(gAddonDirs[i], &addonPath) != B_OK)
continue; continue;
if (addonPath.Append(path) != B_OK) if (addonPath.Append(path) != B_OK)
continue; continue;
BDirectory dir(addonPath.Path()); BDirectory dir(addonPath.Path());
if (dir.InitCheck() != B_OK) if (dir.InitCheck() != B_OK)
continue; continue;
BEntry entry; BEntry entry;
while (dir.GetNextEntry(&entry, true) == B_OK) { while (dir.GetNextEntry(&entry, true) == B_OK) {
if (!entry.IsFile()) if (!entry.IsFile())
@@ -400,9 +400,9 @@ void AddPrinterDialog::FillTransportMenu(BMenu* menu)
void void
AddPrinterDialog::Update() AddPrinterDialog::Update()
{ {
fOk->SetEnabled(fNameText != "" && fPrinterText != "" && fOk->SetEnabled(fNameText != "" && fPrinterText != "" &&
(fTransportText != "" || fPrinterText == "Preview")); (fTransportText != "" || fPrinterText == "Preview"));
fTransport->SetEnabled(fPrinterText != "Preview"); fTransport->SetEnabled(fPrinterText != "Preview");
} }
+9 -9
View File
@@ -223,41 +223,41 @@ JobItem::Update()
B_INT32_TYPE, 0, &pages, sizeof(pages)) == sizeof(pages)) { B_INT32_TYPE, 0, &pages, sizeof(pages)) == sizeof(pages)) {
fPages << pages; fPages << pages;
if (pages > 1) if (pages > 1)
fPages << " " << TR("pages") << "."; fPages << " " << B_TRANSLATE("pages") << ".";
else else
fPages << " " << TR("page") << "."; fPages << " " << B_TRANSLATE("page") << ".";
} else { } else {
fPages << "??? " << TR("pages") << "."; fPages << "??? " << B_TRANSLATE("pages") << ".";
} }
fSize = ""; fSize = "";
off_t size; off_t size;
if (node.GetSize(&size) == B_OK) { if (node.GetSize(&size) == B_OK) {
char buffer[80]; char buffer[80];
sprintf(buffer, TR("%.2f KB"), size / 1024.0); sprintf(buffer, B_TRANSLATE("%.2f KB"), size / 1024.0);
fSize = buffer; fSize = buffer;
} }
fStatus = ""; fStatus = "";
switch (fJob->Status()) { switch (fJob->Status()) {
case kWaiting: case kWaiting:
fStatus = TR("Waiting"); fStatus = B_TRANSLATE("Waiting");
break; break;
case kProcessing: case kProcessing:
fStatus = TR("Processing"); fStatus = B_TRANSLATE("Processing");
break; break;
case kFailed: case kFailed:
fStatus = TR("Failed"); fStatus = B_TRANSLATE("Failed");
break; break;
case kCompleted: case kCompleted:
fStatus = TR("Completed"); fStatus = B_TRANSLATE("Completed");
break; break;
default: default:
fStatus = TR("Unknown status"); fStatus = B_TRANSLATE("Unknown status");
} }
} }
+5 -5
View File
@@ -377,7 +377,7 @@ void PrinterItem::DrawItem(BView *owner, BRect /*bounds*/, bool complete)
BPoint driverPt(iconPt + BPoint(x, fntheight * 2.0)); BPoint driverPt(iconPt + BPoint(x, fntheight * 2.0));
BPoint defaultPt(iconPt + BPoint(x, fntheight * 3.0)); BPoint defaultPt(iconPt + BPoint(x, fntheight * 3.0));
float width = owner->StringWidth(TR("No pending jobs.")); float width = owner->StringWidth(B_TRANSLATE("No pending jobs."));
BPoint pendingPt(bounds.right - width - 8.0, namePt.y); BPoint pendingPt(bounds.right - width - 8.0, namePt.y);
BPoint transportPt(bounds.right - width - 8.0, driverPt.y); BPoint transportPt(bounds.right - width - 8.0, driverPt.y);
BPoint commentPt(bounds.right - width - 8.0, defaultPt.y); BPoint commentPt(bounds.right - width - 8.0, defaultPt.y);
@@ -393,7 +393,7 @@ void PrinterItem::DrawItem(BView *owner, BRect /*bounds*/, bool complete)
if (sSelectedIcon && sSelectedIcon->IsValid()) if (sSelectedIcon && sSelectedIcon->IsValid())
owner->DrawBitmap(sSelectedIcon, iconPt); owner->DrawBitmap(sSelectedIcon, iconPt);
else else
owner->DrawString(TR("Default Printer"), defaultPt); owner->DrawString(B_TRANSLATE("Default Printer"), defaultPt);
} else { } else {
if (sIcon && sIcon->IsValid()) if (sIcon && sIcon->IsValid())
owner->DrawBitmap(sIcon, iconPt); owner->DrawBitmap(sIcon, iconPt);
@@ -459,12 +459,12 @@ PrinterItem::UpdatePendingJobs()
if (fFolder) { if (fFolder) {
uint32 pendingJobs = fFolder->CountJobs(); uint32 pendingJobs = fFolder->CountJobs();
if (pendingJobs == 1) { if (pendingJobs == 1) {
fPendingJobs = TR("1 pending job."); fPendingJobs = B_TRANSLATE("1 pending job.");
return; return;
} else if (pendingJobs > 1) { } else if (pendingJobs > 1) {
fPendingJobs << pendingJobs << TR(" pending jobs."); fPendingJobs << pendingJobs << B_TRANSLATE(" pending jobs.");
return; return;
} }
} }
fPendingJobs = TR("No pending jobs."); fPendingJobs = B_TRANSLATE("No pending jobs.");
} }
+28 -18
View File
@@ -1,8 +1,8 @@
/*****************************************************************************/ /*****************************************************************************/
// Printers Preference Application. // Printers Preference Application.
// //
// This application and all source files used in its construction, except // This application and all source files used in its construction, except
// where noted, are licensed under the MIT License, and have been written // where noted, are licensed under the MIT License, and have been written
// and are: // and are:
// //
// Copyright (c) 2001-2003 OpenBeOS Project // Copyright (c) 2001-2003 OpenBeOS Project
@@ -10,18 +10,18 @@
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation // to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, // the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the // and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions: // Software is furnished to do so, subject to the following conditions:
// //
// The above copyright notice and this permission notice shall be included // The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software. // in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
/*****************************************************************************/ /*****************************************************************************/
@@ -52,7 +52,8 @@
PrintersWindow::PrintersWindow(BRect frame) PrintersWindow::PrintersWindow(BRect frame)
: :
Inherited(BRect(78.0, 71.0, 561.0, 409.0), TR("Printers"), B_TITLED_WINDOW, 0), Inherited(BRect(78.0, 71.0, 561.0, 409.0), B_TRANSLATE("Printers"),
B_TITLED_WINDOW, 0),
fSelectedPrinter(NULL), fSelectedPrinter(NULL),
fAddingPrinter(false) fAddingPrinter(false)
{ {
@@ -82,14 +83,16 @@ PrintersWindow::MessageReceived(BMessage* msg)
fSelectedPrinter = fPrinterListView->SelectedItem(); fSelectedPrinter = fPrinterListView->SelectedItem();
if (fSelectedPrinter) if (fSelectedPrinter)
{ {
fJobsBox->SetLabel((BString(TR("Print jobs for ")) << fSelectedPrinter->Name()).String()); fJobsBox->SetLabel((BString(B_TRANSLATE("Print jobs for ")) <<
fSelectedPrinter->Name()).String());
fMakeDefault->SetEnabled(true); fMakeDefault->SetEnabled(true);
fRemove->SetEnabled(true); fRemove->SetEnabled(true);
fJobListView->SetSpoolFolder(fSelectedPrinter->Folder()); fJobListView->SetSpoolFolder(fSelectedPrinter->Folder());
} }
else else
{ {
fJobsBox->SetLabel(TR("Print jobs: No printer selected")); fJobsBox->SetLabel(
B_TRANSLATE("Print jobs: No printer selected"));
fMakeDefault->SetEnabled(false); fMakeDefault->SetEnabled(false);
fRemove->SetEnabled(false); fRemove->SetEnabled(false);
fSelectedPrinter = NULL; fSelectedPrinter = NULL;
@@ -106,7 +109,7 @@ PrintersWindow::MessageReceived(BMessage* msg)
new AddPrinterDialog(this); new AddPrinterDialog(this);
} }
break; break;
case kMsgAddPrinterClosed: case kMsgAddPrinterClosed:
fAddingPrinter = false; fAddingPrinter = false;
break; break;
@@ -183,21 +186,23 @@ PrintersWindow::BuildGUI()
BBox* printersBox = new BBox(BRect(boxInset, boxInset, r.Width()-boxInset, (r.Height()/2) - (boxInset/2)), BBox* printersBox = new BBox(BRect(boxInset, boxInset, r.Width()-boxInset, (r.Height()/2) - (boxInset/2)),
"printersBox", B_FOLLOW_ALL); "printersBox", B_FOLLOW_ALL);
printersBox->SetFont(be_bold_font); printersBox->SetFont(be_bold_font);
printersBox->SetLabel(TR("Printers")); printersBox->SetLabel(B_TRANSLATE("Printers"));
backdrop->AddChild(printersBox); backdrop->AddChild(printersBox);
// Width of largest button // Width of largest button
float maxWidth = 0; float maxWidth = 0;
// Add Button // Add Button
BButton* addButton = new BButton(BRect(5,5,5,5), "add", TR("Add …"), new BMessage(kMsgAddPrinter), B_FOLLOW_RIGHT); BButton* addButton = new BButton(BRect(5,5,5,5), "add",
B_TRANSLATE("Add …"), new BMessage(kMsgAddPrinter), B_FOLLOW_RIGHT);
printersBox->AddChild(addButton); printersBox->AddChild(addButton);
addButton->ResizeToPreferred(); addButton->ResizeToPreferred();
maxWidth = addButton->Bounds().Width(); maxWidth = addButton->Bounds().Width();
// Remove button // Remove button
fRemove = new BButton(BRect(5,30,5,30), "remove", TR("Remove"), new BMessage(kMsgRemovePrinter), B_FOLLOW_RIGHT); fRemove = new BButton(BRect(5,30,5,30), "remove",
B_TRANSLATE("Remove"), new BMessage(kMsgRemovePrinter), B_FOLLOW_RIGHT);
printersBox->AddChild(fRemove); printersBox->AddChild(fRemove);
fRemove->ResizeToPreferred(); fRemove->ResizeToPreferred();
@@ -205,7 +210,8 @@ PrintersWindow::BuildGUI()
maxWidth = fRemove->Bounds().Width(); maxWidth = fRemove->Bounds().Width();
// Make Default button // Make Default button
fMakeDefault = new BButton(BRect(5,60,5,60), "default", TR("Make default"), new BMessage(kMsgMakeDefaultPrinter), B_FOLLOW_RIGHT); fMakeDefault = new BButton(BRect(5,60,5,60), "default",
B_TRANSLATE("Make default"), new BMessage(kMsgMakeDefaultPrinter), B_FOLLOW_RIGHT);
printersBox->AddChild(fMakeDefault); printersBox->AddChild(fMakeDefault);
fMakeDefault->ResizeToPreferred(); fMakeDefault->ResizeToPreferred();
@@ -241,11 +247,13 @@ PrintersWindow::BuildGUI()
fJobsBox = new BBox(BRect(boxInset, (r.Height()/2)+(boxInset/2), Bounds().Width()-10, Bounds().Height() - boxInset), fJobsBox = new BBox(BRect(boxInset, (r.Height()/2)+(boxInset/2), Bounds().Width()-10, Bounds().Height() - boxInset),
"jobsBox", B_FOLLOW_LEFT_RIGHT+B_FOLLOW_BOTTOM); "jobsBox", B_FOLLOW_LEFT_RIGHT+B_FOLLOW_BOTTOM);
fJobsBox->SetFont(be_bold_font); fJobsBox->SetFont(be_bold_font);
fJobsBox->SetLabel(TR("Print jobs: No printer selected")); fJobsBox->SetLabel(B_TRANSLATE("Print jobs: No printer selected"));
backdrop->AddChild(fJobsBox); backdrop->AddChild(fJobsBox);
// Cancel Job Button // Cancel Job Button
BButton* cancelButton = new BButton(BRect(5,5,5,5), "cancel", TR("Cancel job"), new BMessage(kMsgCancelJob), B_FOLLOW_RIGHT+B_FOLLOW_TOP); BButton* cancelButton = new BButton(BRect(5,5,5,5), "cancel",
B_TRANSLATE("Cancel job"), new BMessage(kMsgCancelJob),
B_FOLLOW_RIGHT+B_FOLLOW_TOP);
fJobsBox->AddChild(cancelButton); fJobsBox->AddChild(cancelButton);
cancelButton->ResizeToPreferred(); cancelButton->ResizeToPreferred();
fCancel = cancelButton; fCancel = cancelButton;
@@ -253,7 +261,9 @@ PrintersWindow::BuildGUI()
maxWidth = cancelButton->Bounds().Width(); maxWidth = cancelButton->Bounds().Width();
// Restart Job button // Restart Job button
BButton* restartButton = new BButton(BRect(5,30,5,30), "restart", TR("Restart job"), new BMessage(kMsgRestartJob), B_FOLLOW_RIGHT+B_FOLLOW_TOP); BButton* restartButton = new BButton(BRect(5,30,5,30), "restart",
B_TRANSLATE("Restart job"), new BMessage(kMsgRestartJob),
B_FOLLOW_RIGHT+B_FOLLOW_TOP);
fJobsBox->AddChild(restartButton); fJobsBox->AddChild(restartButton);
restartButton->ResizeToPreferred(); restartButton->ResizeToPreferred();
fRestart = restartButton; fRestart = restartButton;