From 8c468cb4662021364fcde53953d03215791ea614 Mon Sep 17 00:00:00 2001 From: Michael Pfeiffer Date: Sat, 27 Feb 2010 13:24:26 +0000 Subject: [PATCH] Localized Printers preferences application. Added German translation. Feel free to improve it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35631 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/catalogs/preferences/print/de.catkeys | 28 ++++++++++++++++++++++ src/preferences/print/AddPrinterDialog.cpp | 22 ++++++++++------- src/preferences/print/Jamfile | 15 ++++++++++++ src/preferences/print/JobListView.cpp | 23 +++++++++++------- src/preferences/print/PrinterListView.cpp | 17 ++++++++----- src/preferences/print/Printers.cpp | 3 +++ src/preferences/print/Printers.h | 4 ++++ src/preferences/print/Printers.rdef | 2 +- src/preferences/print/PrintersWindow.cpp | 25 +++++++++++-------- 9 files changed, 105 insertions(+), 34 deletions(-) create mode 100644 data/catalogs/preferences/print/de.catkeys diff --git a/data/catalogs/preferences/print/de.catkeys b/data/catalogs/preferences/print/de.catkeys new file mode 100644 index 0000000000..a5cfa46565 --- /dev/null +++ b/data/catalogs/preferences/print/de.catkeys @@ -0,0 +1,28 @@ +1 german application/x-vnd.Be-PRNT 403433619 +Add printer AddPrinterDialog Drucker anlegen +Printer name: AddPrinterDialog Druckername: + AddPrinterDialog +Printer type: AddPrinterDialog Druckertyp: +Connected to: AddPrinterDialog Verbunden mit: +Add AddPrinterDialog Hinzufügen +Cancel AddPrinterDialog Abbrechen +page JobListView Seite +pages JobListView Seiten +%.2f KB JobListView %.2f KB +Waiting JobListView Warten +Processing JobListView In Bearbeitung +Failed JobListView Fehlgeschlagen +Completed JobListView Abgeschlossen +Unknown status JobListView Unbekannter Zustand +Default Printer PrinterListView Standard Drucker +No pending jobs. PrinterListView Keine ausstehenden Aufträge. +1 pending job. PrinterListView Ein ausstehender Auftrag. + pending jobs. PrinterListView ausstehende Aufträge. +Printers PrintersWindow Drucker +Print jobs for PrintersWindow Druckaufträge für +Print jobs: No printer selected PrintersWindow Druckaufträge: Kein Drucker ausgewählt +Add … PrintersWindow Hinzufügen … +Remove PrintersWindow Entfernen +Make default PrintersWindow Als Standard +Cancel job PrintersWindow Auftrag abbrechen +Restart job PrintersWindow Auftrag neustarten diff --git a/src/preferences/print/AddPrinterDialog.cpp b/src/preferences/print/AddPrinterDialog.cpp index acd7fb0729..840f83fefc 100644 --- a/src/preferences/print/AddPrinterDialog.cpp +++ b/src/preferences/print/AddPrinterDialog.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -33,9 +34,14 @@ #include + +#undef TR_CONTEXT +#define TR_CONTEXT "AddPrinterDialog" + + AddPrinterDialog::AddPrinterDialog(BWindow *parent) : - Inherited(BRect(78.0, 71.0, 400, 300), "Add printer", + Inherited(BRect(78.0, 71.0, 400, 300), TR("Add printer"), B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), fPrintersPrefletMessenger(parent) @@ -171,32 +177,32 @@ void AddPrinterDialog::BuildGUI(int stage) { // add a "printer name" input field - fName = new BTextControl("printer_name", "Printer name:", B_EMPTY_STRING, + fName = new BTextControl("printer_name", TR("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(""); + fPrinter = new BPopUpMenu(TR("")); BMenuField *printerMenuField = new BMenuField("drivers_list", - "Printer type:", fPrinter); + TR("Printer type:"), fPrinter); printerMenuField->SetAlignment(B_ALIGN_RIGHT); FillMenu(fPrinter, "Print", kPrinterSelectedMsg); // add a "connected to" (aka transports list) menu field - fTransport = new BPopUpMenu(""); + fTransport = new BPopUpMenu(TR("")); BMenuField *transportMenuField = new BMenuField("transports_list", - "Connected to:", fTransport); + TR("Connected to:"), fTransport); transportMenuField->SetAlignment(B_ALIGN_RIGHT); FillTransportMenu(fTransport); // add a "OK" button - fOk = new BButton(NULL, "Add", new BMessage((uint32)B_OK), + fOk = new BButton(NULL, TR("Add"), new BMessage((uint32)B_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); // add a "Cancel button - BButton *cancel = new BButton(NULL, "Cancel", new BMessage(B_CANCEL)); + BButton *cancel = new BButton(NULL, TR("Cancel"), new BMessage(B_CANCEL)); SetLayout(new BGridLayout()); diff --git a/src/preferences/print/Jamfile b/src/preferences/print/Jamfile index 6aa8e25dcf..3b46edac5f 100644 --- a/src/preferences/print/Jamfile +++ b/src/preferences/print/Jamfile @@ -15,6 +15,21 @@ Preference Printers : translation libprintutils.a $(TARGET_LIBSUPC++) + liblocale.so : Printers.rdef ; + +DoCatalogs Printers : + x-vnd.Be-PRNT + : + AddPrinterDialog.cpp + JobListView.cpp + PrinterListView.cpp + PrintersWindow.cpp + : + en.catalog + : + de.catkeys + ; + \ No newline at end of file diff --git a/src/preferences/print/JobListView.cpp b/src/preferences/print/JobListView.cpp index ea0d6b2e07..e99397febb 100644 --- a/src/preferences/print/JobListView.cpp +++ b/src/preferences/print/JobListView.cpp @@ -38,11 +38,16 @@ #include #include +#include #include #include #include +#undef TR_CONTEXT +#define TR_CONTEXT "JobListView" + + // #pragma mark -- JobListView @@ -218,41 +223,41 @@ JobItem::Update() B_INT32_TYPE, 0, &pages, sizeof(pages)) == sizeof(pages)) { fPages << pages; if (pages > 1) - fPages << " pages."; + fPages << " " << TR("pages") << "."; else - fPages << " page."; + fPages << " " << TR("page") << "."; } else { - fPages = "??? pages."; + fPages << "??? " << TR("pages") << "."; } fSize = ""; off_t size; if (node.GetSize(&size) == B_OK) { char buffer[80]; - sprintf(buffer, "%.2f KB", size / 1024.0); + sprintf(buffer, TR("%.2f KB"), size / 1024.0); fSize = buffer; } fStatus = ""; switch (fJob->Status()) { case kWaiting: - fStatus = "Waiting"; + fStatus = TR("Waiting"); break; case kProcessing: - fStatus = "Processing"; + fStatus = TR("Processing"); break; case kFailed: - fStatus = "Failed"; + fStatus = TR("Failed"); break; case kCompleted: - fStatus = "Completed"; + fStatus = TR("Completed"); break; default: - fStatus = "Unkown status"; + fStatus = TR("Unknown status"); } } diff --git a/src/preferences/print/PrinterListView.cpp b/src/preferences/print/PrinterListView.cpp index 717c6d2276..2703c78eef 100644 --- a/src/preferences/print/PrinterListView.cpp +++ b/src/preferences/print/PrinterListView.cpp @@ -36,12 +36,17 @@ #include #include +#include #include #include #include #include +#undef TR_CONTEXT +#define TR_CONTEXT "PrinterListView" + + // #pragma mark -- PrinterListView @@ -372,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("No pending jobs."); + float width = owner->StringWidth(TR("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); @@ -388,7 +393,7 @@ void PrinterItem::DrawItem(BView *owner, BRect /*bounds*/, bool complete) if (sSelectedIcon && sSelectedIcon->IsValid()) owner->DrawBitmap(sSelectedIcon, iconPt); else - owner->DrawString("Default Printer", defaultPt); + owner->DrawString(TR("Default Printer"), defaultPt); } else { if (sIcon && sIcon->IsValid()) owner->DrawBitmap(sIcon, iconPt); @@ -401,7 +406,7 @@ void PrinterItem::DrawItem(BView *owner, BRect /*bounds*/, bool complete) owner->DrawString(fDriverName.String(), fDriverName.Length(), driverPt); // right of item - owner->DrawString(fPendingJobs.String(), 16, pendingPt); + owner->DrawString(fPendingJobs.String(), fPendingJobs.Length(), pendingPt); owner->DrawString(fTransport.String(), fTransport.Length(), transportPt); owner->DrawString(fComments.String(), fComments.Length(), commentPt); @@ -444,12 +449,12 @@ PrinterItem::UpdatePendingJobs() if (fFolder) { uint32 pendingJobs = fFolder->CountJobs(); if (pendingJobs == 1) { - fPendingJobs = "1 pending job."; + fPendingJobs = TR("1 pending job."); return; } else if (pendingJobs > 1) { - fPendingJobs << pendingJobs << " pending jobs."; + fPendingJobs << pendingJobs << TR(" pending jobs."); return; } } - fPendingJobs = "No pending jobs."; + fPendingJobs = TR("No pending jobs."); } diff --git a/src/preferences/print/Printers.cpp b/src/preferences/print/Printers.cpp index d670fa2800..1c48c66f20 100644 --- a/src/preferences/print/Printers.cpp +++ b/src/preferences/print/Printers.cpp @@ -32,6 +32,8 @@ #include "Messages.h" #include "PrintersWindow.h" +#include + int main() { PrintersApp app; @@ -42,6 +44,7 @@ int main() PrintersApp::PrintersApp() : Inherited(PRINTERS_SIGNATURE) { + be_locale->GetAppCatalog(&fCatalog); } void PrintersApp::ReadyToRun() diff --git a/src/preferences/print/Printers.h b/src/preferences/print/Printers.h index 63919378d5..971c58d455 100644 --- a/src/preferences/print/Printers.h +++ b/src/preferences/print/Printers.h @@ -32,6 +32,7 @@ class PrintersApp; #include +#include #define PRINTERS_SIGNATURE "application/x-vnd.Be-PRNT" @@ -42,6 +43,9 @@ public: PrintersApp(); void ReadyToRun(); void MessageReceived(BMessage* msg); + +private: + BCatalog fCatalog; }; #endif diff --git a/src/preferences/print/Printers.rdef b/src/preferences/print/Printers.rdef index 879c9f5b89..24e61413ad 100644 --- a/src/preferences/print/Printers.rdef +++ b/src/preferences/print/Printers.rdef @@ -15,7 +15,7 @@ resource app_version { internal = 0, short_info = "Printers", - long_info = "Printers ©2001-2009 Haiku" + long_info = "Printers ©2001-2010 Haiku" }; resource vector_icon { diff --git a/src/preferences/print/PrintersWindow.cpp b/src/preferences/print/PrintersWindow.cpp index bcff1dc5f4..720e02d389 100644 --- a/src/preferences/print/PrintersWindow.cpp +++ b/src/preferences/print/PrintersWindow.cpp @@ -39,15 +39,20 @@ // BeOS API #include #include +#include #include #include #include #include +#undef TR_CONTEXT +#define TR_CONTEXT "PrintersWindow" + + PrintersWindow::PrintersWindow(BRect frame) : - Inherited(BRect(78.0, 71.0, 561.0, 409.0), "Printers", B_TITLED_WINDOW, 0), + Inherited(BRect(78.0, 71.0, 561.0, 409.0), TR("Printers"), B_TITLED_WINDOW, 0), fSelectedPrinter(NULL), fAddingPrinter(false) { @@ -77,14 +82,14 @@ PrintersWindow::MessageReceived(BMessage* msg) fSelectedPrinter = fPrinterListView->SelectedItem(); if (fSelectedPrinter) { - fJobsBox->SetLabel((BString("Print jobs for ") << fSelectedPrinter->Name()).String()); + fJobsBox->SetLabel((BString(TR("Print jobs for ")) << fSelectedPrinter->Name()).String()); fMakeDefault->SetEnabled(true); fRemove->SetEnabled(true); fJobListView->SetSpoolFolder(fSelectedPrinter->Folder()); } else { - fJobsBox->SetLabel("Print jobs: No printer selected"); + fJobsBox->SetLabel(TR("Print jobs: No printer selected")); fMakeDefault->SetEnabled(false); fRemove->SetEnabled(false); fSelectedPrinter = NULL; @@ -178,21 +183,21 @@ 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("Printers:"); + printersBox->SetLabel(TR("Printers")); backdrop->AddChild(printersBox); // Width of largest button float maxWidth = 0; // Add Button - BButton* addButton = new BButton(BRect(5,5,5,5), "add", "Add " B_UTF8_ELLIPSIS, new BMessage(kMsgAddPrinter), B_FOLLOW_RIGHT); + BButton* addButton = new BButton(BRect(5,5,5,5), "add", TR("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", "Remove", new BMessage(kMsgRemovePrinter), B_FOLLOW_RIGHT); + fRemove = new BButton(BRect(5,30,5,30), "remove", TR("Remove"), new BMessage(kMsgRemovePrinter), B_FOLLOW_RIGHT); printersBox->AddChild(fRemove); fRemove->ResizeToPreferred(); @@ -200,7 +205,7 @@ PrintersWindow::BuildGUI() maxWidth = fRemove->Bounds().Width(); // Make Default button - fMakeDefault = new BButton(BRect(5,60,5,60), "default", "Make default", new BMessage(kMsgMakeDefaultPrinter), B_FOLLOW_RIGHT); + fMakeDefault = new BButton(BRect(5,60,5,60), "default", TR("Make default"), new BMessage(kMsgMakeDefaultPrinter), B_FOLLOW_RIGHT); printersBox->AddChild(fMakeDefault); fMakeDefault->ResizeToPreferred(); @@ -236,11 +241,11 @@ 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("Print Jobs: No printer selected"); + fJobsBox->SetLabel(TR("Print jobs: No printer selected")); backdrop->AddChild(fJobsBox); // Cancel Job Button - BButton* cancelButton = new BButton(BRect(5,5,5,5), "cancel", "Cancel job", new BMessage(kMsgCancelJob), B_FOLLOW_RIGHT+B_FOLLOW_TOP); + BButton* cancelButton = new BButton(BRect(5,5,5,5), "cancel", TR("Cancel job"), new BMessage(kMsgCancelJob), B_FOLLOW_RIGHT+B_FOLLOW_TOP); fJobsBox->AddChild(cancelButton); cancelButton->ResizeToPreferred(); fCancel = cancelButton; @@ -248,7 +253,7 @@ PrintersWindow::BuildGUI() maxWidth = cancelButton->Bounds().Width(); // Restart Job button - BButton* restartButton = new BButton(BRect(5,30,5,30), "restart", "Restart job", new BMessage(kMsgRestartJob), B_FOLLOW_RIGHT+B_FOLLOW_TOP); + BButton* restartButton = new BButton(BRect(5,30,5,30), "restart", TR("Restart job"), new BMessage(kMsgRestartJob), B_FOLLOW_RIGHT+B_FOLLOW_TOP); fJobsBox->AddChild(restartButton); restartButton->ResizeToPreferred(); fRestart = restartButton;