Printers preflet: changed localizations

* Fixed colour localization on test page
* Changed JobListView to use plural placeholders
* Changed PrintersWindow to use placeholders

Change-Id: I39477351364a0182cf629476de767af18f9c0d61
Reviewed-on: https://review.haiku-os.org/524
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
jjpx
2018-10-25 15:38:48 +00:00
committed by waddlesplash
parent a98e02fcda
commit a1c2394a81
3 changed files with 18 additions and 11 deletions
+11 -7
View File
@@ -15,6 +15,7 @@
#include <Locale.h> #include <Locale.h>
#include <MimeType.h> #include <MimeType.h>
#include <Roster.h> #include <Roster.h>
#include <StringFormat.h>
#include <Window.h> #include <Window.h>
#include "pr_server.h" #include "pr_server.h"
@@ -32,7 +33,7 @@
JobListView::JobListView(BRect frame) JobListView::JobListView(BRect frame)
: :
Inherited(frame, "jobs_list", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL, Inherited(frame, "jobs_list", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE) B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE)
{ {
@@ -201,15 +202,18 @@ JobItem::Update()
fPages = ""; fPages = "";
int32 pages; int32 pages;
static BStringFormat format(B_TRANSLATE("{0, plural, "
"=-1{??? pages}"
"=1{# page}"
"other{# pages}}"));
if (node.ReadAttr(PSRV_SPOOL_ATTR_PAGECOUNT, if (node.ReadAttr(PSRV_SPOOL_ATTR_PAGECOUNT,
B_INT32_TYPE, 0, &pages, sizeof(pages)) == sizeof(pages)) { B_INT32_TYPE, 0, &pages, sizeof(pages)) == sizeof(pages)) {
fPages << pages; format.Format(fPages, pages);
if (pages > 1)
fPages << " " << B_TRANSLATE("pages") << ".";
else
fPages << " " << B_TRANSLATE("page") << ".";
} else { } else {
fPages << "??? " << B_TRANSLATE("pages") << "."; // unknown page count, probably the printer is paginating without
// software help.
format.Format(fPages, -1);
} }
fSize = ""; fSize = "";
+4 -2
View File
@@ -123,8 +123,10 @@ PrintersWindow::MessageReceived(BMessage* msg)
{ {
fSelectedPrinter = fPrinterListView->SelectedItem(); fSelectedPrinter = fPrinterListView->SelectedItem();
if (fSelectedPrinter) { if (fSelectedPrinter) {
fJobsBox->SetLabel((BString(B_TRANSLATE("Print jobs for ")) BString text = B_TRANSLATE("Print jobs for %printer_name%");
<< fSelectedPrinter->Name()).String()); text.ReplaceFirst("%printer_name%", fSelectedPrinter->Name());
fJobsBox->SetLabel(text);
fMakeDefault->SetEnabled(true); fMakeDefault->SetEnabled(true);
fRemove->SetEnabled(true); fRemove->SetEnabled(true);
fJobListView->SetSpoolFolder(fSelectedPrinter->Folder()); fJobListView->SetSpoolFolder(fSelectedPrinter->Folder());
+3 -2
View File
@@ -281,8 +281,9 @@ TestPageView::AttachedToWindow()
gradiants.View()->SetViewColor(B_TRANSPARENT_COLOR); gradiants.View()->SetViewColor(B_TRANSPARENT_COLOR);
for (int i = 0; i < kNumColorGradients; ++i) { for (int i = 0; i < kNumColorGradients; ++i) {
BStringView* label = new BStringView(kColorGradients[i].name, BStringView* label = new BStringView(
kColorGradients[i].name); kColorGradients[i].name,
B_TRANSLATE(kColorGradients[i].name));
// label->SetAlignment(B_ALIGN_RIGHT); // label->SetAlignment(B_ALIGN_RIGHT);
gradiants.Add(label, 0, i); gradiants.Add(label, 0, i);
gradiants.Add(new ColorGradientView(kColorGradients[i].color), 1, i); gradiants.Add(new ColorGradientView(kColorGradients[i].color), 1, i);