From 16a00788187cd7bed2cfe48ff0159ac579a40e94 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Fri, 7 May 2010 00:00:13 +0000 Subject: [PATCH] Updated to use B_TRANSLATE* macros. relates to #5408. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36689 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/mail/Account.cpp | 23 +++++---- src/preferences/mail/ConfigViews.cpp | 42 ++++++++++------- src/preferences/mail/ConfigWindow.cpp | 68 +++++++++++++++------------ 3 files changed, 76 insertions(+), 57 deletions(-) diff --git a/src/preferences/mail/Account.cpp b/src/preferences/mail/Account.cpp index 32bd8052a8..c542e73051 100644 --- a/src/preferences/mail/Account.cpp +++ b/src/preferences/mail/Account.cpp @@ -109,12 +109,15 @@ Account::Account(BMailChain *inbound, BMailChain *outbound) if (fSettings) label << fSettings->Name(); else - label << TR("Unnamed"); + label << B_TRANSLATE("Unnamed"); fAccountItem = new AccountItem(label.String(), this, ACCOUNT_ITEM); - fInboundItem = new AccountItem(TR(" · Incoming"), this, INBOUND_ITEM); - fOutboundItem = new AccountItem(TR(" · Outgoing"), this, OUTBOUND_ITEM); - fFilterItem = new AccountItem(TR(" · E-mail filters"), this, FILTER_ITEM); + fInboundItem = + new AccountItem(B_TRANSLATE(" · Incoming"), this, INBOUND_ITEM); + fOutboundItem = + new AccountItem(B_TRANSLATE(" · Outgoing"), this, OUTBOUND_ITEM); + fFilterItem = + new AccountItem(B_TRANSLATE(" · E-mail filters"), this, FILTER_ITEM); } @@ -264,8 +267,9 @@ void Account::CreateInbound() { if (!(fInbound = NewMailChain())) { - (new BAlert(TR("E-mail"), TR("Could not create inbound chain."), - TR("OK")))->Go(); + (new BAlert(B_TRANSLATE("E-mail"), + B_TRANSLATE("Could not create inbound chain."), + B_TRANSLATE("OK")))->Go(); return; } fInbound->SetChainDirection(inbound); @@ -303,7 +307,7 @@ Account::CreateInbound() // New Mail Notification path = addOnPath; path.Append(kSystemFilterAddOnPath); - path.Append(TR("New mail notification")); + path.Append(B_TRANSLATE("New mail notification")); if (!BEntry(path.Path()).Exists()) { find_directory(B_BEOS_ADDONS_DIRECTORY, &path); path.Append(kSystemFilterAddOnPath); @@ -333,8 +337,9 @@ void Account::CreateOutbound() { if (!(fOutbound = NewMailChain())) { - (new BAlert(TR("E-mail"), TR("Could not create outbound chain."), - TR("OK")))->Go(); + (new BAlert(B_TRANSLATE("E-mail"), + B_TRANSLATE("Could not create outbound chain."), + B_TRANSLATE("OK")))->Go(); return; } fOutbound->SetChainDirection(outbound); diff --git a/src/preferences/mail/ConfigViews.cpp b/src/preferences/mail/ConfigViews.cpp index 9aeec4b5eb..518c0ef1f7 100644 --- a/src/preferences/mail/ConfigViews.cpp +++ b/src/preferences/mail/ConfigViews.cpp @@ -60,7 +60,7 @@ AccountConfigView::AccountConfigView(BRect rect, Account *account) BBox(rect), fAccount(account) { - SetLabel(TR("Account settings")); + SetLabel(B_TRANSLATE("Account settings")); rect = Bounds().InsetByCopy(8, 8); rect.top += 10; @@ -76,31 +76,33 @@ AccountConfigView::AccountConfigView(BRect rect, Account *account) rect = view->Bounds(); rect.bottom = height + 5; - float labelWidth = view->StringWidth(TR("Account name:")) + 6; + float labelWidth = view->StringWidth(B_TRANSLATE("Account name:")) + 6; view->AddChild(fNameControl = new BTextControl(rect, NULL, - TR("Account name:"), NULL, new BMessage(kMsgAccountNameChanged))); + B_TRANSLATE("Account name:"), NULL, + new BMessage(kMsgAccountNameChanged))); fNameControl->SetDivider(labelWidth); view->AddChild(fRealNameControl = new BTextControl(rect, NULL, - TR("Real name:"), NULL, NULL)); + B_TRANSLATE("Real name:"), NULL, NULL)); fRealNameControl->SetDivider(labelWidth); view->AddChild(fReturnAddressControl = new BTextControl(rect, NULL, - TR("Return address:"), NULL, NULL)); + B_TRANSLATE("Return address:"), NULL, NULL)); fReturnAddressControl->SetDivider(labelWidth); // control->TextView()->HideTyping(true); BPopUpMenu *chainsPopUp = new BPopUpMenu(B_EMPTY_STRING); const char *chainModes[] = { - TR("Receive mail only"), - TR("Send mail only"), - TR("Send and receive mail")}; + B_TRANSLATE("Receive mail only"), + B_TRANSLATE("Send mail only"), + B_TRANSLATE("Send and receive mail")}; BMenuItem *item; for (int32 i = 0;i < 3;i++) { chainsPopUp->AddItem(item = new BMenuItem(chainModes[i], new BMessage(kMsgAccountTypeChanged))); } - fTypeField = new BMenuField(rect, NULL, TR("Account type:"), chainsPopUp); + fTypeField = new BMenuField(rect, NULL, B_TRANSLATE("Account type:"), + chainsPopUp); fTypeField->SetDivider(labelWidth + 3); view->AddChild(fTypeField); @@ -166,7 +168,8 @@ AccountConfigView::UpdateViews() if (!fAccount->Inbound() && !fAccount->Outbound()) { if (BMenuItem *item = fTypeField->Menu()->FindMarked()) item->SetMarked(false); - fTypeField->Menu()->Superitem()->SetLabel(TR("Select account type")); + fTypeField->Menu()->Superitem()->SetLabel( + B_TRANSLATE("Select account type")); fNameControl->SetEnabled(false); fRealNameControl->SetEnabled(false); @@ -560,13 +563,15 @@ FiltersConfigView::FiltersConfigView(BRect rect, Account *account) BMenuItem *item; BMessage *msg; if ((fChain = fAccount->Inbound())) { - menu->AddItem(item = new BMenuItem(TR("Incoming mail filters"), + menu->AddItem(item = new BMenuItem( + B_TRANSLATE("Incoming mail filters"), msg = new BMessage(kMsgChainSelected))); msg->AddPointer("chain", fChain); item->SetMarked(true); } if (BMailChain *chain = fAccount->Outbound()) { - menu->AddItem(item = new BMenuItem(TR("Outgoing mail filters"), + menu->AddItem(item = new BMenuItem( + B_TRANSLATE("Outgoing mail filters"), msg = new BMessage(kMsgChainSelected))); msg->AddPointer("chain", chain); if (fChain == NULL) { @@ -601,9 +606,9 @@ FiltersConfigView::FiltersConfigView(BRect rect, Account *account) rect.bottom = rect.top + height; BRect sizeRect = rect; sizeRect.right = sizeRect.left + 30 - + fChainsField->StringWidth(TR("Add filter")); + + fChainsField->StringWidth(B_TRANSLATE("Add filter")); - menu = new BPopUpMenu(TR("Add filter")); + menu = new BPopUpMenu(B_TRANSLATE("Add filter")); menu->SetRadioMode(false); fAddField = new BMenuField(rect, NULL, NULL, menu); @@ -612,9 +617,9 @@ FiltersConfigView::FiltersConfigView(BRect rect, Account *account) sizeRect.left = sizeRect.right + 5; sizeRect.right = sizeRect.left + 30 - + fChainsField->StringWidth(TR("Remove")); + + fChainsField->StringWidth(B_TRANSLATE("Remove")); sizeRect.top--; - AddChild(fRemoveButton = new BButton(sizeRect, NULL, TR("Remove"), + AddChild(fRemoveButton = new BButton(sizeRect, NULL, B_TRANSLATE("Remove"), new BMessage(kMsgRemoveFilter), B_FOLLOW_BOTTOM)); ResizeTo(Bounds().Width(), sizeRect.bottom + 10); @@ -834,8 +839,9 @@ FiltersConfigView::MessageReceived(BMessage *msg) if (fChain->AddFilter(to, settings, ref) < B_OK) { (new BAlert("E-mail", - TR("The filter could not be moved. Deleting filter."), - TR("OK")))->Go(); + B_TRANSLATE("The filter could not be moved. " + "Deleting filter."), + B_TRANSLATE("OK")))->Go(); // the filter view belongs to the moved filter if (fFilterView && fFilterView->fIndex == -1) diff --git a/src/preferences/mail/ConfigWindow.cpp b/src/preferences/mail/ConfigWindow.cpp index ca967f89c5..d95cd53f03 100644 --- a/src/preferences/mail/ConfigWindow.cpp +++ b/src/preferences/mail/ConfigWindow.cpp @@ -276,7 +276,7 @@ ConfigWindow::ConfigWindow() rect = tabView->Bounds(); rect.bottom -= tabView->TabHeight() + 4; tabView->AddTab(view = new BView(rect, NULL, B_FOLLOW_ALL, 0)); - tabView->TabAt(0)->SetLabel(TR("Accounts")); + tabView->TabAt(0)->SetLabel(B_TRANSLATE("Accounts")); view->SetViewColor(top->ViewColor()); // accounts listview @@ -291,13 +291,16 @@ ConfigWindow::ConfigWindow() rect.top = rect.bottom + 8; rect.bottom = rect.top + height; BRect sizeRect = rect; - sizeRect.right = sizeRect.left + 30 + view->StringWidth(TR("Add")); - view->AddChild(new BButton(sizeRect, NULL, TR("Add"), + sizeRect.right = sizeRect.left + 30 + view->StringWidth( + B_TRANSLATE("Add")); + view->AddChild(new BButton(sizeRect, NULL, B_TRANSLATE("Add"), new BMessage(kMsgAddAccount), B_FOLLOW_BOTTOM)); sizeRect.left = sizeRect.right+3; - sizeRect.right = sizeRect.left + 30 + view->StringWidth(TR("Remove")); - view->AddChild(fRemoveButton = new BButton(sizeRect, NULL, TR("Remove"), + sizeRect.right = sizeRect.left + 30 + view->StringWidth( + B_TRANSLATE("Remove")); + view->AddChild(fRemoveButton = new BButton( + sizeRect, NULL, B_TRANSLATE("Remove"), new BMessage(kMsgRemoveAccount), B_FOLLOW_BOTTOM)); // accounts config view @@ -313,32 +316,32 @@ ConfigWindow::ConfigWindow() rect = tabView->Bounds(); rect.bottom -= tabView->TabHeight() + 4; tabView->AddTab(view = new CenterContainer(rect)); - tabView->TabAt(1)->SetLabel(TR("Settings")); + tabView->TabAt(1)->SetLabel(B_TRANSLATE("Settings")); rect = view->Bounds().InsetByCopy(8, 8); rect.right -= 1; rect.bottom = rect.top + height * 5 + 15; BBox *box = new BBox(rect); - box->SetLabel(TR("Mail checking")); + box->SetLabel(B_TRANSLATE("Mail checking")); view->AddChild(box); rect = box->Bounds().InsetByCopy(8, 8); rect.top += 7; rect.bottom = rect.top + height + 5; BRect tile = rect.OffsetByCopy(0, 1); - int32 labelWidth = (int32)view->StringWidth(TR("Check every")) + 6; + int32 labelWidth = (int32)view->StringWidth(B_TRANSLATE("Check every")) + 6; tile.right = 80 + labelWidth; - fIntervalControl = new BTextControl(tile, "time", TR("Check every"), NULL, - NULL); + fIntervalControl = new BTextControl(tile, "time", + B_TRANSLATE("Check every"), NULL, NULL); fIntervalControl->SetDivider(labelWidth); box->AddChild(fIntervalControl); BPopUpMenu *frequencyPopUp = new BPopUpMenu(B_EMPTY_STRING); const char *frequencyStrings[] = { - TR("never"), - TR("minutes"), - TR("hours"), - TR("days")}; + B_TRANSLATE("never"), + B_TRANSLATE("minutes"), + B_TRANSLATE("hours"), + B_TRANSLATE("days")}; BMenuItem *item; for (int32 i = 0; i < 4; i++) { frequencyPopUp->AddItem(item = new BMenuItem(frequencyStrings[i], @@ -357,28 +360,29 @@ ConfigWindow::ConfigWindow() rect.OffsetBy(0,height + 9); rect.bottom -= 2; fPPPActiveCheckBox = new BCheckBox(rect, "ppp active", - TR("Only when dial-up is connected"), NULL); + B_TRANSLATE("Only when dial-up is connected"), NULL); box->AddChild(fPPPActiveCheckBox); rect.OffsetBy(0,height + 9); rect.bottom -= 2; fPPPActiveSendCheckBox = new BCheckBox(rect, "ppp activesend", - TR("Schedule outgoing mail when dial-up is disconnected"), NULL); + B_TRANSLATE("Schedule outgoing mail when dial-up is disconnected"), + NULL); box->AddChild(fPPPActiveSendCheckBox); // Miscellaneous settings box rect = box->Frame(); rect.bottom = rect.top + 3 * height + 30; box = new BBox(rect); - box->SetLabel(TR("Miscellaneous")); + box->SetLabel(B_TRANSLATE("Miscellaneous")); view->AddChild(box); BPopUpMenu *statusPopUp = new BPopUpMenu(B_EMPTY_STRING); const char *statusModes[] = { - TR("Never"), - TR("While sending"), - TR("While sending and receiving"), - TR("Always")}; + B_TRANSLATE("Never"), + B_TRANSLATE("While sending"), + B_TRANSLATE("While sending and receiving"), + B_TRANSLATE("Always")}; BMessage *msg; for (int32 i = 0; i < 4; i++) { statusPopUp->AddItem(item = new BMenuItem(statusModes[i], @@ -391,16 +395,18 @@ ConfigWindow::ConfigWindow() rect.top += 7; rect.bottom = rect.top + height + 5; labelWidth - = (int32)view->StringWidth(TR("Show connection status window:")) + 8; + = (int32)view->StringWidth( + B_TRANSLATE("Show connection status window:")) + 8; fStatusModeField = new BMenuField(rect, "show status", - TR("Show connection status window:"), statusPopUp); + B_TRANSLATE("Show connection status window:"), statusPopUp); fStatusModeField->SetDivider(labelWidth); box->AddChild(fStatusModeField); rect = fStatusModeField->Frame();; rect.OffsetBy(0, rect.Height() + 10); BButton *button = new BButton(rect, B_EMPTY_STRING, - TR("Edit mailbox menu…"), msg = new BMessage(B_REFS_RECEIVED)); + B_TRANSLATE("Edit mailbox menu…"), + msg = new BMessage(B_REFS_RECEIVED)); button->ResizeToPreferred(); box->AddChild(button); button->SetTarget(BMessenger("application/x-vnd.Be-TRAK")); @@ -420,7 +426,7 @@ ConfigWindow::ConfigWindow() rect = button->Frame(); rect.OffsetBy(rect.Width() + 30,0); fAutoStartCheckBox = new BCheckBox(rect, "start daemon", - TR("Start mail services on startup"), NULL); + B_TRANSLATE("Start mail services on startup"), NULL); fAutoStartCheckBox->ResizeToPreferred(); box->AddChild(fAutoStartCheckBox); @@ -431,7 +437,7 @@ ConfigWindow::ConfigWindow() rect = tabView->Frame(); rect.top = rect.bottom + 5; rect.bottom = rect.top + height + 5; - BButton *saveButton = new BButton(rect, "apply", TR("Apply"), + BButton *saveButton = new BButton(rect, "apply", B_TRANSLATE("Apply"), new BMessage(kMsgSaveSettings)); float w,h; saveButton->GetPreferredSize(&w, &h); @@ -439,7 +445,7 @@ ConfigWindow::ConfigWindow() saveButton->MoveTo(rect.right - w, rect.top); top->AddChild(saveButton); - BButton *revertButton = new BButton(rect, "revert", TR("Revert"), + BButton *revertButton = new BButton(rect, "revert", B_TRANSLATE("Revert"), new BMessage(kMsgRevertSettings)); revertButton->GetPreferredSize(&w, &h); revertButton->ResizeTo(w,h); @@ -507,7 +513,8 @@ ConfigWindow::MakeHowToView() B_WILL_DRAW); text->SetViewColor(fConfigView->Parent()->ViewColor()); text->SetAlignment(B_ALIGN_CENTER); - text->SetText(TR("\n\nCreate a new account with the Add button.\n\n" + text->SetText(B_TRANSLATE( + "\n\nCreate a new account with the Add button.\n\n" "Remove an account with the Remove button on the selected item.\n\n" "Select an item in the list to change its settings.")); rect = text->Bounds(); @@ -536,7 +543,7 @@ ConfigWindow::LoadSettings() // move own window MoveTo(settings.ConfigWindowFrame().LeftTop()); } else { - fprintf(stderr, TR("Error retrieving general settings: %s\n"), + fprintf(stderr, B_TRANSLATE("Error retrieving general settings: %s\n"), strerror(status)); } @@ -768,7 +775,8 @@ ConfigWindow::RevertToLastSettings() status_t status = SetToGeneralSettings(&settings); if (status != B_OK) { char text[256]; - sprintf(text, TR("\nThe general settings couldn't be reverted.\n\n" + sprintf(text, B_TRANSLATE( + "\nThe general settings couldn't be reverted.\n\n" "Error retrieving general settings:\n%s\n"), strerror(status)); (new BAlert("Error", text, "OK", NULL, NULL, B_WIDTH_AS_USUAL,