Patch by Mike Roll: localize Mail preferences.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40029 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-12-29 10:44:39 +00:00
parent 4915d3ef43
commit f2758b750b
6 changed files with 66 additions and 48 deletions

View File

@ -1,5 +1,6 @@
#include "AutoConfigView.h"
#include <Catalog.h>
#include <Directory.h>
#include <Entry.h>
#include <FindDirectory.h>
@ -13,6 +14,10 @@
#include <MailSettings.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "E-Mail"
AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
: BBox(rect),
fAutoConfig(config)
@ -25,15 +30,15 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
// type view
BPopUpMenu *chainsPopUp = new BPopUpMenu(B_EMPTY_STRING);
const char *chainModes[] = {
"Receive mail only",
"Send mail only",
"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], NULL));
fTypeField = new BMenuField(BRect(topLeft, rightDown), NULL,
"Account Type:", chainsPopUp);
B_TRANSLATE("Account Type:"), chainsPopUp);
fTypeField->SetDivider(divider);
fTypeField->Menu()->ItemAt(2)->SetMarked(true);
//fAccount->SetType(2);
@ -55,7 +60,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fEmailView = new BTextControl(BRect(topLeft, rightDown),
"email", "E-mail address:", "",
"email", B_TRANSLATE("E-mail address:"), "",
new BMessage(kEMailChangedMsg));
fEmailView->SetDivider(divider);
AddChild(fEmailView);
@ -64,7 +69,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fLoginNameView = new BTextControl(BRect(topLeft, rightDown),
"login", "Login name:", "",
"login", B_TRANSLATE("Login name:"), "",
NULL);
fLoginNameView->SetDivider(divider);
AddChild(fLoginNameView);
@ -73,7 +78,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fPasswordView = new BTextControl(BRect(topLeft, rightDown),
"password", "Password:", "",
"password", B_TRANSLATE("Password:"), "",
NULL);
fPasswordView->SetDivider(divider);
fPasswordView->TextView()->HideTyping(true);
@ -83,7 +88,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fAccountNameView = new BTextControl(BRect(topLeft, rightDown),
"account", "Account name:", "",
"account", B_TRANSLATE("Account name:"), "",
NULL);
fAccountNameView->SetDivider(divider);
AddChild(fAccountNameView);
@ -92,7 +97,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fNameView = new BTextControl(BRect(topLeft, rightDown),
"name", "Real name:", "",
"name", B_TRANSLATE("Real name:"), "",
NULL);
AddChild(fNameView);
fNameView->SetDivider(divider);
@ -170,7 +175,7 @@ AutoConfigView::GetBasicAccountInfo(account_info &info)
BMenuField*
AutoConfigView::SetupProtokolView(BRect rect)
{
BPopUpMenu *menu = new BPopUpMenu("Choose Protocol");
BPopUpMenu *menu = new BPopUpMenu(B_TRANSLATE("Choose Protocol"));
for (int i = 0; i < 2; i++) {
BPath path;
@ -317,7 +322,7 @@ ServerSettingsView::ServerSettingsView(BRect rect, const account_info &info)
boxRect.bottom -= 5;
BBox *box = new BBox(boxRect);
box->SetLabel("Inbound");
box->SetLabel(B_TRANSLATE("Inbound"));
AddChild(box);
BString serverName;
@ -327,7 +332,7 @@ ServerSettingsView::ServerSettingsView(BRect rect, const account_info &info)
serverName = info.providerInfo.pop_server;
fInboundNameView = new BTextControl(BRect(10, 20, rect.Width() - 20, 35),
"inbound", "Server Name:",
"inbound", B_TRANSLATE("Server Name:"),
serverName.String(),
new BMessage(kServerChangedMsg));
fInboundNameView->SetDivider(divider);
@ -378,12 +383,12 @@ ServerSettingsView::ServerSettingsView(BRect rect, const account_info &info)
boxRect.top += 5;
box = new BBox(boxRect);
box->SetLabel("Outbound");
box->SetLabel(B_TRANSLATE("Outbound"));
AddChild(box);
serverName = info.providerInfo.smtp_server;
fOutboundNameView = new BTextControl(BRect(10, 20, rect.Width() - 20, 30),
"outbound", "Server name:",
"outbound", B_TRANSLATE("Server name:"),
serverName.String(),
new BMessage(kServerChangedMsg));
fOutboundNameView->SetDivider(divider);

View File

@ -5,6 +5,7 @@
#include <Alert.h>
#include <Application.h>
#include <Catalog.h>
#include <MailSettings.h>
#include <Message.h>
@ -15,7 +16,7 @@
AutoConfigWindow::AutoConfigWindow(BRect rect, BWindow *parent)
: BWindow(rect, "Create new account", B_TITLED_WINDOW_LOOK,
: BWindow(rect, B_TRANSLATE("Create new account"), B_TITLED_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT,
B_ALL_WORKSPACES),
@ -37,14 +38,14 @@ AutoConfigWindow::AutoConfigWindow(BRect rect, BWindow *parent)
buttonRect.top = buttonRect.bottom - buttonHeight;
buttonRect.left = buttonRect.right - 2 * buttonWidth - 5;
buttonRect.right = buttonRect.left + buttonWidth;
fBackButton = new BButton(buttonRect, "back", "Back",
fBackButton = new BButton(buttonRect, "back", B_TRANSALATE("Back"),
new BMessage(kBackMsg));
fBackButton->SetEnabled(false);
fRootView->AddChild(fBackButton);
buttonRect.left+= 5 + buttonWidth;
buttonRect.right = buttonRect.left + buttonWidth;
fNextButton = new BButton(buttonRect, "ok", "OK", new BMessage(kOkMsg));
fNextButton = new BButton(buttonRect, "ok", B_TRANSLATE("OK"), new BMessage(kOkMsg));
fNextButton->MakeDefault(true);
fRootView->AddChild(fNextButton);
@ -53,7 +54,7 @@ AutoConfigWindow::AutoConfigWindow(BRect rect, BWindow *parent)
fBoxRect.bottom-= buttonHeight + 5;
fMainView = new AutoConfigView(fBoxRect, fAutoConfig);
fMainView->SetLabel("Account settings");
fMainView->SetLabel(B_TRANSLATE("Account settings"));
fRootView->AddChild(fMainView);
// Add a shortcut to close the window using Command-W
@ -81,8 +82,8 @@ AutoConfigWindow::MessageReceived(BMessage* msg)
fMainView->GetBasicAccountInfo(fAccountInfo);
if (!fMainView->IsValidMailAddress(fAccountInfo.email)) {
invalidMailAlert = new BAlert("invalidMailAlert",
"Enter a valid e-mail address.",
"OK");
B_TRANSLATE("Enter a valid e-mail address."),
B_TRANSLATE("OK"));
invalidMailAlert->Go();
return;
}

View File

@ -290,7 +290,7 @@ ProtocolsConfigView::ProtocolsConfigView(BMailChain *chain, int32 index,
:
FilterConfigView(chain, index, msg, ref)
{
BPopUpMenu *menu = new BPopUpMenu("Choose Protocol");
BPopUpMenu *menu = new BPopUpMenu(B_TRANSLATE("Choose Protocol"));
for (int i = 0; i < 2; i++) {
BPath path;
@ -838,7 +838,7 @@ FiltersConfigView::MessageReceived(BMessage *msg)
fChain->RemoveFilter(from);
if (fChain->AddFilter(to, settings, ref) < B_OK) {
(new BAlert("E-mail",
(new BAlert(B_TRANSLATE("E-mail"),
B_TRANSLATE("The filter could not be moved. "
"Deleting filter."),
B_TRANSLATE("OK")))->Go();

View File

@ -15,6 +15,7 @@
#include "AutoConfigWindow.h"
#include <Application.h>
#include <Catalog.h>
#include <ListView.h>
#include <ScrollView.h>
#include <StringView.h>
@ -163,21 +164,24 @@ class AboutTextView : public BTextView
}
}
// prepare version variety string
const char *varietyStrings[] = {"Development","Alpha","Beta","Gamma","Golden master","Final"};
const char *varietyStrings[] = {B_TRANSLATE("Development"),
B_TRANSLATE("Alpha"),B_TRANSLATE("Beta"),B_TRANSLATE("Gamma"),
B_TRANSLATE("Golden master"),B_TRANSLATE("Final")};
char varietyString[32];
strcpy(varietyString,varietyStrings[variety % 6]);
if (variety < 5)
sprintf(varietyString + strlen(varietyString),"/%li",internal);
char s[512];
sprintf(s, "Mail Daemon Replacement\n\n"
sprintf(s, B_TRANSLATE("Mail Daemon Replacement\n\n"
"by Haiku, Inc. All rights reserved.\n\n"
"Version %ld.%ld.%ld %s\n\n"
"See LICENSE file included in the installation package for more information.\n\n\n\n"
"See LICENSE file included in the installation package "
"for more information.\n\n\n\n"
"You can contact us at:\n"
"%s\n\n"
"Please submit bug reports using the %s\n\n"
"Project homepage at:\n%s",
"Project homepage at:\n%s"),
major,middle,minor,varietyString,
kEMail,kBugsitePretty,kWebsite);
@ -251,8 +255,9 @@ class AboutTextView : public BTextView
ConfigWindow::ConfigWindow()
:
BWindow(BRect(100.0, 100.0, 580.0, 540.0), "E-mail", B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
BWindow(BRect(100.0, 100.0, 580.0, 540.0), B_TRANSLATE("E-mail"),
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
| B_NOT_RESIZABLE),
fLastSelectedAccount(NULL),
fSaveSettings(false)
{
@ -779,8 +784,8 @@ ConfigWindow::RevertToLastSettings()
"\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,
B_WARNING_ALERT))->Go();
(new BAlert(B_TRANSLATE("Error"), text, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
}
// revert account data

View File

@ -4,6 +4,7 @@
#include <stdio.h>
#include <ByteOrder.h>
#include <Catalog.h>
#include <FindDirectory.h>
#include <NetAddress.h>
#include <NetEndpoint.h>
@ -18,6 +19,8 @@
#define PRINT(a...)
#endif
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "E-Mail"
static vint32 gID = 1;
@ -167,8 +170,8 @@ DNSTools::GetDNSServers(BObjectList<BString>* serverList)
register FILE* fp = fopen(path.Path(), "r");
if (fp == NULL) {
fprintf(stderr, "failed to open '%s' to read nameservers: %s\n",
path.Path(), strerror(errno));
fprintf(stderr, B_TRANSLATE("failed to open '%s' to read "
"nameservers: %s\n"), path.Path(), strerror(errno));
return B_ENTRY_NOT_FOUND;
}
@ -283,7 +286,7 @@ DNSQuery::ReadDNSServer(in_addr* add)
if (firstDNS == NULL || inet_aton(firstDNS->String(), add) != 1)
return B_ERROR;
PRINT("dns server found: %s \n", firstDNS->String());
PRINT(B_TRANSLATE("dns server found: %s \n"), firstDNS->String());
return B_OK;
}
@ -309,7 +312,7 @@ DNSQuery::GetMXRecords(BString serverName, BObjectList<mx_record>* mxList,
buffer.AppendUint16(uint16(1));
// send the buffer
PRINT("send buffer\n");
PRINT(B_TRANSLATE("send buffer\n"));
BNetAddress netAddress(dnsAddress, 53);
BNetEndpoint netEndpoint(SOCK_DGRAM);
if (netEndpoint.InitCheck() != B_OK)
@ -317,13 +320,13 @@ DNSQuery::GetMXRecords(BString serverName, BObjectList<mx_record>* mxList,
if (netEndpoint.Connect(netAddress) != B_OK)
return B_ERROR;
PRINT("Connected\n");
PRINT(B_TRANSLATE"Connected\n");
#ifdef DEBUG
int32 bytesSend =
#endif
netEndpoint.Send(buffer.Data(), buffer.Size());
PRINT("bytes send %i\n", int(bytesSend));
PRINT(B_TRANSLATE("bytes send %i\n"), int(bytesSend));
// receive buffer
BRawNetBuffer receiBuffer(512);
@ -332,15 +335,15 @@ DNSQuery::GetMXRecords(BString serverName, BObjectList<mx_record>* mxList,
int32 bytesRecei =
#endif
netEndpoint.ReceiveFrom(receiBuffer.Data(), 512, netAddress);
PRINT("bytes received %i\n", int(bytesRecei));
PRINT(B_TRANSLATE("bytes received %i\n"), int(bytesRecei));
dns_header receiHeader;
_ReadQueryHeader(receiBuffer, &receiHeader);
PRINT("Package contains :");
PRINT("%d Questions, ", receiHeader.q_count);
PRINT("%d Answers, ", receiHeader.ans_count);
PRINT("%d Authoritative Servers, ", receiHeader.auth_count);
PRINT("%d Additional records\n", receiHeader.add_count);
PRINT(B_TRANSLATE("Package contains :"));
PRINT(B_TRANSLATE("%d Questions, "), receiHeader.q_count);
PRINT(B_TRANSLATE("%d Answers,) ", receiHeader.ans_count);
PRINT(B_TRANSLATE("%d Authoritative Servers, "), receiHeader.auth_count);
PRINT(B_TRANSLATE("%d Additional records\n"), receiHeader.add_count);
// remove name and Question
BString dummyS;
@ -356,7 +359,7 @@ DNSQuery::GetMXRecords(BString serverName, BObjectList<mx_record>* mxList,
if (rrHead.type == MX_RECORD) {
mx_record *mxRec = new mx_record;
_ReadMXRecord(receiBuffer, mxRec);
PRINT("MX record found pri %i, name %s\n",
PRINT(B_TRANSLATE("MX record found pri %i, name %s\n"),
mxRec->priority,
mxRec->serverName.String());
// Add mx record to the list

View File

@ -50,11 +50,15 @@ Preference E-mail
: e-mail.rdef
;
DoCatalogs E-mail
: x-vnd.Haiku-Mail
: Account.cpp
ConfigViews.cpp
ConfigWindow.cpp
DoCatalogs E-mail :
x-vnd.Haiku-Mail
:
Account.cpp
AutoConfiView.cpp
ConfigViews.cpp
ConfigWindow.cpp
DNSQuery.cpp
main.cpp
;
Package haiku-maildaemon-cvs :