* Applied slightly modifed patch from ticket #6089 by Karvjorm. Thank you.

- Added translation comment to paper sizes.
- Localized scripting comments.
- Improved localization of job info.
- Localized parts of about dialog text.   


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36963 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer
2010-05-28 13:45:21 +00:00
parent 9a063f059c
commit 8d2c390382
4 changed files with 112 additions and 53 deletions
+63 -34
View File
@@ -27,6 +27,7 @@
// Haiku // Haiku
#include <Catalog.h> #include <Catalog.h>
#include <Layout.h> #include <Layout.h>
#include <Locale.h>
#include <GroupLayout.h> #include <GroupLayout.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
@@ -68,18 +69,30 @@ static struct PageFormat
float height; float height;
} pageFormat[] = } pageFormat[] =
{ {
{B_TRANSLATE_MARK("Letter"), letter_width, letter_height }, {B_TRANSLATE_MARK_COMMENT("Letter", "ANSI A (letter), a North American "
{B_TRANSLATE_MARK("Legal"), legal_width, legal_height }, "paper size"), letter_width, letter_height },
{B_TRANSLATE_MARK("Ledger"), ledger_width, ledger_height }, {B_TRANSLATE_MARK_COMMENT("Legal", "A North American paper size (216 x 356"
{B_TRANSLATE_MARK("Tabloid"), tabloid_width, tabloid_height }, " mm, or 8.5 x 14 in)"), legal_width, legal_height },
{B_TRANSLATE_MARK("A0"), a0_width, a0_height }, {B_TRANSLATE_MARK_COMMENT("Ledger", "ANSI B (ledger), a North American "
{B_TRANSLATE_MARK("A1"), a1_width, a1_height }, "paper size"), ledger_width, ledger_height },
{B_TRANSLATE_MARK("A2"), a2_width, a2_height }, {B_TRANSLATE_MARK_COMMENT("Tabloid", "ANSI B (tabloid), a North American "
{B_TRANSLATE_MARK("A3"), a3_width, a3_height }, "paper size"), tabloid_width, tabloid_height },
{B_TRANSLATE_MARK("A4"), a4_width, a4_height }, {B_TRANSLATE_MARK_COMMENT("A0", "ISO 216 paper size"),
{B_TRANSLATE_MARK("A5"), a5_width, a5_height }, a0_width, a0_height },
{B_TRANSLATE_MARK("A6"), a6_width, a6_height }, {B_TRANSLATE_MARK_COMMENT("A1", "ISO 216 paper size"),
{B_TRANSLATE_MARK("B5"), b5_width, b5_height }, a1_width, a1_height },
{B_TRANSLATE_MARK_COMMENT("A2", "ISO 216 paper size"),
a2_width, a2_height },
{B_TRANSLATE_MARK_COMMENT("A3", "ISO 216 paper size"),
a3_width, a3_height },
{B_TRANSLATE_MARK_COMMENT("A4", "ISO 216 paper size"),
a4_width, a4_height },
{B_TRANSLATE_MARK_COMMENT("A5", "ISO 216 paper size"),
a5_width, a5_height },
{B_TRANSLATE_MARK_COMMENT("A6", "ISO 216 paper size"),
a6_width, a6_height },
{B_TRANSLATE_MARK_COMMENT("B5", "ISO 216 paper size"),
b5_width, b5_height },
}; };
@@ -124,7 +137,7 @@ ConfigWindow::ConfigWindow(config_setup_kind kind, Printer* defaultPrinter,
{ {
MimeTypeForSender(settings, fSenderMimeType); MimeTypeForSender(settings, fSenderMimeType);
PrinterForMimeType(); PrinterForMimeType();
if (kind == kJobSetup) if (kind == kJobSetup)
SetTitle(B_TRANSLATE("Print setup")); SetTitle(B_TRANSLATE("Print setup"));
@@ -284,20 +297,17 @@ void ConfigWindow::MessageReceived(BMessage* m)
} }
static const char*
kAbout =
"Printer server\n"
"© 2001-2010 Haiku, Inc.\n"
"\n"
"\tIthamar R. Adema\n"
"\tMichael Pfeiffer\n"
;
void void
ConfigWindow::AboutRequested() ConfigWindow::AboutRequested()
{ {
BAlert *about = new BAlert("About printer server", kAbout, BString text = B_TRANSLATE("Printer server");
text << "\n"
"© 2001-2010 Haiku, Inc.\n"
"\n"
"\tIthamar R. Adema\n"
"\tMichael Pfeiffer\n";
BAlert *about = new BAlert("About printer server", text.String(),
B_TRANSLATE("OK")); B_TRANSLATE("OK"));
about->Go(); about->Go();
} }
@@ -490,26 +500,45 @@ void ConfigWindow::UpdateUI()
} }
fPageFormatText->SetText(pageFormat.String()); fPageFormatText->SetText(pageFormat.String());
// display information about job // display information about job
if (fKind == kJobSetup) { if (fKind == kJobSetup) {
BString job; BString job;
int32 first, last; int32 first, last, copies;
if (fJobSettings.FindInt32(PSRV_FIELD_FIRST_PAGE, &first) == B_OK && if (fJobSettings.FindInt32(PSRV_FIELD_FIRST_PAGE, &first) == B_OK &&
fJobSettings.FindInt32(PSRV_FIELD_LAST_PAGE, &last) == B_OK) { fJobSettings.FindInt32(PSRV_FIELD_LAST_PAGE, &last) == B_OK) {
if (first >= 1 && first <= last && last != INT_MAX) {
job << B_TRANSLATE("Page") << " " << first << " " << bool printRange = first >= 1 && first <= last && last != INT_MAX;
B_TRANSLATE("to") << " " << last; char number[12];
} else {
job << B_TRANSLATE("All pages");
}
int32 copies;
if (fJobSettings.FindInt32(PSRV_FIELD_COPIES, &copies) if (fJobSettings.FindInt32(PSRV_FIELD_COPIES, &copies)
== B_OK && copies > 1) { == B_OK && copies > 1) {
job << ", " << copies << " " << B_TRANSLATE("copies"); if (printRange) {
job = B_TRANSLATE("Page %1 to %2, %3 copies");
sprintf(number, "%d", (int)first);
job.ReplaceFirst("%1", number);
sprintf(number, "%d", (int)last);
job.ReplaceFirst("%2", number);
sprintf(number, "%d", (int)copies);
job.ReplaceFirst("%3", number);
} else {
job = B_TRANSLATE("All pages, %1 copies");
sprintf(number, "%d", (int)copies);
job.ReplaceFirst("%1", number);
}
} else {
if (printRange) {
job = B_TRANSLATE("Page %1 to %2");
sprintf(number, "%d", (int)first);
job.ReplaceFirst("%1", number);
sprintf(number, "%d", (int)last);
job.ReplaceFirst("%2", number);
} else {
job = B_TRANSLATE("All pages");
}
} }
} else { } else {
job << B_TRANSLATE("Undefined"); job << B_TRANSLATE("Undefined");
} }
fJobSetupText->SetText(job.String()); fJobSetupText->SetText(job.String());
} }
} }
+3 -1
View File
@@ -1,5 +1,7 @@
SubDir HAIKU_TOP src servers print ; SubDir HAIKU_TOP src servers print ;
SubDirHdrs HAIKU_TOP headers os locale ;
UsePrivateHeaders shared print ; UsePrivateHeaders shared print ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ;
@@ -24,7 +26,7 @@ LinkAgainst print_server :
be be
root root
translation translation
liblocale.so locale
libprint.a libprint.a
libprintutils.a libprintutils.a
$(TARGET_LIBSUPC++) $(TARGET_LIBSUPC++)
+21 -8
View File
@@ -11,28 +11,33 @@
#include "Printer.h" #include "Printer.h"
// BeOS API // BeOS API
#include <Catalog.h>
#include <Locale.h>
#include <PropertyInfo.h> #include <PropertyInfo.h>
// ANSI C // ANSI C
#include <stdio.h> #include <stdio.h>
#define B_TRANSLATE_CONTEXT "PrintServerApp Scripting"
static property_info prop_list[] = { static property_info prop_list[] = {
{ "ActivePrinter", { B_GET_PROPERTY, B_SET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "ActivePrinter", { B_GET_PROPERTY, B_SET_PROPERTY }, { B_DIRECT_SPECIFIER },
"Retrieve or select the active printer" }, B_TRANSLATE_MARK("Retrieve or select the active printer") },
{ "Printer", { B_GET_PROPERTY }, { B_INDEX_SPECIFIER, B_NAME_SPECIFIER, B_REVERSE_INDEX_SPECIFIER }, { "Printer", { B_GET_PROPERTY }, { B_INDEX_SPECIFIER, B_NAME_SPECIFIER, B_REVERSE_INDEX_SPECIFIER },
"Retrieve a specific printer" }, B_TRANSLATE_MARK("Retrieve a specific printer") },
{ "Printer", { B_CREATE_PROPERTY }, { B_DIRECT_SPECIFIER }, { "Printer", { B_CREATE_PROPERTY }, { B_DIRECT_SPECIFIER },
"Create a new printer" }, B_TRANSLATE_MARK("Create a new printer") },
{ "Printer", { B_DELETE_PROPERTY }, { B_INDEX_SPECIFIER, B_NAME_SPECIFIER, B_REVERSE_INDEX_SPECIFIER }, { "Printer", { B_DELETE_PROPERTY }, { B_INDEX_SPECIFIER, B_NAME_SPECIFIER, B_REVERSE_INDEX_SPECIFIER },
"Delete a specific printer" }, B_TRANSLATE_MARK("Delete a specific printer") },
{ "Printers", { B_COUNT_PROPERTIES }, { B_DIRECT_SPECIFIER }, { "Printers", { B_COUNT_PROPERTIES }, { B_DIRECT_SPECIFIER },
"Return the number of available printers" }, B_TRANSLATE_MARK("Return the number of available printers") },
{ "Transport", { B_GET_PROPERTY }, { B_INDEX_SPECIFIER, B_NAME_SPECIFIER, B_REVERSE_INDEX_SPECIFIER }, { "Transport", { B_GET_PROPERTY }, { B_INDEX_SPECIFIER, B_NAME_SPECIFIER, B_REVERSE_INDEX_SPECIFIER },
"Retrieve a specific transport" }, B_TRANSLATE_MARK("Retrieve a specific transport") },
{ "Transports", { B_COUNT_PROPERTIES }, { B_DIRECT_SPECIFIER }, { "Transports", { B_COUNT_PROPERTIES }, { B_DIRECT_SPECIFIER },
"Return the number of available transports" }, B_TRANSLATE_MARK("Return the number of available transports") },
{ "UseConfigWindow", { B_GET_PROPERTY, B_SET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "UseConfigWindow", { B_GET_PROPERTY, B_SET_PROPERTY }, { B_DIRECT_SPECIFIER },
"Show configuration window" }, B_TRANSLATE_MARK("Show configuration window") },
{ 0 } // terminate list { 0 } // terminate list
}; };
@@ -234,6 +239,14 @@ PrintServerApp::GetSupportedSuites(BMessage* msg)
{ {
msg->AddString("suites", "suite/vnd.OpenBeOS-printserver"); msg->AddString("suites", "suite/vnd.OpenBeOS-printserver");
static bool localized = false;
if (!localized) {
localized = true;
for (int i = 0; prop_list[i].name != NULL; i ++)
prop_list[i].usage = be_catalog->GetString(prop_list[i].usage,
B_TRANSLATE_CONTEXT);
}
BPropertyInfo prop_info(prop_list); BPropertyInfo prop_info(prop_list);
msg->AddFlat("messages", &prop_info); msg->AddFlat("messages", &prop_info);
+25 -10
View File
@@ -11,25 +11,32 @@
#include "pr_server.h" #include "pr_server.h"
// BeOS API // BeOS API
#include <PropertyInfo.h>
#include <Messenger.h>
#include <Message.h>
#include <AppDefs.h> #include <AppDefs.h>
#include <Catalog.h>
#include <Locale.h>
#include <Message.h>
#include <Messenger.h>
#include <PropertyInfo.h>
#define B_TRANSLATE_CONTEXT "Printer Scripting"
static property_info prop_list[] = { static property_info prop_list[] = {
{ "Name", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "Name", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
"Get name of printer" }, B_TRANSLATE_MARK("Get name of printer") },
{ "TransportAddon", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "TransportAddon", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
"Get name of the transport add-on used for this printer" }, B_TRANSLATE_MARK("Get name of the transport add-on used for this printer") },
{ "TransportConfig", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "TransportConfig", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
"Get the transport configuration for this printer" }, B_TRANSLATE_MARK("Get the transport configuration for this printer") },
{ "PrinterAddon", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "PrinterAddon", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
"Get name of the printer add-on used for this printer" }, B_TRANSLATE_MARK("Get name of the printer add-on used for this printer") },
{ "Comments", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "Comments", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
"Get comments about this printer" }, B_TRANSLATE_MARK("Get comments about this printer") },
{ 0 } // terminate list { 0 } // terminate list
}; };
void Printer::HandleScriptingCommand(BMessage* msg) void Printer::HandleScriptingCommand(BMessage* msg)
{ {
status_t rc = B_ERROR; status_t rc = B_ERROR;
@@ -52,7 +59,7 @@ void Printer::HandleScriptingCommand(BMessage* msg)
rc = SpoolDir()->ReadAttrString(PSRV_PRINTER_ATTR_DRV_NAME, &result); rc = SpoolDir()->ReadAttrString(PSRV_PRINTER_ATTR_DRV_NAME, &result);
else if (propName == "Comments") else if (propName == "Comments")
rc = SpoolDir()->ReadAttrString(PSRV_PRINTER_ATTR_COMMENTS, &result); rc = SpoolDir()->ReadAttrString(PSRV_PRINTER_ATTR_COMMENTS, &result);
else { // If unknown scripting request, let superclas handle it else { // If unknown scripting request, let super class handle it
Inherited::MessageReceived(msg); Inherited::MessageReceived(msg);
break; break;
} }
@@ -94,7 +101,15 @@ BHandler* Printer::ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec,
status_t Printer::GetSupportedSuites(BMessage* msg) status_t Printer::GetSupportedSuites(BMessage* msg)
{ {
msg->AddString("suites", "application/x-vnd.OpenBeOS-printer"); msg->AddString("suites", "application/x-vnd.OpenBeOS-printer");
static bool localized = false;
if (!localized) {
localized = true;
for (int i = 0; prop_list[i].name != NULL; i ++)
prop_list[i].usage = be_catalog->GetString(prop_list[i].usage,
B_TRANSLATE_CONTEXT);
}
BPropertyInfo prop_info(prop_list); BPropertyInfo prop_info(prop_list);
msg->AddFlat("messages", &prop_info); msg->AddFlat("messages", &prop_info);