diff --git a/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp b/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp index 6ff7251243..abe57d6d81 100644 --- a/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp @@ -4,6 +4,9 @@ */ +#include + +#include #include #include #include @@ -14,7 +17,10 @@ #include #include -#include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ConfigView" + const uint32 kMsgActionMoveTo = 'argm'; const uint32 kMsgActionDelete = 'argd'; @@ -40,7 +46,6 @@ class RuleFilterConfig : public BView { int32 chain; }; -#include RuleFilterConfig::RuleFilterConfig(const BMessage *settings) : @@ -48,25 +53,29 @@ RuleFilterConfig::RuleFilterConfig(const BMessage *settings) 0), menu(NULL) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - attr = new BTextControl(BRect(5,5,100,20),"attr",MDR_DIALECT_CHOICE ("If","条件:"),MDR_DIALECT_CHOICE ("header (e.g. Subject)","ヘッダ(例えばSubject)"),NULL); - attr->SetDivider(be_plain_font->StringWidth(MDR_DIALECT_CHOICE ("If ","条件: "))+ 4); + 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); if (settings->HasString("attribute")) attr->SetText(settings->FindString("attribute")); AddChild(attr); - regex = new BTextControl(BRect(104,5,255,20),"attr",MDR_DIALECT_CHOICE (" has "," が "),MDR_DIALECT_CHOICE ("value (use REGEX: in from of regular expressions like *spam*)","値(正規表現対応)"),NULL); - regex->SetDivider(be_plain_font->StringWidth(MDR_DIALECT_CHOICE (" has "," が ")) + 4); + 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); if (settings->HasString("regex")) regex->SetText(settings->FindString("regex")); AddChild(regex); - arg = new BFileControl(BRect(5,55,255,80),"arg",NULL,MDR_DIALECT_CHOICE ("this field is based on the action","ここは動作によって意味が変わります")); + arg = new BFileControl(BRect(5,55,255,80),"arg", NULL, + B_TRANSLATE("this field is based on the action")); if (BControl *control = (BControl *)arg->FindView("select_file")) control->SetEnabled(false); if (settings->HasString("argument")) arg->SetText(settings->FindString("argument")); - outbound = new BPopUpMenu(MDR_DIALECT_CHOICE ("","<アカウントを選択>")); + outbound = new BPopUpMenu(B_TRANSLATE("")); if (settings->HasInt32("do_what")) staging = settings->FindInt32("do_what"); @@ -96,17 +105,23 @@ void RuleFilterConfig::AttachedToWindow() { if (menu != NULL) return; // We switched back from another tab - menu = new BPopUpMenu(MDR_DIALECT_CHOICE ("","<動作を選択>")); - menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ("Move to","移動する"), new BMessage(kMsgActionMoveTo))); - menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ("Set flags to","フラグを指定する"), new BMessage(kMsgActionSetTo))); - menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ("Delete message","削除する"), new BMessage(kMsgActionDelete))); - menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ("Reply with","返事を書く"), new BMessage(kMsgActionReplyWith))); - menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ("Set as read","既読にする"), new BMessage(kMsgActionSetRead))); + menu = new BPopUpMenu(B_TRANSLATE("")); + menu->AddItem(new BMenuItem(B_TRANSLATE("Move to"), + new BMessage(kMsgActionMoveTo))); + menu->AddItem(new BMenuItem(B_TRANSLATE("Set flags to"), + new BMessage(kMsgActionSetTo))); + menu->AddItem(new BMenuItem(B_TRANSLATE("Delete message"), + new BMessage(kMsgActionDelete))); + menu->AddItem(new BMenuItem(B_TRANSLATE("Reply with"), + new BMessage(kMsgActionReplyWith))); + menu->AddItem(new BMenuItem(B_TRANSLATE("Set as read"), + new BMessage(kMsgActionSetRead))); menu->SetTargetForItems(this); - BMenuField *field = new BMenuField(BRect(5,30,210,50),"do_what",MDR_DIALECT_CHOICE ("Then","ならば"),menu); + BMenuField *field = new BMenuField(BRect(5,30,210,50),"do_what", + B_TRANSLATE("Then"), menu); field->ResizeToPreferred(); - field->SetDivider(be_plain_font->StringWidth(MDR_DIALECT_CHOICE ("Then","ならば")) + 8); + field->SetDivider(be_plain_font->StringWidth(B_TRANSLATE("Then")) + 8); AddChild(field); outbound_field = new BMenuField(BRect(5,55,255,80),"reply","Foo",outbound); diff --git a/src/add-ons/mail_daemon/inbound_filters/match_header/Jamfile b/src/add-ons/mail_daemon/inbound_filters/match_header/Jamfile index c7b9b01205..c7996d841a 100644 --- a/src/add-ons/mail_daemon/inbound_filters/match_header/Jamfile +++ b/src/add-ons/mail_daemon/inbound_filters/match_header/Jamfile @@ -5,10 +5,21 @@ UsePublicHeaders [ FDirName add-ons mail_daemon ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; -Addon MatchHeader : +Addon MatchHeader + : ConfigView.cpp RuleFilter.cpp - StringMatcher.cpp ; + StringMatcher.cpp + ; -LinkAgainst MatchHeader : - be libmail.so $(TARGET_LIBSUPC++) ; +LinkAgainst MatchHeader + : + be libmail.so $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) + ; + +DoCatalogs MatchHeader + : + x-vnd.Haiku-MatchHeader + : + ConfigView.cpp +; diff --git a/src/add-ons/mail_daemon/inbound_filters/notifier/ConfigView.cpp b/src/add-ons/mail_daemon/inbound_filters/notifier/ConfigView.cpp index da26daf091..22e2d21f45 100644 --- a/src/add-ons/mail_daemon/inbound_filters/notifier/ConfigView.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/notifier/ConfigView.cpp @@ -6,6 +6,7 @@ #include "ConfigView.h" +#include #include #include #include @@ -13,11 +14,14 @@ #include #include -#include - #include #include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ConfigView" + + const uint32 kMsgNotifyMethod = 'nomt'; @@ -35,19 +39,22 @@ ConfigView::ConfigView() BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING,false,false); const char *notifyMethods[] = { - MDR_DIALECT_CHOICE ("Beep","音"), - MDR_DIALECT_CHOICE ("Alert","窓(メール毎)"), - MDR_DIALECT_CHOICE ("Keyboard LEDs","キーボードLED"), - MDR_DIALECT_CHOICE ("Central alert","窓(一括)"), - "Central beep","Log window"}; - for (int32 i = 0,j = 1;i < 6;i++,j *= 2) - menu->AddItem(new BMenuItem(notifyMethods[i],new BMessage(kMsgNotifyMethod))); + B_TRANSLATE("Beep"), + B_TRANSLATE("Alert"), + B_TRANSLATE("Keyboard LEDs"), + B_TRANSLATE("Central alert"), + B_TRANSLATE("Central beep"), + B_TRANSLATE("Log window") + }; + for (int32 i = 0,j = 1;i < 6;i++,j *= 2) { + menu->AddItem(new BMenuItem(notifyMethods[i], + new BMessage(kMsgNotifyMethod))); + } - BMenuField *field = new BMenuField(frame,"notify", - MDR_DIALECT_CHOICE ("Method:","方法:"),menu); + BMenuField *field = new BMenuField(frame,"notify", B_TRANSLATE("Method:"), + menu); field->ResizeToPreferred(); - field->SetDivider(field->StringWidth( - MDR_DIALECT_CHOICE ("Method:","方法:")) + 6); + field->SetDivider(field->StringWidth(B_TRANSLATE("Method:")) + 6); AddChild(field); ResizeToPreferred(); diff --git a/src/add-ons/mail_daemon/inbound_filters/notifier/Jamfile b/src/add-ons/mail_daemon/inbound_filters/notifier/Jamfile index 5a2f3f58dd..0c789b4c42 100644 --- a/src/add-ons/mail_daemon/inbound_filters/notifier/Jamfile +++ b/src/add-ons/mail_daemon/inbound_filters/notifier/Jamfile @@ -9,5 +9,12 @@ Addon NewMailNotification : filter.cpp ConfigView.cpp : - be libmail.so $(TARGET_LIBSUPC++) + be libmail.so $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) ; + +DoCatalogs NewMailNotification : + x-vnd.Haiku-NewMailNotification + : + ConfigView.cpp + filter.cpp +; diff --git a/src/add-ons/mail_daemon/inbound_filters/notifier/filter.cpp b/src/add-ons/mail_daemon/inbound_filters/notifier/filter.cpp index ca1899387c..1945eb1260 100644 --- a/src/add-ons/mail_daemon/inbound_filters/notifier/filter.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/notifier/filter.cpp @@ -5,19 +5,23 @@ */ -#include -#include #include -#include -#include #include +#include +#include +#include +#include +#include #include -#include #include "ConfigView.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "filter" + + class NotifyFilter : public MailFilter { public: @@ -64,13 +68,17 @@ NotifyFilter::MailboxSynced(status_t status) if (fStrategy & alert) { BString text; - MDR_DIALECT_CHOICE ( - text << "You have " << fNNewMessages << " new message" << ((fNNewMessages != 1) ? "s" : "") - << " for " << fMailProtocol.AccountSettings().Name() << ".", + if (fNNewMessages != 1) + text << B_TRANSLATE("You have ") << fNNewMessages << B_TRANSLATE( + " new messages") << B_TRANSLATE(" for ") + << fMailProtocol.AccountSettings().Name() << "."; + else + text << B_TRANSLATE("You have ") << fNNewMessages << B_TRANSLATE( + " new message") << B_TRANSLATE(" for ") + << fMailProtocol.AccountSettings().Name() << "."; - text << fMailProtocol.AccountSettings().Name() << "より\n" << fNNewMessages << " 通のメッセージが届きました"); - - BAlert *alert = new BAlert(MDR_DIALECT_CHOICE ("New messages","新着メッセージ"), text.String(), "OK", NULL, NULL, B_WIDTH_AS_USUAL); + BAlert *alert = new BAlert(B_TRANSLATE("New messages"), text.String(), + "OK", NULL, NULL, B_WIDTH_AS_USUAL); alert->SetFeel(B_NORMAL_WINDOW_FEEL); alert->Go(NULL); } @@ -91,7 +99,10 @@ NotifyFilter::MailboxSynced(status_t status) if (fStrategy & log_window) { BString message; - message << fNNewMessages << " new message" << ((fNNewMessages != 1) ? "s" : ""); + if (fNNewMessages != 1) + message << fNNewMessages << B_TRANSLATE(" new messages"); + else + message << fNNewMessages << B_TRANSLATE(" new message"); fMailProtocol.ShowMessage(message.String()); } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp index 9de576b100..70e1d4cee5 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp @@ -7,6 +7,7 @@ #include "IMAPFolderConfig.h" +#include #include #include #include @@ -18,6 +19,10 @@ #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "IMAPFolderConfig" + + class EditableListItem { public: EditableListItem(); @@ -90,7 +95,6 @@ CheckBoxItem::DrawItem(BView* owner, BRect itemRect, bool drawEverything) BRect boxRect(0.0f, 2.0f, ceilf(3.0f + fontHeight.ascent), ceilf(5.0f + fontHeight.ascent)); - fBoxRect.left = itemRect.right - boxRect.Width(); fBoxRect.top = itemRect.top + (itemRect.Height() - boxRect.Height()) / 2; fBoxRect.right = itemRect.right; @@ -201,7 +205,7 @@ class StatusWindow : public BWindow { public: StatusWindow(const char* text) : - BWindow(BRect(0, 0, 10, 10), "status", B_MODAL_WINDOW_LOOK, + BWindow(BRect(0, 0, 10, 10), B_TRANSLATE("status"), B_MODAL_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE | B_AVOID_FRONT | B_NOT_RESIZABLE) { @@ -230,9 +234,9 @@ const uint32 kMsgInit = '&Ini'; FolderConfigWindow::FolderConfigWindow(BRect parent, const BMessage& settings) : - BWindow(BRect(0, 0, 300, 300), "IMAP Folders", B_TITLED_WINDOW_LOOK, - B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE - | B_AVOID_FRONT), + BWindow(BRect(0, 0, 300, 300), B_TRANSLATE("IMAP Folders"), + B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION + | B_NOT_ZOOMABLE | B_AVOID_FRONT), fSettings(settings) { BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL, B_WILL_DRAW); @@ -244,13 +248,14 @@ FolderConfigWindow::FolderConfigWindow(BRect parent, const BMessage& settings) rootView->SetLayout(layout); layout->SetInset(spacing); - fFolderListView = new EditListView("IMAP Folders"); + fFolderListView = new EditListView(B_TRANSLATE("IMAP Folders")); fFolderListView->SetExplicitPreferredSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); - fApplyButton = new BButton("Apply", "Apply", new BMessage(kMsgApplyButton)); + fApplyButton = new BButton("Apply", B_TRANSLATE("Apply"), + new BMessage(kMsgApplyButton)); fQuotaView = new BStringView("quota view", - "Failed to fetch available storage."); + B_TRANSLATE("Failed to fetch available storage.")); fQuotaView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER)); @@ -294,8 +299,8 @@ FolderConfigWindow::MessageReceived(BMessage* message) void FolderConfigWindow::_LoadFolders() { - StatusWindow* status = new StatusWindow("Fetching IMAP folders, have " - "patience..."); + StatusWindow* status = new StatusWindow( + B_TRANSLATE("Fetching IMAP folders, have patience...")); status->Show(); BString server; @@ -356,8 +361,8 @@ FolderConfigWindow::_ApplyChanges() if (!haveChanges) return; - StatusWindow* status = new StatusWindow("Subcribe / Unsuscribe IMAP " - "folders, have patience..."); + StatusWindow* status = new StatusWindow(B_TRANSLATE("Subcribe / Unsuscribe " + "IMAP folders, have patience...")); status->Show(); for (unsigned int i = 0; i < fFolderList.size(); i++) { diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile b/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile index 9c2e7431fe..6508525cf6 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile @@ -33,7 +33,7 @@ Addon IMAP : $(sources) : - be libmail.so $(TARGET_NETWORK_LIBS) libalm.so + be libmail.so $(HAIKU_LOCALE_LIBS) $(TARGET_NETWORK_LIBS) libalm.so libshared.a $(TARGET_LIBSUPC++) $(TARGET_LIBSTDC++) ; @@ -46,3 +46,10 @@ Package haiku-maildaemon-cvs : IMAP : boot home config add-ons mail_daemon inbound_protocols ; + +DoCatalogs IMAP : + x-vnd.Haiku-IMAP + : + imap_config.cpp + IMAPFolderConfig.cpp +; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_config.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_config.cpp index 5760cd67ed..ab9204db0a 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_config.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_config.cpp @@ -8,6 +8,7 @@ #include +#include #include #include @@ -16,11 +17,14 @@ #include #include #include -#include #include "IMAPFolderConfig.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "imap_config" + + const uint32 kMsgOpenIMAPFolder = '&OIF'; @@ -70,8 +74,8 @@ IMAPConfig::IMAPConfig(MailAddonSettings& settings, ((BControl *)(FindView("delete_remote_when_local")))->SetEnabled(true); ((BControl *)(FindView("delete_remote_when_local")))->MoveBy(0, -25); - fIMAPFolderButton = new BButton(frame, "IMAP Folders", "IMAP Folders", - new BMessage(kMsgOpenIMAPFolder)); + fIMAPFolderButton = new BButton(frame, "IMAP Folders", B_TRANSLATE( + "IMAP Folders"), new BMessage(kMsgOpenIMAPFolder)); AddChild(fIMAPFolderButton); frame.right -= 10; @@ -79,8 +83,8 @@ IMAPConfig::IMAPConfig(MailAddonSettings& settings, BPath defaultFolder = BPrivate::default_mail_directory(); defaultFolder.Append(accountSettings.Name()); - fFileView = new BMailFileConfigView("Destination:", "destination", - false, defaultFolder.Path()); + fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), + "destination", false, defaultFolder.Path()); fFileView->SetTo(&settings.Settings(), NULL); AddChild(fFileView); fFileView->MoveBy(0, frame.bottom + 5); diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/ConfigView.cpp b/src/add-ons/mail_daemon/inbound_protocols/pop3/ConfigView.cpp index 319e18ed31..4deadd95f1 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/ConfigView.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/ConfigView.cpp @@ -7,12 +7,17 @@ */ +#include #include #include #include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ConfigView" + + class POP3ConfigView : public BMailProtocolConfigView { public: POP3ConfigView(MailAddonSettings& settings, @@ -47,8 +52,8 @@ POP3ConfigView::POP3ConfigView(MailAddonSettings& settings, SetTo(settings); - fFileView = new BMailFileConfigView("Destination:", "destination", - false, BPrivate::default_mail_in_directory().Path()); + fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), + "destination", false, BPrivate::default_mail_in_directory().Path()); fFileView->SetTo(&settings.Settings(), NULL); AddChild(fFileView); float w, h; diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/Jamfile b/src/add-ons/mail_daemon/inbound_protocols/pop3/Jamfile index b5f4a27716..c9187c4e88 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/Jamfile +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/Jamfile @@ -30,11 +30,18 @@ if $(HAIKU_OPENSSL_ENABLED) { Addon POP3 : $(sources) - : be libmail.so $(TARGET_NETWORK_LIBS) $(HAIKU_OPENSSL_LIBS) - $(TARGET_LIBSUPC++) + : be libmail.so $(HAIKU_LOCALE_LIBS) $(HAIKU_OPENSSL_LIBS) + $(TARGET_LIBSUPC++) $(TARGET_NETWORK_LIBS) ; Package haiku-maildaemon-cvs : POP3 : boot home config add-ons mail_daemon inbound_protocols ; + +DoCatalogs POP3 : + x-vnd.Haiku-POP3 + : + ConfigView.cpp + pop3.cpp +; diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp b/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp index f1e1252606..9d5ec550db 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp @@ -30,9 +30,10 @@ #endif #include -#include +#include #include #include +#include #include #include #include @@ -42,7 +43,10 @@ #include "MailSettings.h" #include "MessageIO.h" -#include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "pop3" + #define POP3_RETRIEVAL_TIMEOUT 60000000 #define CRLF "\r\n" @@ -140,15 +144,14 @@ POP3Protocol::SyncMessages() _ReadManifest(); SetTotalItems(2); - ReportProgress(0, 1, "Connect to server..."); + ReportProgress(0, 1, B_TRANSLATE("Connect to server" B_UTF8_ELLIPSIS)); status_t error = Connect(); if (error < B_OK) { ResetProgress(); return error; } - ReportProgress(0, 1, MDR_DIALECT_CHOICE("Getting UniqueIDs...", - "固有のIDを取得中...")); + ReportProgress(0, 1, B_TRANSLATE("Getting UniqueIDs" B_UTF8_ELLIPSIS)); error = _UniqueIDs(); if (error < B_OK) { ResetProgress(); @@ -326,8 +329,8 @@ POP3Protocol::DeleteMessage(const entry_ref& ref) status_t POP3Protocol::Open(const char *server, int port, int) { - ReportProgress(0, 0, MDR_DIALECT_CHOICE("Connecting to POP3 server...", - "POP3サーバに接続しています...")); + ReportProgress(0, 0, B_TRANSLATE("Connecting to POP3 server" + B_UTF8_ELLIPSIS)); if (port <= 0) { #ifdef USE_SSL @@ -341,8 +344,7 @@ POP3Protocol::Open(const char *server, int port, int) // Prime the error message BString error_msg; - error_msg << MDR_DIALECT_CHOICE("Error while connecting to server ", - "サーバに接続中にエラーが発生しました ") << server; + error_msg << B_TRANSLATE("Error while connecting to server ") << server; if (port != 110) error_msg << ":" << port; @@ -354,8 +356,7 @@ POP3Protocol::Open(const char *server, int port, int) } if (hostIP == 0) { - error_msg << MDR_DIALECT_CHOICE(": Connection refused or host not found", - ": :接続が拒否されたかサーバーが見つかりません"); + error_msg << B_TRANSLATE(": Connection refused or host not found"); ShowError(error_msg.String()); return B_NAME_NOT_FOUND; @@ -368,7 +369,8 @@ POP3Protocol::Open(const char *server, int port, int) saAddr.sin_family = AF_INET; saAddr.sin_port = htons(port); saAddr.sin_addr.s_addr = hostIP; - int result = connect(fSocket, (struct sockaddr *) &saAddr, sizeof(saAddr)); + int result = connect(fSocket, (struct sockaddr *) &saAddr, + sizeof(saAddr)); if (result < 0) { close(fSocket); fSocket = -1; @@ -377,7 +379,7 @@ POP3Protocol::Open(const char *server, int port, int) return errno; } } else { - error_msg << ": Could not allocate socket."; + error_msg << B_TRANSLATE(": Could not allocate socket."); ShowError(error_msg.String()); return B_ERROR; } @@ -424,10 +426,10 @@ POP3Protocol::Open(const char *server, int port, int) if (strncmp(line.String(), "+OK", 3) != 0) { if (line.Length() > 0) { - error_msg << MDR_DIALECT_CHOICE(". The server said:\n", - "サーバのメッセージです\n") << line.String(); + error_msg << B_TRANSLATE(". The server said:\n") + << line.String(); } else - error_msg << ": No reply.\n"; + error_msg << B_TRANSLATE(": No reply.\n"); ShowError(error_msg.String()); return B_ERROR; @@ -444,14 +446,13 @@ POP3Protocol::Login(const char *uid, const char *password, int method) status_t err; BString error_msg; - error_msg << MDR_DIALECT_CHOICE("Error while authenticating user ", - "ユーザー認証中にエラーが発生しました ") << uid; + error_msg << B_TRANSLATE("Error while authenticating user ") << uid; if (method == 1) { //APOP int32 index = fLog.FindFirst("<"); if(index != B_ERROR) { - ReportProgress(0, 0, MDR_DIALECT_CHOICE( - "Sending APOP authentication...", "APOP認証情報を送信中...")); + ReportProgress(0, 0, B_TRANSLATE("Sending APOP authentication" + B_UTF8_ELLIPSIS)); int32 end = fLog.FindFirst(">",index); BString timestamp(""); fLog.CopyInto(timestamp, index, end - index + 1); @@ -466,22 +467,19 @@ POP3Protocol::Login(const char *uid, const char *password, int method) err = SendCommand(cmd.String()); if (err != B_OK) { - error_msg << MDR_DIALECT_CHOICE(". The server said:\n", - "サーバのメッセージです\n") << fLog; + error_msg << B_TRANSLATE(". The server said:\n") << fLog; ShowError(error_msg.String()); return err; } return B_OK; } else { - error_msg << MDR_DIALECT_CHOICE(": The server does not support APOP.", - "サーバはAPOPをサポートしていません"); + error_msg << B_TRANSLATE(": The server does not support APOP."); ShowError(error_msg.String()); return B_NOT_ALLOWED; } } - ReportProgress(0, 0, MDR_DIALECT_CHOICE("Sending username...", - "ユーザーID送信中...")); + ReportProgress(0, 0, B_TRANSLATE("Sending username" B_UTF8_ELLIPSIS)); BString cmd = "USER "; cmd += uid; @@ -489,22 +487,19 @@ POP3Protocol::Login(const char *uid, const char *password, int method) err = SendCommand(cmd.String()); if (err != B_OK) { - error_msg << MDR_DIALECT_CHOICE(". The server said:\n", - "サーバのメッセージです\n") << fLog; + error_msg << B_TRANSLATE(". The server said:\n") << fLog; ShowError(error_msg.String()); return err; } - ReportProgress(0, 0, MDR_DIALECT_CHOICE("Sending password...", - "パスワード送信中...")); + ReportProgress(0, 0, B_TRANSLATE("Sending password" B_UTF8_ELLIPSIS)); cmd = "PASS "; cmd += password; cmd += CRLF; err = SendCommand(cmd.String()); if (err != B_OK) { - error_msg << MDR_DIALECT_CHOICE(". The server said:\n", - "サーバのメッセージです\n") << fLog; + error_msg << B_TRANSLATE(". The server said:\n") << fLog; ShowError(error_msg.String()); return err; } @@ -516,8 +511,7 @@ POP3Protocol::Login(const char *uid, const char *password, int method) status_t POP3Protocol::Stat() { - ReportProgress(0, 0, MDR_DIALECT_CHOICE("Getting mailbox size...", - "メールボックスのサイズを取得しています...")); + ReportProgress(0, 0, B_TRANSLATE("Getting mailbox size" B_UTF8_ELLIPSIS)); if (SendCommand("STAT" CRLF) < B_OK) return B_ERROR; @@ -746,10 +740,10 @@ POP3Protocol::RetrieveInternal(const char *command, int32 message, // since that will get mistakenly evaluated again in the // next loop and delete a character by mistake. if (testIndex >= amountInBuffer - 4 && testStr[2] == '.') { - printf ("POP3Protocol::RetrieveInternal: Jackpot! You have " - "hit the rare situation with an escaped period at the " - "end of the buffer. Aren't you happy it decodes it " - "correctly?\n"); + printf ("POP3Protocol::RetrieveInternal: Jackpot! " + "You have hit the rare situation with an escaped " + "period at the end of the buffer. Aren't you happy" + "it decodes it correctly?\n"); flushWholeBuffer = true; } } diff --git a/src/add-ons/mail_daemon/outbound_filters/fortune/ConfigView.cpp b/src/add-ons/mail_daemon/outbound_filters/fortune/ConfigView.cpp index d62e031436..8f2cf9b3aa 100644 --- a/src/add-ons/mail_daemon/outbound_filters/fortune/ConfigView.cpp +++ b/src/add-ons/mail_daemon/outbound_filters/fortune/ConfigView.cpp @@ -6,33 +6,41 @@ #include "ConfigView.h" +#include #include #include #include #include -#include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ConfigView" ConfigView::ConfigView() - : BView(BRect(0,0,20,20),"fortune_filter",B_FOLLOW_LEFT | B_FOLLOW_TOP,0) + : + BView(BRect(0, 0, 20, 20), "fortune_filter", B_FOLLOW_LEFT | B_FOLLOW_TOP, + 0) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); // determine font height font_height fontHeight; GetFontHeight(&fontHeight); - float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 13; + float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + + fontHeight.leading) + 13; BRect rect(5,4,250,25); rect.bottom = rect.top - 2 + itemHeight; - BMailFileConfigView *fview = new BMailFileConfigView(MDR_DIALECT_CHOICE ("Fortune file:","予言ファイル:"),"fortune_file",false,"",B_FILE_NODE); + BMailFileConfigView *fview = new BMailFileConfigView( + B_TRANSLATE("Fortune file:"), "fortune_file", false, "", B_FILE_NODE); AddChild(fview); rect.top = rect.bottom + 8; rect.bottom = rect.top - 2 + itemHeight; - BTextControl * control = new BTextControl(rect,"tag_line",MDR_DIALECT_CHOICE ("Tag line:","見出し:"),NULL,NULL); + BTextControl * control = new BTextControl(rect, "tag_line", + B_TRANSLATE("Tag line:"), NULL, NULL); control->SetDivider(control->StringWidth(control->Label()) + 6); AddChild(control); @@ -42,8 +50,10 @@ ConfigView::ConfigView() void ConfigView::SetTo(const BMessage *archive) { - if (BMailFileConfigView *control = (BMailFileConfigView *)FindView("fortune_file")) - control->SetTo(archive,NULL); + BMailFileConfigView* control = (BMailFileConfigView*)FindView( + "fortune_file") + if (control != NULL) + control->SetTo(archive, NULL); BString path = archive->FindString("tag_line"); if (!archive->HasString("tag_line")) @@ -57,7 +67,8 @@ void ConfigView::SetTo(const BMessage *archive) status_t ConfigView::Archive(BMessage *into,bool) const { - if (BMailFileConfigView *control = (BMailFileConfigView *)FindView("fortune_file")) + if (BMailFileConfigView *control = (BMailFileConfigView + *)FindView("fortune_file")) { control->Archive(into); } @@ -67,8 +78,8 @@ status_t ConfigView::Archive(BMessage *into,bool) const BString line = control->Text(); if (line != B_EMPTY_STRING) line << "\n\n"; - if (into->ReplaceString("tag_line",line.String()) != B_OK) - into->AddString("tag_line",line.String()); + if (into->ReplaceString("tag_line", line.String()) != B_OK) + into->AddString("tag_line", line.String()); } return B_OK; } diff --git a/src/add-ons/mail_daemon/outbound_filters/fortune/Jamfile b/src/add-ons/mail_daemon/outbound_filters/fortune/Jamfile index 1617d483bd..4d7b082951 100644 --- a/src/add-ons/mail_daemon/outbound_filters/fortune/Jamfile +++ b/src/add-ons/mail_daemon/outbound_filters/fortune/Jamfile @@ -8,7 +8,13 @@ SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; Addon Fortune : ConfigView.cpp - filter.cpp ; + filter.cpp + : + be libmail.so $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) +; -LinkAgainst Fortune : - be libmail.so $(TARGET_LIBSUPC++) ; +DoCatalogs Fortune : + x-vnd.Haiku-Fortune + : + ConfigView.cpp +; diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp b/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp index a24a145520..0f858ecf1d 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/ConfigView.cpp @@ -9,14 +9,18 @@ #include +#include #include #include -#include #include #include #include +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ConfigView" + + class SMTPConfigView : public BMailProtocolConfigView { public: SMTPConfigView(MailAddonSettings& settings, @@ -45,12 +49,12 @@ SMTPConfigView::SMTPConfigView(MailAddonSettings& settings, AddFlavor("STARTTLS"); #endif - AddAuthMethod(MDR_DIALECT_CHOICE("None","無し"), false); - AddAuthMethod(MDR_DIALECT_CHOICE("ESMTP","ESMTP")); - AddAuthMethod(MDR_DIALECT_CHOICE("POP3 before SMTP","送信前に受信する"), false); + AddAuthMethod(B_TRANSLATE("None"), false); + AddAuthMethod(B_TRANSLATE("ESMTP")); + AddAuthMethod(B_TRANSLATE("POP3 before SMTP"), false); BTextControl *control = (BTextControl *)(FindView("host")); - control->SetLabel(MDR_DIALECT_CHOICE("SMTP server: ","SMTPサーバ: ")); + control->SetLabel(B_TRANSLATE("SMTP server: ")); // Reset the dividers after changing one float widestLabel = 0; @@ -68,8 +72,8 @@ SMTPConfigView::SMTPConfigView(MailAddonSettings& settings, SetTo(settings); - fFileView = new BMailFileConfigView("Destination:", "path", false, - BPrivate::default_mail_out_directory().Path()); + fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), "path", + false, BPrivate::default_mail_out_directory().Path()); fFileView->SetTo(&settings.Settings(), NULL); AddChild(fFileView); float w, h; diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/Jamfile b/src/add-ons/mail_daemon/outbound_protocols/smtp/Jamfile index 53d739db43..de1be6b6cf 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/Jamfile +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/Jamfile @@ -27,5 +27,12 @@ if $(HAIKU_OPENSSL_ENABLED) { Addon SMTP : $(sources) : be libmail.so $(TARGET_NETWORK_LIBS) $(TARGET_LIBSTDC++) - $(HAIKU_OPENSSL_LIBS) + $(HAIKU_LOCALE_LIBS) $(HAIKU_OPENSSL_LIBS) +; + +DoCatalogs SMTP : + x-vnd.Haiku-SMTP + : + ConfigView.cpp + smtp.cpp ; diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp b/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp index 6f9d24b3a4..b7f54fc1a4 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -46,7 +47,9 @@ # include "md5.h" #endif -#include + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "smtp" #define CRLF "\r\n" @@ -268,7 +271,8 @@ SMTPProtocol::Connect() // to the SMTP server first... status_t status = _POP3Authentication(); if (status < B_OK) { - error_msg << MDR_DIALECT_CHOICE ("POP3 authentication failed. The server said:\n","POP3認証に失敗しました\n") << fLog; + error_msg << B_TRANSLATE("POP3 authentication failed. The server " + "said:\n") << fLog; ShowError(error_msg.String()); return status; } @@ -277,16 +281,17 @@ SMTPProtocol::Connect() status = Open(fSettingsMessage.FindString("server"), fSettingsMessage.FindInt32("port"), authMethod == 1); if (status < B_OK) { - error_msg << MDR_DIALECT_CHOICE ("Error while opening connection to ","接続中にエラーが発生しました") << fSettingsMessage.FindString("server"); + error_msg << B_TRANSLATE("Error while opening connection to ") + << fSettingsMessage.FindString("server"); if (fSettingsMessage.FindInt32("port") > 0) error_msg << ":" << fSettingsMessage.FindInt32("port"); // << strerror(err) - BNetEndpoint sucks, we can't use this; if (fLog.Length() > 0) - error_msg << ". The server says:\n" << fLog; + error_msg << B_TRANSLATE(". The server says:\n") << fLog; else - error_msg << MDR_DIALECT_CHOICE (": Connection refused or host not found.",";接続が拒否されたかサーバーが見つかりません"); + error_msg << B_TRANSLATE(": Connection refused or host not found."); ShowError(error_msg.String()); @@ -299,8 +304,9 @@ 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 << MDR_DIALECT_CHOICE ("Error while logging in to ","ログイン中にエラーが発生しました\n") << fSettingsMessage.FindString("server") - << MDR_DIALECT_CHOICE (". The server said:\n","サーバーエラー\n") << fLog; + error_msg << B_TRANSLATE("Error while logging in to ") + << fSettingsMessage.FindString("server") + << B_TRANSLATE(". The server said:\n") << fLog; ShowError(error_msg.String()); } return B_OK; @@ -350,7 +356,7 @@ SMTPProtocol::SendMessages(const std::vector& mails, status_t SMTPProtocol::Open(const char *address, int port, bool esmtp) { - ReportProgress(0, 0, MDR_DIALECT_CHOICE ("Connecting to server...","接続中...")); + ReportProgress(0, 0, B_TRANSLATE("Connecting to server" B_UTF8_ELLIPSIS)); #ifdef USE_SSL use_ssl = (fSettingsMessage.FindInt32("flavor") == 1); @@ -408,7 +414,8 @@ SMTPProtocol::Open(const char *address, int port, bool esmtp) if (SSL_connect(ssl) <= 0) { BString error; - error << "Could not connect to SMTP server " << fSettingsMessage.FindString("server"); + error << "Could not connect to SMTP server " + << fSettingsMessage.FindString("server"); if (port != 465) error << ":" << port; error << ". (SSL connection error)";