More localization support by taos, thanks!

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42344 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2011-06-29 22:37:44 +00:00
parent c30f4641fa
commit 83c3aba207
20 changed files with 127 additions and 68 deletions
@@ -55,15 +55,15 @@ RuleFilterConfig::RuleFilterConfig(const BMessage *settings)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
attr = new BTextControl(BRect(5,5,100,20),"attr", B_TRANSLATE("If"),
B_TRANSLATE("header (e.g. Subject)"),NULL);
attr->SetDivider(be_plain_font->StringWidth(B_TRANSLATE("If "))+ 4);
attr->SetDivider(be_plain_font->StringWidth(B_TRANSLATE("If"))+ 4);
if (settings->HasString("attribute"))
attr->SetText(settings->FindString("attribute"));
AddChild(attr);
regex = new BTextControl(BRect(104,5,255,20),"attr", B_TRANSLATE(" has "),
regex = new BTextControl(BRect(104,5,255,20),"attr", B_TRANSLATE("has"),
B_TRANSLATE("value (use REGEX: in from of regular expressions like "
"*spam*)"), NULL);
regex->SetDivider(be_plain_font->StringWidth(B_TRANSLATE(" has ")) + 4);
regex->SetDivider(be_plain_font->StringWidth(B_TRANSLATE("has")) + 4);
if (settings->HasString("regex"))
regex->SetText(settings->FindString("regex"));
AddChild(regex);
@@ -21,4 +21,5 @@ DoCatalogs MatchHeader
x-vnd.Haiku-MatchHeader
:
ConfigView.cpp
RuleFilter.cpp
;
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <Catalog.h>
#include <Directory.h>
#include <fs_attr.h>
#include <Node.h>
@@ -17,6 +18,10 @@
#include <MailProtocol.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "RuleFilter"
RuleFilter::RuleFilter(MailProtocol& protocol, AddonSettings* addonSettings)
:
MailFilter(protocol, addonSettings)
@@ -123,7 +128,7 @@ descriptive_name()
sprintf(buffer + strlen(buffer), " against \"%s\"", reg);
return B_OK;*/
return "Rule filter";
return B_TRANSLATE("Rule filter");
}
@@ -33,7 +33,8 @@ ConfigView::ConfigView()
// determine font height
font_height fontHeight;
GetFontHeight(&fontHeight);
float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 6;
float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent
+ fontHeight.leading) + 6;
BRect frame(5,2,250,itemHeight + 2);
BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING,false,false);
@@ -105,7 +106,7 @@ void ConfigView::UpdateNotifyText()
label.Prepend(item->Label());
}
if (label == "")
label = "none";
label = B_TRANSLATE("none");
field->MenuItem()->SetLabel(label.String());
}
@@ -171,5 +172,5 @@ instantiate_filter_config_panel(AddonSettings& settings)
BString
descriptive_name()
{
return "New mails notification";
return B_TRANSLATE("New mails notification");
}
@@ -78,7 +78,7 @@ NotifyFilter::MailboxSynced(status_t status)
text.ReplaceFirst("%name", fMailProtocol.AccountSettings().Name());
BAlert *alert = new BAlert(B_TRANSLATE("New messages"), text.String(),
"OK", NULL, NULL, B_WIDTH_AS_USUAL);
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL);
alert->SetFeel(B_NORMAL_WINDOW_FEEL);
alert->Go(NULL);
}
@@ -98,11 +98,15 @@ NotifyFilter::MailboxSynced(status_t status)
}
if (fStrategy & log_window) {
BString message;
BString message, numString;
if (fNNewMessages != 1)
message << fNNewMessages << B_TRANSLATE(" new messages");
message << B_TRANSLATE("%num new messages");
else
message << fNNewMessages << B_TRANSLATE(" new message");
message << B_TRANSLATE("%num new message");
numString << fNNewMessages;
message.ReplaceFirst("%num", numString);
fMailProtocol.ShowMessage(message.String());
}
@@ -6,9 +6,19 @@ UsePublicHeaders [ FDirName add-ons mail_daemon ] ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ;
AddResources SpamFilter : SpamFilter.rdef ;
Addon SpamFilter :
SpamFilterConfig.cpp
SpamFilter.cpp
:
be libmail.so $(TARGET_LIBSUPC++)
be libmail.so $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++)
;
DoCatalogs SpamFilter
:
x-vnd.Haiku-SpamFilter
:
SpamFilter.cpp
SpamFilterConfig.cpp
;
@@ -113,6 +113,7 @@
*/
#include <Beep.h>
#include <Catalog.h>
#include <fs_attr.h>
#include <Messenger.h>
#include <Node.h>
@@ -127,6 +128,11 @@
#include "SpamFilter.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "SpamFilter"
// The names match the ones set up by spamdbm for sound effects.
static const char *kAGMSBayesBeepGenuineName = "SpamFilter-Genuine";
static const char *kAGMSBayesBeepSpamName = "SpamFilter-Spam";
@@ -426,7 +432,7 @@ AGMSBayesianSpamFilter::_AddSpamToSubject(BNode* file, float spamRatio)
BString
descriptive_name()
{
return "Spam Filter (AGMS Bayesian)";
return B_TRANSLATE("Spam Filter (AGMS Bayesian)");
}
@@ -80,6 +80,7 @@
#include <Alert.h>
#include <Button.h>
#include <Catalog.h>
#include <CheckBox.h>
#include <Message.h>
#include <Messenger.h>
@@ -93,6 +94,11 @@
#include <MailAddon.h>
#include <FileConfigView.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "SpamFilterConfig"
static const char *kServerSignature = "application/x-vnd.agmsmith.spamdbm";
class AGMSBayesianSpamFilterConfig : public BView {
@@ -179,7 +185,7 @@ void AGMSBayesianSpamFilterConfig::AttachedToWindow ()
fAddSpamToSubjectCheckBoxPntr = new BCheckBox (
tempRect,
"AddToSubject",
"Add spam rating to start of subject",
B_TRANSLATE("Add spam rating to start of subject"),
new BMessage (kAddSpamToSubjectPressed));
AddChild (fAddSpamToSubjectCheckBoxPntr);
fAddSpamToSubjectCheckBoxPntr->ResizeToPreferred ();
@@ -195,7 +201,7 @@ void AGMSBayesianSpamFilterConfig::AttachedToWindow ()
fNoWordsMeansSpamCheckBoxPntr = new BCheckBox (
tempRect,
"NoWordsMeansSpam",
"or empty e-mail",
B_TRANSLATE("or empty e-mail"),
new BMessage (kNoWordsMeansSpam));
AddChild (fNoWordsMeansSpamCheckBoxPntr);
fNoWordsMeansSpamCheckBoxPntr->ResizeToPreferred ();
@@ -210,7 +216,7 @@ void AGMSBayesianSpamFilterConfig::AttachedToWindow ()
tempRect.right = fNoWordsMeansSpamCheckBoxPntr->Frame().left -
be_plain_font->StringWidth ("a");
tempStringPntr = "Spam above:";
tempStringPntr = B_TRANSLATE("Spam above:");
sprintf (numberString, "%06.4f", (double) fSpamCutoffRatio);
fSpamCutoffRatioTextBoxPntr = new BTextControl (
tempRect,
@@ -229,7 +235,7 @@ void AGMSBayesianSpamFilterConfig::AttachedToWindow ()
// Add the box displaying the genuine cutoff ratio, on a line by itself.
tempStringPntr = "Genuine below and uncertain above:";
tempStringPntr = B_TRANSLATE("Genuine below and uncertain above:");
sprintf (numberString, "%08.6f", (double) fGenuineCutoffRatio);
fGenuineCutoffRatioTextBoxPntr = new BTextControl (
tempRect,
@@ -251,7 +257,7 @@ void AGMSBayesianSpamFilterConfig::AttachedToWindow ()
fAutoTrainingCheckBoxPntr = new BCheckBox (
tempRect,
"autoTraining",
"Learn from all incoming e-mail",
B_TRANSLATE("Learn from all incoming e-mail"),
new BMessage (kAutoTrainingPressed));
AddChild (fAutoTrainingCheckBoxPntr);
fAutoTrainingCheckBoxPntr->ResizeToPreferred ();
@@ -415,9 +421,9 @@ AGMSBayesianSpamFilterConfig::ShowSpamServerConfigurationWindow () {
return; // Successful.
ErrorExit:
(new BAlert ("SpamFilterConfig Error", "Sorry, unable to launch the "
"spamdbm program to let you edit the server settings.",
"Close"))->Go ();
(new BAlert ("SpamFilterConfig Error", B_TRANSLATE("Sorry, unable to "
"launch the spamdbm program to let you edit the server settings."),
B_TRANSLATE("Close")))->Go ();
return;
}
@@ -60,8 +60,8 @@ IMAPConfig::IMAPConfig(MailAddonSettings& settings,
fAddonSettings(settings)
{
#ifdef USE_SSL
AddFlavor("No encryption");
AddFlavor("SSL");
AddFlavor(B_TRANSLATE("No encryption"));
AddFlavor(B_TRANSLATE("SSL"));
#endif
SetTo(settings);
@@ -42,12 +42,12 @@ POP3ConfigView::POP3ConfigView(MailAddonSettings& settings,
#endif
)
{
AddAuthMethod("Plain text");
AddAuthMethod("APOP");
AddAuthMethod(B_TRANSLATE("Plain text"));
AddAuthMethod(B_TRANSLATE("APOP"));
#if USE_SSL
AddFlavor("No encryption");
AddFlavor("SSL");
AddFlavor(B_TRANSLATE("No encryption"));
AddFlavor(B_TRANSLATE("SSL"));
#endif
SetTo(settings);
@@ -343,8 +343,12 @@ POP3Protocol::Open(const char *server, int port, int)
fLog = "";
// Prime the error message
BString error_msg;
error_msg << B_TRANSLATE("Error while connecting to server ") << server;
BString error_msg, servString;
error_msg << B_TRANSLATE("Error while connecting to server %serv");
servString << server;
error_msg.ReplaceFirst("%serv", servString);
if (port != 110)
error_msg << ":" << port;
@@ -445,8 +449,11 @@ POP3Protocol::Login(const char *uid, const char *password, int method)
{
status_t err;
BString error_msg;
error_msg << B_TRANSLATE("Error while authenticating user ") << uid;
BString error_msg, userString;
error_msg << B_TRANSLATE("Error while authenticating user %user");
userString << uid;
error_msg.ReplaceFirst("%user", userString);
if (method == 1) { //APOP
int32 index = fLog.FindFirst("<");
@@ -57,7 +57,7 @@ void ConfigView::SetTo(const BMessage *archive)
BString path = archive->FindString("tag_line");
if (!archive->HasString("tag_line"))
path = "Fortune cookie says:\n\n";
path = B_TRANSLATE("Fortune cookie says:\n\n");
path.Truncate(path.Length() - 2);
if (BTextControl *control = (BTextControl *)FindView("tag_line"))
@@ -44,9 +44,9 @@ SMTPConfigView::SMTPConfigView(MailAddonSettings& settings,
)
{
#ifdef USE_SSL
AddFlavor("Unencrypted");
AddFlavor("SSL");
AddFlavor("STARTTLS");
AddFlavor(B_TRANSLATE("Unencrypted"));
AddFlavor(B_TRANSLATE("SSL"));
AddFlavor(B_TRANSLATE("STARTTLS"));
#endif
AddAuthMethod(B_TRANSLATE("None"), false);
@@ -54,7 +54,7 @@ SMTPConfigView::SMTPConfigView(MailAddonSettings& settings,
AddAuthMethod(B_TRANSLATE("POP3 before SMTP"), false);
BTextControl *control = (BTextControl *)(FindView("host"));
control->SetLabel(B_TRANSLATE("SMTP server: "));
control->SetLabel(B_TRANSLATE("SMTP server:"));
// Reset the dividers after changing one
float widestLabel = 0;
@@ -281,8 +281,8 @@ SMTPProtocol::Connect()
status = Open(fSettingsMessage.FindString("server"),
fSettingsMessage.FindInt32("port"), authMethod == 1);
if (status < B_OK) {
error_msg << B_TRANSLATE("Error while opening connection to ")
<< fSettingsMessage.FindString("server");
error_msg << B_TRANSLATE("Error while opening connection to %serv");
error_msg.ReplaceFirst("%serv", fSettingsMessage.FindString("server"));
if (fSettingsMessage.FindInt32("port") > 0)
error_msg << ":" << fSettingsMessage.FindInt32("port");
@@ -304,9 +304,11 @@ SMTPProtocol::Connect()
if (status != B_OK) {
//-----This is a really cool kind of error message. How can we make it work for POP3?
error_msg << B_TRANSLATE("Error while logging in to ")
<< fSettingsMessage.FindString("server")
error_msg << B_TRANSLATE("Error while logging in to %serv")
<< B_TRANSLATE(". The server said:\n") << fLog;
error_msg.ReplaceFirst("%serv", fSettingsMessage.FindString("server"));
ShowError(error_msg.String());
}
return B_OK;
+6 -6
View File
@@ -49,7 +49,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fEmailView = new BTextControl(BRect(topLeft, rightDown), "email",
"E-mail address:", "", new BMessage(kEMailChangedMsg));
B_TRANSLATE("E-mail address:"), "", new BMessage(kEMailChangedMsg));
fEmailView->SetDivider(divider);
AddChild(fEmailView);
@@ -57,7 +57,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fLoginNameView = new BTextControl(BRect(topLeft, rightDown),
"login", "Login name:", "", NULL);
"login", B_TRANSLATE("Login name:"), "", NULL);
fLoginNameView->SetDivider(divider);
AddChild(fLoginNameView);
@@ -65,7 +65,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fPasswordView = new BTextControl(BRect(topLeft, rightDown), "password",
"Password:", "", NULL);
B_TRANSLATE("Password:"), "", NULL);
fPasswordView->SetDivider(divider);
fPasswordView->TextView()->HideTyping(true);
AddChild(fPasswordView);
@@ -74,7 +74,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fAccountNameView = new BTextControl(BRect(topLeft, rightDown), "account",
"Account name:", "", NULL);
B_TRANSLATE("Account name:"), "", NULL);
fAccountNameView->SetDivider(divider);
AddChild(fAccountNameView);
@@ -82,7 +82,7 @@ AutoConfigView::AutoConfigView(BRect rect, AutoConfig &config)
topLeft.y += stepSize;
rightDown.y += stepSize;
fNameView = new BTextControl(BRect(topLeft, rightDown), "name",
"Real name:", "", NULL);
B_TRANSLATE("Real name:"), "", NULL);
AddChild(fNameView);
fNameView->SetDivider(divider);
}
@@ -312,7 +312,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:", serverName.String(),
"inbound", B_TRANSLATE("Server Name:"), serverName.String(),
new BMessage(kServerChangedMsg));
fInboundNameView->SetDivider(divider);
+3 -2
View File
@@ -29,7 +29,7 @@
AutoConfigWindow::AutoConfigWindow(BRect rect, ConfigWindow *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),
fParentWindow(parent),
@@ -93,7 +93,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;
}
+7 -5
View File
@@ -648,8 +648,10 @@ ConfigWindow::MessageReceived(BMessage *msg)
BPopUpMenu rightClickMenu("accounts", false, false);
BMenuItem* inMenuItem = new BMenuItem("Incoming", NULL);
BMenuItem* outMenuItem = new BMenuItem("Outgoing", NULL);
BMenuItem* inMenuItem = new BMenuItem(B_TRANSLATE("Incoming"),
NULL);
BMenuItem* outMenuItem = new BMenuItem(B_TRANSLATE("Outgoing"),
NULL);
rightClickMenu.AddItem(inMenuItem);
rightClickMenu.AddItem(outMenuItem);
@@ -896,18 +898,18 @@ ConfigWindow::_AddAccountToView(BMailAccountSettings* account)
item = new AccountItem(label, account, ACCOUNT_ITEM);
fAccountsListView->AddItem(item);
item = new AccountItem(B_TRANSLATE(" · Incoming"), account, INBOUND_ITEM);
item = new AccountItem(B_TRANSLATE("· Incoming"), account, INBOUND_ITEM);
fAccountsListView->AddItem(item);
if (!account->IsInboundEnabled())
item->SetEnabled(false);
item = new AccountItem(B_TRANSLATE(" · Outgoing"), account,
item = new AccountItem(B_TRANSLATE("· Outgoing"), account,
OUTBOUND_ITEM);
fAccountsListView->AddItem(item);
if (!account->IsOutboundEnabled())
item->SetEnabled(false);
item = new AccountItem(B_TRANSLATE(" · E-mail filters"), account,
item = new AccountItem(B_TRANSLATE("· E-mail filters"), account,
FILTER_ITEM);
fAccountsListView->AddItem(item);
}
+9 -4
View File
@@ -23,6 +23,7 @@ local sources =
main.cpp
;
AddResources E-mail : e-mail.rdef ;
Preference E-mail
:
@@ -30,13 +31,17 @@ Preference E-mail
:
be libmail.so $(HAIKU_NETWORK_LIBS) $(TARGET_NETAPI_LIB) $(TARGET_LIBSTDC++)
$(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
: e-mail.rdef
;
DoCatalogs E-mail
: x-vnd.Haiku-Mail
: ConfigViews.cpp
ConfigWindow.cpp
:
x-vnd.Haiku-Mail
:
AutoConfigView.cpp
AutoConfigWindow.cpp
ConfigViews.cpp
ConfigWindow.cpp
FilterConfigView.cpp
;
+6 -3
View File
@@ -541,11 +541,14 @@ DeskbarView::_BuildMenu()
// The New E-mail query
if (fNewMessages > 0) {
BString string;
BString string, numString;
if (fNewMessages != 1)
string << fNewMessages << B_TRANSLATE(" new messages");
string << B_TRANSLATE("%num new messages");
else
string << fNewMessages << B_TRANSLATE(" new message");
string << B_TRANSLATE("%num new message");
numString << fNewMessages;
string.ReplaceFirst("%num", numString);
_GetNewQueryRef(ref);
+14 -8
View File
@@ -96,9 +96,9 @@ MailDaemonApp::MailDaemonApp()
fAutoCheckRunner(NULL)
{
fErrorLogWindow = new ErrorLogWindow(BRect(200, 200, 500, 250),
"Mail daemon status log", B_TITLED_WINDOW);
B_TRANSLATE("Mail daemon status log"), B_TITLED_WINDOW);
fMailStatusWindow = new MailStatusWindow(BRect(40, 400, 360, 400),
"Mail Status", fSettingsFile.ShowStatusWindow());
B_TRANSLATE("Mail Status"), fSettingsFile.ShowStatusWindow());
// install MimeTypes, attributes, indices, and the
// system beep add startup
MakeMimeTypes();
@@ -162,12 +162,15 @@ MailDaemonApp::ReadyToRun()
fQueries.AddItem(query);
}
BString string;
BString string, numString;
if (fNewMessages > 0) {
if (fNewMessages != 1)
string << fNewMessages << B_TRANSLATE(" new messages.");
string << B_TRANSLATE("%num new messages.");
else
string << fNewMessages << B_TRANSLATE(" new message.");
string << B_TRANSLATE("%num new message.");
numString << fNewMessages;
string.ReplaceFirst("%num", numString);
}
else
string = B_TRANSLATE("No new messages");
@@ -543,13 +546,16 @@ MailDaemonApp::MessageReceived(BMessage* msg)
break;
}
BString string;
BString string, numString;
if (fNewMessages > 0) {
if (fNewMessages != 1)
string << fNewMessages << B_TRANSLATE(" new messages.");
string << B_TRANSLATE("%num new messages.");
else
string << fNewMessages << B_TRANSLATE(" new message.");
string << B_TRANSLATE("%num new message.");
numString << fNewMessages;
string.ReplaceFirst("%num", numString);
}
else
string << B_TRANSLATE("No new messages.");