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

View File

@ -41,7 +41,7 @@
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_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fPrintersPrefletMessenger(parent)
@ -64,29 +64,29 @@ void
AddPrinterDialog::MessageReceived(BMessage* msg)
{
switch(msg->what) {
case B_OK:
case B_OK:
AddPrinter(msg);
PostMessage(B_QUIT_REQUESTED);
break;
case B_CANCEL:
PostMessage(B_QUIT_REQUESTED);
break;
case kNameChangedMsg:
fNameText = fName->Text();
fNameText = fName->Text();
Update();
break;
case kPrinterSelectedMsg:
StorePrinter(msg);
break;
case kTransportSelectedMsg:
HandleChangedTransport(msg);
break;
default:
Inherited::MessageReceived(msg);
}
@ -99,8 +99,8 @@ AddPrinterDialog::AddPrinter(BMessage *msg)
BMessage m(PSRV_MAKE_PRINTER);
BMessenger msgr;
if (GetPrinterServerMessenger(msgr) != B_OK)
return;
return;
BString transport;
BString transportPath;
if (fPrinterText != "Preview") {
@ -108,10 +108,10 @@ AddPrinterDialog::AddPrinter(BMessage *msg)
transport = fTransportText;
transportPath = fTransportPathText;
}
m.AddString("driver", fPrinterText.String());
m.AddString("transport", transport.String());
m.AddString("transport path", transportPath.String());
m.AddString("driver", fPrinterText.String());
m.AddString("transport", transport.String());
m.AddString("transport path", transportPath.String());
m.AddString("printer name", fNameText.String());
m.AddString("connection", "Local");
msgr.SendMessage(&m);
@ -125,7 +125,7 @@ AddPrinterDialog::StorePrinter(BMessage *msg)
BString name;
if (msg->FindString("name", &name) != B_OK)
name = "";
fPrinterText = name;
Update();
}
@ -137,9 +137,9 @@ AddPrinterDialog::HandleChangedTransport(BMessage *msg)
BString name;
if (msg->FindString("name", &name) != B_OK) {
name = "";
}
}
fTransportText = name;
BString path;
if (msg->FindString("path", &path) == B_OK) {
// transport path selected
@ -163,14 +163,14 @@ AddPrinterDialog::HandleChangedTransport(BMessage *msg)
} else {
// transport selected
fTransportPathText = "";
// remove mark from item in sub menu of transport sub menu
for (int32 i = fTransport->CountItems()-1; i >= 0; i --) {
BMenu* menu = fTransport->SubmenuAt(i);
if (menu != NULL) {
BMenuItem* item = menu->FindMarked();
if (item != NULL)
item->SetMarked(false);
if (item != NULL)
item->SetMarked(false);
}
}
}
@ -182,32 +182,32 @@ void
AddPrinterDialog::BuildGUI(int stage)
{
// add a "printer name" input field
fName = new BTextControl("printer_name", TR("Printer name:"), B_EMPTY_STRING,
NULL);
fName = new BTextControl("printer_name", B_TRANSLATE("Printer name:"),
B_EMPTY_STRING, NULL);
fName->SetFont(be_bold_font);
fName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
fName->SetModificationMessage(new BMessage(kNameChangedMsg));
// 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",
TR("Printer type:"), fPrinter);
B_TRANSLATE("Printer type:"), fPrinter);
printerMenuField->SetAlignment(B_ALIGN_RIGHT);
FillMenu(fPrinter, "Print", kPrinterSelectedMsg);
// 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",
TR("Connected to:"), fTransport);
B_TRANSLATE("Connected to:"), fTransport);
transportMenuField->SetAlignment(B_ALIGN_RIGHT);
FillTransportMenu(fTransport);
// 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);
// add a "Cancel button
BButton *cancel = new BButton(NULL, TR("Cancel"), new BMessage(B_CANCEL));
// add a "Cancel button
BButton *cancel = new BButton(NULL, B_TRANSLATE("Cancel"), new BMessage(B_CANCEL));
SetLayout(new BGridLayout());
@ -230,7 +230,7 @@ AddPrinterDialog::BuildGUI(int stage)
fOk->MakeDefault(true);
fName->MakeFocus(true);
Update();
// Stage == 0
// init_icon 64x114 Add a Local or Network Printer
@ -298,14 +298,14 @@ AddPrinterDialog::FillMenu(BMenu* menu, const char* path, uint32 what)
BPath addonPath;
if (find_directory(gAddonDirs[i], &addonPath) != B_OK)
continue;
if (addonPath.Append(path) != B_OK)
if (addonPath.Append(path) != B_OK)
continue;
BDirectory dir(addonPath.Path());
if (dir.InitCheck() != B_OK)
if (dir.InitCheck() != B_OK)
continue;
BEntry entry;
while (dir.GetNextEntry(&entry, true) == B_OK) {
if (!entry.IsFile())
@ -400,9 +400,9 @@ void AddPrinterDialog::FillTransportMenu(BMenu* menu)
void
AddPrinterDialog::Update()
{
fOk->SetEnabled(fNameText != "" && fPrinterText != "" &&
fOk->SetEnabled(fNameText != "" && fPrinterText != "" &&
(fTransportText != "" || fPrinterText == "Preview"));
fTransport->SetEnabled(fPrinterText != "Preview");
}

View File

@ -223,41 +223,41 @@ JobItem::Update()
B_INT32_TYPE, 0, &pages, sizeof(pages)) == sizeof(pages)) {
fPages << pages;
if (pages > 1)
fPages << " " << TR("pages") << ".";
fPages << " " << B_TRANSLATE("pages") << ".";
else
fPages << " " << TR("page") << ".";
fPages << " " << B_TRANSLATE("page") << ".";
} else {
fPages << "??? " << TR("pages") << ".";
fPages << "??? " << B_TRANSLATE("pages") << ".";
}
fSize = "";
off_t size;
if (node.GetSize(&size) == B_OK) {
char buffer[80];
sprintf(buffer, TR("%.2f KB"), size / 1024.0);
sprintf(buffer, B_TRANSLATE("%.2f KB"), size / 1024.0);
fSize = buffer;
}
fStatus = "";
switch (fJob->Status()) {
case kWaiting:
fStatus = TR("Waiting");
fStatus = B_TRANSLATE("Waiting");
break;
case kProcessing:
fStatus = TR("Processing");
fStatus = B_TRANSLATE("Processing");
break;
case kFailed:
fStatus = TR("Failed");
fStatus = B_TRANSLATE("Failed");
break;
case kCompleted:
fStatus = TR("Completed");
fStatus = B_TRANSLATE("Completed");
break;
default:
fStatus = TR("Unknown status");
fStatus = B_TRANSLATE("Unknown status");
}
}

View File

@ -377,7 +377,7 @@ void PrinterItem::DrawItem(BView *owner, BRect /*bounds*/, bool complete)
BPoint driverPt(iconPt + BPoint(x, fntheight * 2.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 transportPt(bounds.right - width - 8.0, driverPt.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())
owner->DrawBitmap(sSelectedIcon, iconPt);
else
owner->DrawString(TR("Default Printer"), defaultPt);
owner->DrawString(B_TRANSLATE("Default Printer"), defaultPt);
} else {
if (sIcon && sIcon->IsValid())
owner->DrawBitmap(sIcon, iconPt);
@ -459,12 +459,12 @@ PrinterItem::UpdatePendingJobs()
if (fFolder) {
uint32 pendingJobs = fFolder->CountJobs();
if (pendingJobs == 1) {
fPendingJobs = TR("1 pending job.");
fPendingJobs = B_TRANSLATE("1 pending job.");
return;
} else if (pendingJobs > 1) {
fPendingJobs << pendingJobs << TR(" pending jobs.");
fPendingJobs << pendingJobs << B_TRANSLATE(" pending jobs.");
return;
}
}
fPendingJobs = TR("No pending jobs.");
fPendingJobs = B_TRANSLATE("No pending jobs.");
}

View File

@ -1,8 +1,8 @@
/*****************************************************************************/
// Printers Preference Application.
//
// This application and all source files used in its construction, except
// where noted, are licensed under the MIT License, and have been written
// This application and all source files used in its construction, except
// where noted, are licensed under the MIT License, and have been written
// and are:
//
// Copyright (c) 2001-2003 OpenBeOS Project
@ -10,18 +10,18 @@
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// 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:
//
// 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.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// 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
// 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
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
@ -52,7 +52,8 @@
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),
fAddingPrinter(false)
{
@ -82,14 +83,16 @@ PrintersWindow::MessageReceived(BMessage* msg)
fSelectedPrinter = fPrinterListView->SelectedItem();
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);
fRemove->SetEnabled(true);
fJobListView->SetSpoolFolder(fSelectedPrinter->Folder());
}
else
{
fJobsBox->SetLabel(TR("Print jobs: No printer selected"));
fJobsBox->SetLabel(
B_TRANSLATE("Print jobs: No printer selected"));
fMakeDefault->SetEnabled(false);
fRemove->SetEnabled(false);
fSelectedPrinter = NULL;
@ -106,7 +109,7 @@ PrintersWindow::MessageReceived(BMessage* msg)
new AddPrinterDialog(this);
}
break;
case kMsgAddPrinterClosed:
fAddingPrinter = false;
break;
@ -183,21 +186,23 @@ PrintersWindow::BuildGUI()
BBox* printersBox = new BBox(BRect(boxInset, boxInset, r.Width()-boxInset, (r.Height()/2) - (boxInset/2)),
"printersBox", B_FOLLOW_ALL);
printersBox->SetFont(be_bold_font);
printersBox->SetLabel(TR("Printers"));
printersBox->SetLabel(B_TRANSLATE("Printers"));
backdrop->AddChild(printersBox);
// Width of largest button
float maxWidth = 0;
// 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);
addButton->ResizeToPreferred();
maxWidth = addButton->Bounds().Width();
// 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);
fRemove->ResizeToPreferred();
@ -205,7 +210,8 @@ PrintersWindow::BuildGUI()
maxWidth = fRemove->Bounds().Width();
// 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);
fMakeDefault->ResizeToPreferred();
@ -241,11 +247,13 @@ PrintersWindow::BuildGUI()
fJobsBox = new BBox(BRect(boxInset, (r.Height()/2)+(boxInset/2), Bounds().Width()-10, Bounds().Height() - boxInset),
"jobsBox", B_FOLLOW_LEFT_RIGHT+B_FOLLOW_BOTTOM);
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);
// 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);
cancelButton->ResizeToPreferred();
fCancel = cancelButton;
@ -253,7 +261,9 @@ PrintersWindow::BuildGUI()
maxWidth = cancelButton->Bounds().Width();
// 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);
restartButton->ResizeToPreferred();
fRestart = restartButton;