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

View File

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

View File

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

View File

@ -15,6 +15,7 @@
#include "AutoConfigWindow.h" #include "AutoConfigWindow.h"
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <ListView.h> #include <ListView.h>
#include <ScrollView.h> #include <ScrollView.h>
#include <StringView.h> #include <StringView.h>
@ -163,21 +164,24 @@ class AboutTextView : public BTextView
} }
} }
// prepare version variety string // 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]; char varietyString[32];
strcpy(varietyString,varietyStrings[variety % 6]); strcpy(varietyString,varietyStrings[variety % 6]);
if (variety < 5) if (variety < 5)
sprintf(varietyString + strlen(varietyString),"/%li",internal); sprintf(varietyString + strlen(varietyString),"/%li",internal);
char s[512]; 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" "by Haiku, Inc. All rights reserved.\n\n"
"Version %ld.%ld.%ld %s\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" "You can contact us at:\n"
"%s\n\n" "%s\n\n"
"Please submit bug reports using the %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, major,middle,minor,varietyString,
kEMail,kBugsitePretty,kWebsite); kEMail,kBugsitePretty,kWebsite);
@ -251,8 +255,9 @@ class AboutTextView : public BTextView
ConfigWindow::ConfigWindow() ConfigWindow::ConfigWindow()
: :
BWindow(BRect(100.0, 100.0, 580.0, 540.0), "E-mail", B_TITLED_WINDOW, BWindow(BRect(100.0, 100.0, 580.0, 540.0), B_TRANSLATE("E-mail"),
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
| B_NOT_RESIZABLE),
fLastSelectedAccount(NULL), fLastSelectedAccount(NULL),
fSaveSettings(false) fSaveSettings(false)
{ {
@ -779,8 +784,8 @@ ConfigWindow::RevertToLastSettings()
"\nThe general settings couldn't be reverted.\n\n" "\nThe general settings couldn't be reverted.\n\n"
"Error retrieving general settings:\n%s\n"), "Error retrieving general settings:\n%s\n"),
strerror(status)); strerror(status));
(new BAlert("Error", text, "OK", NULL, NULL, B_WIDTH_AS_USUAL, (new BAlert(B_TRANSLATE("Error"), text, B_TRANSLATE("OK"), NULL, NULL,
B_WARNING_ALERT))->Go(); B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
} }
// revert account data // revert account data

View File

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

View File

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