[haiku-commits] haiku: hrev44315 - src/apps/webpositive

  • From: alex@xxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 12 Jul 2012 00:48:35 +0200 (CEST)

hrev44315 adds 1 changeset to branch 'master'
old head: f190d7d580c2aaae3646aed087c6245671e402bd
new head: 2218c029a5ab7260d03036b43c68475e0b35b449

----------------------------------------------------------------------------

2218c02: Add localization support to WebPositive, patch by Humdinger
  
  * Includes style fixes
  * Functional fixes by myself, patch wouldn't build

                          [ Alexandre Deckner <alexandre.deckner@xxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44315
Commit:      2218c029a5ab7260d03036b43c68475e0b35b449
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2218c02
Author:      Alexandre Deckner <alexandre.deckner@xxxxxxxx>
Date:        Wed Jul 11 22:44:17 2012 UTC

----------------------------------------------------------------------------

6 files changed, 343 insertions(+), 244 deletions(-)
src/apps/webpositive/AuthenticationPanel.cpp  |  143 +++++++-----
src/apps/webpositive/BrowserApp.cpp           |   44 ++--
src/apps/webpositive/BrowserWindow.cpp        |  249 ++++++++++++---------
src/apps/webpositive/DownloadProgressView.cpp |   91 +++++---
src/apps/webpositive/DownloadWindow.cpp       |   38 ++--
src/apps/webpositive/URLInputGroup.cpp        |   22 +-

----------------------------------------------------------------------------

diff --git a/src/apps/webpositive/AuthenticationPanel.cpp 
b/src/apps/webpositive/AuthenticationPanel.cpp
index 7dcc552..a6db7ec 100644
--- a/src/apps/webpositive/AuthenticationPanel.cpp
+++ b/src/apps/webpositive/AuthenticationPanel.cpp
@@ -28,10 +28,12 @@
 #include "AuthenticationPanel.h"
 
 #include <Button.h>
+#include <Catalog.h>
 #include <CheckBox.h>
 #include <ControlLook.h>
 #include <GridLayoutBuilder.h>
 #include <GroupLayoutBuilder.h>
+#include <Locale.h>
 #include <Message.h>
 #include <Screen.h>
 #include <SeparatorView.h>
@@ -44,28 +46,41 @@ static const uint32 kMsgPanelOK = 'pnok';
 static const uint32 kMsgJitter = 'jitr';
 static const uint32 kHidePassword = 'hdpw';
 
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Authentication Panel"
+
 AuthenticationPanel::AuthenticationPanel(BRect parentFrame)
-       : BWindow(BRect(-1000, -1000, -900, -900), "Authentication Required",
-           B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
-           B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE
-               | B_CLOSE_ON_ESCAPE | B_AUTO_UPDATE_SIZE_LIMITS)
-       , m_parentWindowFrame(parentFrame)
-       , m_usernameTextControl(new BTextControl("user", "Username:", "", NULL))
-       , m_passwordTextControl(new BTextControl("pass", "Password:", "", NULL))
-       , m_hidePasswordCheckBox(new BCheckBox("hide", "Hide password text", 
new BMessage(kHidePassword)))
-       , m_rememberCredentialsCheckBox(new BCheckBox("remember", "Remember 
username and password for this site", NULL))
-       , m_okButton(new BButton("ok", "OK", new BMessage(kMsgPanelOK)))
-       , m_cancelButton(new BButton("cancel", "Cancel", new 
BMessage(B_QUIT_REQUESTED)))
-       , m_cancelled(false)
-       , m_exitSemaphore(create_sem(0, "Authentication Panel"))
+       :
+       BWindow(BRect(-1000, -1000, -900, -900),
+               B_TRANSLATE("Authentication Required"), B_TITLED_WINDOW_LOOK,
+               B_MODAL_APP_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | 
B_NOT_RESIZABLE
+                       | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE | 
B_AUTO_UPDATE_SIZE_LIMITS),
+       m_parentWindowFrame(parentFrame),
+       m_usernameTextControl(new BTextControl("user", B_TRANSLATE("Username:"),
+               "", NULL)),
+       m_passwordTextControl(new BTextControl("pass", B_TRANSLATE("Password:"),
+               "", NULL)),
+       m_hidePasswordCheckBox(new BCheckBox("hide", B_TRANSLATE("Hide password 
"
+               "text"), new BMessage(kHidePassword))),
+       m_rememberCredentialsCheckBox(new BCheckBox("remember",
+               B_TRANSLATE("Remember username and password for this site"), 
NULL)),
+       m_okButton(new BButton("ok", B_TRANSLATE("OK"),
+               new BMessage(kMsgPanelOK))),
+       m_cancelButton(new BButton("cancel", B_TRANSLATE("Cancel"),
+               new BMessage(B_QUIT_REQUESTED))),
+       m_cancelled(false),
+       m_exitSemaphore(create_sem(0, "Authentication Panel"))
 {
 }
 
+
 AuthenticationPanel::~AuthenticationPanel()
 {
        delete_sem(m_exitSemaphore);
 }
 
+
 bool
 AuthenticationPanel::QuitRequested()
 {
@@ -74,6 +89,7 @@ AuthenticationPanel::QuitRequested()
        return false;
 }
 
+
 void
 AuthenticationPanel::MessageReceived(BMessage* message)
 {
@@ -81,21 +97,23 @@ AuthenticationPanel::MessageReceived(BMessage* message)
        case kMsgPanelOK:
                release_sem(m_exitSemaphore);
                break;
-    case kHidePassword: {
-       // TODO: Toggling this is broken in BTextView. Workaround is to
-       // set the text and selection again.
-        BString text = m_passwordTextControl->Text();
-        int32 selectionStart;
-        int32 selectionEnd;
-        m_passwordTextControl->TextView()->GetSelection(&selectionStart, 
&selectionEnd);
+       case kHidePassword: {
+               // TODO: Toggling this is broken in BTextView. Workaround is to
+               // set the text and selection again.
+               BString text = m_passwordTextControl->Text();
+               int32 selectionStart;
+               int32 selectionEnd;
+               m_passwordTextControl->TextView()->GetSelection(&selectionStart,
+                       &selectionEnd);
         m_passwordTextControl->TextView()->HideTyping(
-            m_hidePasswordCheckBox->Value() == B_CONTROL_ON);
-        m_passwordTextControl->SetText(text.String());
-        m_passwordTextControl->TextView()->Select(selectionStart, 
selectionEnd);
-        break;
-    }
-    case kMsgJitter: {
-       UpdateIfNeeded();
+                       m_hidePasswordCheckBox->Value() == B_CONTROL_ON);
+               m_passwordTextControl->SetText(text.String());
+               m_passwordTextControl->TextView()->Select(selectionStart,
+                       selectionEnd);
+               break;
+       }
+       case kMsgJitter: {
+               UpdateIfNeeded();
                BPoint leftTop = Frame().LeftTop();
                const float jitterOffsets[] = { -10, 0, 10, 0 };
                const int32 jitterOffsetCount = sizeof(jitterOffsets) / 
sizeof(float);
@@ -106,14 +124,15 @@ AuthenticationPanel::MessageReceived(BMessage* message)
                }
                MoveTo(leftTop);
                break;
-    }
+       }
        default:
                BWindow::MessageReceived(message);
        }
 }
 
+
 bool AuthenticationPanel::getAuthentication(const BString& text,
-    const BString& previousUser, const BString& previousPass,
+       const BString& previousUser, const BString& previousPass,
        bool previousRememberCredentials, bool badPassword,
        BString& user, BString&  pass, bool* rememberCredentials)
 {
@@ -121,17 +140,18 @@ bool AuthenticationPanel::getAuthentication(const 
BString& text,
        rgb_color infoColor = ui_color(B_PANEL_TEXT_COLOR);
        BRect textBounds(0, 0, 250, 200);
        BTextView* textView = new BTextView(textBounds, "text", textBounds,
-           be_plain_font, &infoColor, B_FOLLOW_NONE, B_WILL_DRAW | 
B_SUPPORTS_LAYOUT);
+               be_plain_font, &infoColor, B_FOLLOW_NONE, B_WILL_DRAW
+                       | B_SUPPORTS_LAYOUT);
        textView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
        textView->SetText(text.String());
        textView->MakeEditable(false);
        textView->MakeSelectable(false);
 
-    m_usernameTextControl->SetText(previousUser.String());
+       m_usernameTextControl->SetText(previousUser.String());
        m_passwordTextControl->TextView()->HideTyping(true);
        // Ignore the previous password, if it didn't work.
        if (!badPassword)
-           m_passwordTextControl->SetText(previousPass.String());
+               m_passwordTextControl->SetText(previousPass.String());
        m_hidePasswordCheckBox->SetValue(B_CONTROL_ON);
        m_rememberCredentialsCheckBox->SetValue(previousRememberCredentials);
 
@@ -139,24 +159,24 @@ bool AuthenticationPanel::getAuthentication(const 
BString& text,
        SetLayout(new BGroupLayout(B_VERTICAL, 0.0));
        float spacing = be_control_look->DefaultItemSpacing();
        AddChild(BGroupLayoutBuilder(B_VERTICAL, 0.0)
-           .Add(BGridLayoutBuilder(0, spacing)
-               .Add(textView, 0, 0, 2)
-               .Add(m_usernameTextControl->CreateLabelLayoutItem(), 0, 1)
-               .Add(m_usernameTextControl->CreateTextViewLayoutItem(), 1, 1)
-               .Add(m_passwordTextControl->CreateLabelLayoutItem(), 0, 2)
-               .Add(m_passwordTextControl->CreateTextViewLayoutItem(), 1, 2)
-               .Add(BSpaceLayoutItem::CreateGlue(), 0, 3)
-               .Add(m_hidePasswordCheckBox, 1, 3)
-               .Add(m_rememberCredentialsCheckBox, 0, 4, 2)
-               .SetInsets(spacing, spacing, spacing, spacing)
-           )
-           .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
-           .Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
-               .AddGlue()
-               .Add(m_cancelButton)
-               .Add(m_okButton)
-               .SetInsets(spacing, spacing, spacing, spacing)
-           )
+               .Add(BGridLayoutBuilder(0, spacing)
+                       .Add(textView, 0, 0, 2)
+                       .Add(m_usernameTextControl->CreateLabelLayoutItem(), 0, 
1)
+                       .Add(m_usernameTextControl->CreateTextViewLayoutItem(), 
1, 1)
+                       .Add(m_passwordTextControl->CreateLabelLayoutItem(), 0, 
2)
+                       .Add(m_passwordTextControl->CreateTextViewLayoutItem(), 
1, 2)
+                       .Add(BSpaceLayoutItem::CreateGlue(), 0, 3)
+                       .Add(m_hidePasswordCheckBox, 1, 3)
+                       .Add(m_rememberCredentialsCheckBox, 0, 4, 2)
+                       .SetInsets(spacing, spacing, spacing, spacing)
+               )
+               .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
+               .Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
+                       .AddGlue()
+                       .Add(m_cancelButton)
+                       .Add(m_okButton)
+                       .SetInsets(spacing, spacing, spacing, spacing)
+               )
        );
 
        float textHeight = textView->LineHeight(0) * textView->CountLines();
@@ -164,14 +184,14 @@ bool AuthenticationPanel::getAuthentication(const 
BString& text,
 
        SetDefaultButton(m_okButton);
        if (badPassword && previousUser.Length())
-           m_passwordTextControl->MakeFocus(true);
+               m_passwordTextControl->MakeFocus(true);
        else
-           m_usernameTextControl->MakeFocus(true);
+               m_usernameTextControl->MakeFocus(true);
 
-    if (m_parentWindowFrame.IsValid())
-        CenterIn(m_parentWindowFrame);
-    else
-        CenterOnScreen();
+       if (m_parentWindowFrame.IsValid())
+               CenterIn(m_parentWindowFrame);
+       else
+               CenterOnScreen();
 
        // Start AuthenticationPanel window thread
        Show();
@@ -182,12 +202,14 @@ bool AuthenticationPanel::getAuthentication(const 
BString& text,
 
        // Block calling thread
        // Get the originating window, if it exists, to let it redraw itself.
-       BWindow* window = 
dynamic_cast<BWindow*>(BLooper::LooperForThread(find_thread(NULL)));
+       BWindow* window = dynamic_cast<BWindow*>
+               (BLooper::LooperForThread(find_thread(NULL)));
        if (window) {
                status_t err;
                for (;;) {
                        do {
-                               err = acquire_sem_etc(m_exitSemaphore, 1, 
B_RELATIVE_TIMEOUT, 10000);
+                               err = acquire_sem_etc(m_exitSemaphore, 1, 
B_RELATIVE_TIMEOUT,
+                                       10000);
                                // We've (probably) had our time slice taken 
away from us
                        } while (err == B_INTERRUPTED);
 
@@ -209,9 +231,10 @@ bool AuthenticationPanel::getAuthentication(const BString& 
text,
        user = m_usernameTextControl->Text();
        pass = m_passwordTextControl->Text();
        if (rememberCredentials)
-        *rememberCredentials = m_rememberCredentialsCheckBox->Value() == 
B_CONTROL_ON;
+               *rememberCredentials = m_rememberCredentialsCheckBox->Value()
+                       == B_CONTROL_ON;
 
-    bool canceled = m_cancelled;
+       bool canceled = m_cancelled;
        Quit();
        // AuthenticationPanel object is TOAST here.
        return !canceled;
diff --git a/src/apps/webpositive/BrowserApp.cpp 
b/src/apps/webpositive/BrowserApp.cpp
index ce0082a..c429167 100644
--- a/src/apps/webpositive/BrowserApp.cpp
+++ b/src/apps/webpositive/BrowserApp.cpp
@@ -28,6 +28,19 @@
 
 #include "BrowserApp.h"
 
+#include <Alert.h>
+#include <Autolock.h>
+#include <Catalog.h>
+#include <Directory.h>
+#include <Entry.h>
+#include <FindDirectory.h>
+#include <Locale.h>
+#include <Path.h>
+#include <Screen.h>
+#include <debugger.h>
+
+#include <stdio.h>
+
 #include "BrowserWindow.h"
 #include "BrowsingHistory.h"
 #include "DownloadWindow.h"
@@ -39,20 +52,13 @@
 #include "WebPage.h"
 #include "WebSettings.h"
 #include "WebView.h"
-#include <Alert.h>
-#include <Autolock.h>
-#include <Directory.h>
-#include <Entry.h>
-#include <FindDirectory.h>
-#include <Locale.h>
-#include <Path.h>
-#include <Screen.h>
-#include <debugger.h>
-#include <stdio.h>
 
 
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "WebPositive"
+
 const char* kApplicationSignature = "application/x-vnd.Haiku-WebPositive";
-const char* kApplicationName = "WebPositive";
+const char* kApplicationName = B_TRANSLATE_SYSTEM_NAME("WebPositive");
 static const uint32 PRELOAD_BROWSING_HISTORY = 'plbh';
 
 #define ENABLE_NATIVE_COOKIES 0
@@ -174,8 +180,10 @@ BrowserApp::ReadyToRun()
                float borderWidth = 0;
                if (decoratorSettings.FindFloat("border width", &borderWidth) 
!= B_OK)
                        borderWidth = 5;
-               fDownloadWindow->MoveTo(screenFrame.Width() - 
fDownloadWindow->Frame().Width() - borderWidth,
-                       screenFrame.Height() - 
fDownloadWindow->Frame().Height() - borderWidth);
+               fDownloadWindow->MoveTo(screenFrame.Width()
+                       - fDownloadWindow->Frame().Width() - borderWidth,
+                       screenFrame.Height() - fDownloadWindow->Frame().Height()
+                       - borderWidth);
        }
        fSettingsWindow = new SettingsWindow(settingsWindowFrame, fSettings);
 
@@ -217,7 +225,8 @@ BrowserApp::MessageReceived(BMessage* message)
        }
        case NEW_TAB: {
                BrowserWindow* window;
-               if (message->FindPointer("window", 
reinterpret_cast<void**>(&window)) != B_OK)
+               if (message->FindPointer("window",
+                       reinterpret_cast<void**>(&window)) != B_OK)
                        break;
                BString url;
                message->FindString("url", &url);
@@ -268,9 +277,10 @@ bool
 BrowserApp::QuitRequested()
 {
        if (fDownloadWindow->DownloadsInProgress()) {
-               BAlert* alert = new BAlert("Downloads in progress",
-                       "There are still downloads in progress, do you really 
want to "
-                       "quit WebPositive now?", "Quit", "Continue downloads");
+               BAlert* alert = new BAlert(B_TRANSLATE("Downloads in progress"),
+                       B_TRANSLATE("There are still downloads in progress, do 
you really "
+                       "want to quit WebPositive now?"), B_TRANSLATE("Quit"),
+                       B_TRANSLATE("Continue downloads"));
                int32 choice = alert->Go();
                if (choice == 1) {
                        if (fWindowCount == 0) {
diff --git a/src/apps/webpositive/BrowserWindow.cpp 
b/src/apps/webpositive/BrowserWindow.cpp
index 4987ea7..85fb8d1 100644
--- a/src/apps/webpositive/BrowserWindow.cpp
+++ b/src/apps/webpositive/BrowserWindow.cpp
@@ -32,26 +32,11 @@
 
 #include "BrowserWindow.h"
 
-#include "AuthenticationPanel.h"
-#include "BaseURL.h"
-#include "BitmapButton.h"
-#include "BrowserApp.h"
-#include "BrowsingHistory.h"
-#include "CredentialsStorage.h"
-#include "IconButton.h"
-#include "NavMenu.h"
-#include "SettingsKeys.h"
-#include "SettingsMessage.h"
-#include "TabManager.h"
-#include "URLInputGroup.h"
-#include "WebPage.h"
-#include "WebView.h"
-#include "WebViewConstants.h"
-#include "WindowIcon.h"
 #include <Alert.h>
 #include <Application.h>
 #include <Bitmap.h>
 #include <Button.h>
+#include <Catalog.h>
 #include <CheckBox.h>
 #include <Clipboard.h>
 #include <Directory.h>
@@ -62,6 +47,7 @@
 #include <GroupLayout.h>
 #include <GroupLayoutBuilder.h>
 #include <LayoutBuilder.h>
+#include <Locale.h>
 #include <MenuBar.h>
 #include <MenuItem.h>
 #include <MessageRunner.h>
@@ -77,6 +63,26 @@
 
 #include <stdio.h>
 
+#include "AuthenticationPanel.h"
+#include "BaseURL.h"
+#include "BitmapButton.h"
+#include "BrowserApp.h"
+#include "BrowsingHistory.h"
+#include "CredentialsStorage.h"
+#include "IconButton.h"
+#include "NavMenu.h"
+#include "SettingsKeys.h"
+#include "SettingsMessage.h"
+#include "TabManager.h"
+#include "URLInputGroup.h"
+#include "WebPage.h"
+#include "WebView.h"
+#include "WebViewConstants.h"
+#include "WindowIcon.h"
+
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "WebPositive Window"
 
 enum {
        OPEN_LOCATION                                                           
= 'open',
@@ -148,9 +154,9 @@ public:
 private:
        void _AddStaticItems()
        {
-               AddItem(new BMenuItem("Manage bookmarks",
+               AddItem(new BMenuItem(B_TRANSLATE("Manage bookmarks"),
                        new BMessage(SHOW_BOOKMARKS), 'M'), 0);
-               AddItem(new BMenuItem("Bookmark this page",
+               AddItem(new BMenuItem(B_TRANSLATE("Bookmark this page"),
                        new BMessage(CREATE_BOOKMARK), 'B'), 0);
        }
 };
@@ -281,82 +287,88 @@ BrowserWindow::BrowserWindow(BRect frame, 
SettingsMessage* appSettings,
 #else
        BMenu* mainMenu = new BMenuBar("Main menu");
 #endif
-       BMenu* menu = new BMenu("Window");
+       BMenu* menu = new BMenu(B_TRANSLATE("Window"));
        BMessage* newWindowMessage = new BMessage(NEW_WINDOW);
        newWindowMessage->AddString("url", "");
-       BMenuItem* newItem = new BMenuItem("New window", newWindowMessage, 'N');
+       BMenuItem* newItem = new BMenuItem(B_TRANSLATE("New window"),
+               newWindowMessage, 'N');
        menu->AddItem(newItem);
        newItem->SetTarget(be_app);
-       newItem = new BMenuItem("New tab", new BMessage(*newTabMessage), 'T');
+       newItem = new BMenuItem(B_TRANSLATE("New tab"),
+               new BMessage(*newTabMessage), 'T');
        menu->AddItem(newItem);
        newItem->SetTarget(be_app);
-       menu->AddItem(new BMenuItem("Open location", new 
BMessage(OPEN_LOCATION),
-               'L'));
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Open location"),
+               new BMessage(OPEN_LOCATION), 'L'));
        menu->AddSeparatorItem();
-       menu->AddItem(new BMenuItem("Close window", new 
BMessage(B_QUIT_REQUESTED),
-               'W', B_SHIFT_KEY));
-       menu->AddItem(new BMenuItem("Close tab", new BMessage(CLOSE_TAB), 'W'));
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Close window"),
+               new BMessage(B_QUIT_REQUESTED), 'W', B_SHIFT_KEY));
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Close tab"),
+               new BMessage(CLOSE_TAB), 'W'));
        menu->AddSeparatorItem();
-       menu->AddItem(new BMenuItem("Downloads",
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Downloads"),
                new BMessage(SHOW_DOWNLOAD_WINDOW), 'D'));
-       menu->AddItem(new BMenuItem("Settings",
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Settings"),
                new BMessage(SHOW_SETTINGS_WINDOW)));
-       BMenuItem* aboutItem = new BMenuItem("About",
+       BMenuItem* aboutItem = new BMenuItem(B_TRANSLATE("About"),
                new BMessage(B_ABOUT_REQUESTED));
        menu->AddItem(aboutItem);
        aboutItem->SetTarget(be_app);
        menu->AddSeparatorItem();
-       BMenuItem* quitItem = new BMenuItem("Quit",
+       BMenuItem* quitItem = new BMenuItem(B_TRANSLATE("Quit"),
                new BMessage(B_QUIT_REQUESTED), 'Q');
        menu->AddItem(quitItem);
        quitItem->SetTarget(be_app);
        mainMenu->AddItem(menu);
 
-       menu = new BMenu("Edit");
-       menu->AddItem(fCutMenuItem = new BMenuItem("Cut", new BMessage(B_CUT),
-               'X'));
-       menu->AddItem(fCopyMenuItem = new BMenuItem("Copy", new 
BMessage(B_COPY),
-               'C'));
-       menu->AddItem(fPasteMenuItem = new BMenuItem("Paste", new 
BMessage(B_PASTE),
-               'V'));
+       menu = new BMenu(B_TRANSLATE("Edit"));
+       menu->AddItem(fCutMenuItem = new BMenuItem(B_TRANSLATE("Cut"),
+               new BMessage(B_CUT), 'X'));
+       menu->AddItem(fCopyMenuItem = new BMenuItem(B_TRANSLATE("Copy"),
+               new BMessage(B_COPY), 'C'));
+       menu->AddItem(fPasteMenuItem = new BMenuItem(B_TRANSLATE("Paste"),
+               new BMessage(B_PASTE), 'V'));
        menu->AddSeparatorItem();
-       menu->AddItem(new BMenuItem("Find", new BMessage(EDIT_SHOW_FIND_GROUP),
-               'F'));
-       menu->AddItem(fFindPreviousMenuItem = new BMenuItem("Find previous",
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Find"),
+               new BMessage(EDIT_SHOW_FIND_GROUP), 'F'));
+       menu->AddItem(fFindPreviousMenuItem
+               = new BMenuItem(B_TRANSLATE("Find previous"),
                new BMessage(EDIT_FIND_PREVIOUS), 'G', B_SHIFT_KEY));
-       menu->AddItem(fFindNextMenuItem = new BMenuItem("Find next",
+       menu->AddItem(fFindNextMenuItem = new BMenuItem(B_TRANSLATE("Find 
next"),
                new BMessage(EDIT_FIND_NEXT), 'G'));
        mainMenu->AddItem(menu);
        fFindPreviousMenuItem->SetEnabled(false);
        fFindNextMenuItem->SetEnabled(false);
 
-       menu = new BMenu("View");
-       menu->AddItem(new BMenuItem("Reload", new BMessage(RELOAD), 'R'));
+       menu = new BMenu(B_TRANSLATE("View"));
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Reload"), new BMessage(RELOAD),
+               'R'));
        menu->AddSeparatorItem();
-       menu->AddItem(new BMenuItem("Increase size",
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Increase size"),
                new BMessage(ZOOM_FACTOR_INCREASE), '+'));
-       menu->AddItem(new BMenuItem("Decrease size",
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Decrease size"),
                new BMessage(ZOOM_FACTOR_DECREASE), '-'));
-       menu->AddItem(new BMenuItem("Reset size",
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Reset size"),
                new BMessage(ZOOM_FACTOR_RESET), '0'));
-       fZoomTextOnlyMenuItem = new BMenuItem("Zoom text only",
+       fZoomTextOnlyMenuItem = new BMenuItem(B_TRANSLATE("Zoom text only"),
                new BMessage(ZOOM_TEXT_ONLY));
        fZoomTextOnlyMenuItem->SetMarked(fZoomTextOnly);
        menu->AddItem(fZoomTextOnlyMenuItem);
 
        menu->AddSeparatorItem();
-       fFullscreenItem = new BMenuItem("Fullscreen",
+       fFullscreenItem = new BMenuItem(B_TRANSLATE("Fullscreen"),
                new BMessage(TOGGLE_FULLSCREEN), B_RETURN);
        menu->AddItem(fFullscreenItem);
-       menu->AddItem(new BMenuItem("Page source",
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Page source"),
                new BMessage(SHOW_PAGE_SOURCE), 'U'));
        mainMenu->AddItem(menu);
 
-       fHistoryMenu = new BMenu("History");
-       fHistoryMenu->AddItem(fBackMenuItem = new BMenuItem("Back",
+       fHistoryMenu = new BMenu(B_TRANSLATE("History"));
+       fHistoryMenu->AddItem(fBackMenuItem = new BMenuItem(B_TRANSLATE("Back"),
                new BMessage(GO_BACK), B_LEFT_ARROW));
-       fHistoryMenu->AddItem(fForwardMenuItem = new BMenuItem("Forward",
-               new BMessage(GO_FORWARD), B_RIGHT_ARROW));
+       fHistoryMenu->AddItem(fForwardMenuItem
+               = new BMenuItem(B_TRANSLATE("Forward"), new 
BMessage(GO_FORWARD),
+               B_RIGHT_ARROW));
        fHistoryMenu->AddSeparatorItem();
        fHistoryMenuFixedItemCount = fHistoryMenu->CountItems();
        mainMenu->AddItem(fHistoryMenu);
@@ -366,7 +378,7 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* 
appSettings,
        if (_BookmarkPath(bookmarkPath) == B_OK
                && get_ref_for_path(bookmarkPath.Path(), &bookmarkRef) == B_OK) 
{
                BMenu* bookmarkMenu
-                       = new BookmarkMenu("Bookmarks", this, &bookmarkRef);
+                       = new BookmarkMenu(B_TRANSLATE("Bookmarks"), this, 
&bookmarkRef);
                mainMenu->AddItem(bookmarkMenu);
        }
 
@@ -412,15 +424,16 @@ BrowserWindow::BrowserWindow(BRect frame, 
SettingsMessage* appSettings,
        const float kElementSpacing = 5;
 
        // Find group
-       fFindTextControl = new BTextControl("find", "Find:", "",
+       fFindTextControl = new BTextControl("find", B_TRANSLATE("Find:"), "",
                new BMessage(EDIT_FIND_NEXT));
        fFindTextControl->SetModificationMessage(new 
BMessage(FIND_TEXT_CHANGED));
-       fFindPreviousButton = new BButton("Previous",
+       fFindPreviousButton = new BButton(B_TRANSLATE("Previous"),
                new BMessage(EDIT_FIND_PREVIOUS));
-       fFindNextButton = new BButton("Next", new BMessage(EDIT_FIND_NEXT));
-       fFindCloseButton = new BButton("Close",
+       fFindNextButton = new BButton(B_TRANSLATE("Next"),
+               new BMessage(EDIT_FIND_NEXT));
+       fFindCloseButton = new BButton(B_TRANSLATE("Close"),
                new BMessage(EDIT_HIDE_FIND_GROUP));
-       fFindCaseSensitiveCheckBox = new BCheckBox("Match case");
+       fFindCaseSensitiveCheckBox = new BCheckBox(B_TRANSLATE("Match case"));
        BGroupLayout* findGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
                .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
                .Add(BGroupLayoutBuilder(B_HORIZONTAL, kElementSpacing)
@@ -511,7 +524,7 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* 
appSettings,
 
        // Add shortcuts to select a particular tab
        for (int32 i = 1; i <= 9; i++) {
-               BMessage *selectTab = new BMessage(SELECT_TAB);
+               BMessage* selectTab = new BMessage(SELECT_TAB);
                selectTab->AddInt32("tab index", i - 1);
                char numStr[2];
                snprintf(numStr, sizeof(numStr), "%d", (int) i);
@@ -603,10 +616,10 @@ BrowserWindow::DispatchMessage(BMessage* message, 
BHandler* target)
                // Only do this when the mouse is over the web view
                if (CurrentWebView()->Bounds().Contains(where)) {
                        // Zoom and unzoom text on Command + mouse wheel.
-                       // This could of course (and maybe should be) 
implemented in the WebView, but there
-                       // would need to be a way for the WebView to know the 
setting of the
-                       // fZoomTextOnly member here. Plus other clients of the 
API may not want
-                       // this feature.
+                       // This could of course (and maybe should be) 
implemented in the
+                       // WebView, but there would need to be a way for the 
WebView to
+                       // know the setting of the fZoomTextOnly member here. 
Plus other
+                       // clients of the API may not want this feature.
                        if ((modifiers() & B_COMMAND_KEY) != 0) {
                                float dy;
                                if (message->FindFloat("be:wheel_delta_y", &dy) 
== B_OK) {
@@ -667,8 +680,10 @@ BrowserWindow::MessageReceived(BMessage* message)
                        BrowsingHistory* history = 
BrowsingHistory::DefaultInstance();
                        if (history->CountItems() == 0)
                                break;
-                       BAlert* alert = new BAlert("Confirmation", "Do you 
really want to "
-                               "clear the browsing history?", "Clear", 
"Cancel");
+                       BAlert* alert = new BAlert(B_TRANSLATE("Confirmation"),
+                               B_TRANSLATE("Do you really want to "
+                               "clear the browsing history?"), 
B_TRANSLATE("Clear"),
+                               B_TRANSLATE("Cancel"));
                        if (alert->Go() == 0)
                                history->Clear();
                        break;
@@ -715,11 +730,12 @@ BrowserWindow::MessageReceived(BMessage* message)
                        }
                        message->RemoveName("refs");
                        if (addedCount > 10) {
-                               BString string;
-                               string << "Do you want to open " << addedCount;
-                               string << " bookmarks all at once?";
-                               BAlert* alert = new BAlert("Open bookmarks 
confirmation",
-                                       string.String(), "Cancel", "Open all");
+                               BString string(B_TRANSLATE_COMMENT("Do you want 
to open %addedCount "
+                                       "bookmarks all at once?", "Don't 
translate variable %addedCount."));
+                               string.ReplaceFirst("%addedCount", BString() << 
addedCount);
+
+                               BAlert* alert = new BAlert(B_TRANSLATE("Open 
bookmarks confirmation"),
+                                       string.String(), B_TRANSLATE("Cancel"), 
B_TRANSLATE("Open all"));
                                if (alert->Go() == 0)
                                        break;
                        }
@@ -1100,7 +1116,7 @@ BrowserWindow::CreateNewTab(const BString& _url, bool 
select, BWebView* webView)
 
        bool isNewWindow = fTabManager->CountTabs() == 0;
 
-       fTabManager->AddTab(webView, "New tab");
+       fTabManager->AddTab(webView, B_TRANSLATE("New tab"));
 
        BString url(_url);
        if (applyNewPagePolicy && url.Length() == 0)
@@ -1185,7 +1201,7 @@ BrowserWindow::NewWindowRequested(const BString& url, 
bool primaryAction)
 
 void
 BrowserWindow::NewPageCreated(BWebView* view, BRect windowFrame,
-    bool modalDialog, bool resizable, bool activate)
+       bool modalDialog, bool resizable, bool activate)
 {
        if (windowFrame.IsValid()) {
                BrowserWindow* window = new BrowserWindow(windowFrame, 
fAppSettings,
@@ -1218,7 +1234,7 @@ BrowserWindow::LoadNegotiating(const BString& url, 
BWebView* view)
 
        fURLInputGroup->SetText(url.String());
 
-       BString status("Requesting: ");
+       BString status(B_TRANSLATE("Requesting: "));
        status << url;
        view->WebPage()->SetStatusMessage(status);
 }
@@ -1233,7 +1249,7 @@ BrowserWindow::LoadCommitted(const BString& url, 
BWebView* view)
        // This hook is invoked when the load is commited.
        fURLInputGroup->SetText(url.String());
 
-       BString status("Loading: ");
+       BString status(B_TRANSLATE("Loading: "));
        status << url;
        view->WebPage()->SetStatusMessage(status);
 }
@@ -1259,8 +1275,9 @@ BrowserWindow::LoadFailed(const BString& url, BWebView* 
view)
        if (view != CurrentWebView())
                return;
 
-       BString status(url);
-       status << " failed.";
+       BString status(B_TRANSLATE_COMMENT("%url failed.", "Loading URL failed. 
"
+               "Don't translate variable %url."));
+       status.ReplaceFirst("%url", url);
        view->WebPage()->SetStatusMessage(status);
        if (!fLoadingProgressBar->IsHidden())
                fLoadingProgressBar->Hide();
@@ -1273,8 +1290,9 @@ BrowserWindow::LoadFinished(const BString& url, BWebView* 
view)
        if (view != CurrentWebView())
                return;
 
-       BString status(url);
-       status << " finished.";
+       BString status(B_TRANSLATE_COMMENT("%url finished.", "Loading URL "
+               "finished. Don't translate variable %url."));
+       status.ReplaceFirst("%url", url);
        view->WebPage()->SetStatusMessage(status);
        if (!fLoadingProgressBar->IsHidden())
                fLoadingProgressBar->Hide();
@@ -1283,8 +1301,9 @@ BrowserWindow::LoadFinished(const BString& url, BWebView* 
view)
                fForwardButton->IsEnabled(), false, view);
 
        int32 tabIndex = fTabManager->TabForView(view);
-       if (tabIndex > 0 && strcmp("New tab", fTabManager->TabLabel(tabIndex)) 
== 0)
-               fTabManager->SetTabLabel(tabIndex, url);
+       if (tabIndex > 0 && strcmp(B_TRANSLATE("New tab"),
+               fTabManager->TabLabel(tabIndex)) == 0)
+                       fTabManager->SetTabLabel(tabIndex, url);
 }
 
 
@@ -1447,8 +1466,8 @@ BrowserWindow::UpdateGlobalHistory(const BString& url)
 
 bool
 BrowserWindow::AuthenticationChallenge(BString message, BString& inOutUser,
-       BString& inOutPassword, bool& inOutRememberCredentials, uint32 
failureCount,
-       BWebView* view)
+       BString& inOutPassword, bool& inOutRememberCredentials,
+       uint32 failureCount, BWebView* view)
 {
        CredentialsStorage* persistentStorage
                = CredentialsStorage::PersistentInstance();
@@ -1571,11 +1590,13 @@ BrowserWindow::_CreateBookmark()
        BPath path;
        status_t status = _BookmarkPath(path);
        if (status != B_OK) {
-               BString message("There was an error retrieving the bookmark "
-                       "folder.\n\n");
-               message << "Error: " << strerror(status);
-               BAlert* alert = new BAlert("Bookmark error", message.String(), 
"OK",
-                       NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
+               BString message(B_TRANSLATE_COMMENT("There was an error 
retrieving "
+                       "the bookmark folder.\n\nError: %error", "Don't 
translate the "
+                       "variable %error"));
+               message.ReplaceFirst("%error", strerror(status));
+               BAlert* alert = new BAlert(B_TRANSLATE("Bookmark error"),
+                       message.String(), B_TRANSLATE("OK"), NULL, NULL,
+                       B_WIDTH_AS_USUAL, B_STOP_ALERT);
                alert->Go();
                return;
        }
@@ -1599,10 +1620,12 @@ BrowserWindow::_CreateBookmark()
        // URLs, only for matching file names.
        BDirectory directory(path.Path());
        if (status == B_OK && _CheckBookmarkExists(directory, bookmarkName, 
url)) {
-               BString message("A bookmark for this page (");
-               message << bookmarkName;
-               message << ") already exists.";
-               BAlert* alert = new BAlert("Bookmark info", message.String(), 
"OK");
+               BString message(B_TRANSLATE_COMMENT("A bookmark for this page "
+                       "(%bookmarkName) already exists.", "Don't translate 
variable "
+                       "%bookmarkName"));
+               message.ReplaceFirst("%bookmarkName", bookmarkName);
+               BAlert* alert = new BAlert(B_TRANSLATE("Bookmark info"),
+                       message.String(), B_TRANSLATE("OK"));
                alert->Go();
                return;
        }
@@ -1690,11 +1713,13 @@ BrowserWindow::_CreateBookmark()
        }
 
        if (status != B_OK) {
-               BString message("There was an error creating the bookmark "
-                       "file.\n\n");
-               message << "Error: " << strerror(status);
-               BAlert* alert = new BAlert("Bookmark error", message.String(), 
"OK",
-                       NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
+               BString message(B_TRANSLATE_COMMENT("There was an error 
creating the "
+                       "bookmark file.\n\nError: %error", "Don't translate 
variable "
+                       "%error"));
+               message.ReplaceFirst("%error", strerror(status));
+               BAlert* alert = new BAlert(B_TRANSLATE("Bookmark error"),
+                       message.String(), B_TRANSLATE("OK"), NULL, NULL,
+                       B_WIDTH_AS_USUAL, B_STOP_ALERT);
                alert->Go();
                return;
        }
@@ -1713,11 +1738,13 @@ BrowserWindow::_ShowBookmarks()
                status = be_roster->Launch(&ref);
 
        if (status != B_OK && status != B_ALREADY_RUNNING) {
-               BString message("There was an error trying to show the 
Bookmarks "
-                       "folder.\n\n");
-               message << "Error: " << strerror(status);
-               BAlert* alert = new BAlert("Bookmark error", message.String(), 
"OK",
-                       NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
+               BString message(B_TRANSLATE_COMMENT("There was an error trying 
to "
+                       "show the Bookmarks folder.\n\nError: %error", "Don't 
translate variable "
+                       "%error"));
+               message.ReplaceFirst("%error", strerror(status));
+               BAlert* alert = new BAlert(B_TRANSLATE("Bookmark error"),
+                       message.String(), B_TRANSLATE("OK"), NULL, NULL,
+                       B_WIDTH_AS_USUAL, B_STOP_ALERT);
                alert->Go();
                return;
        }
@@ -1857,7 +1884,7 @@ BrowserWindow::_UpdateHistoryMenu()
                return;
 
        int32 count = history->CountItems();
-       BMenuItem* clearHistoryItem = new BMenuItem("Clear history",
+       BMenuItem* clearHistoryItem = new BMenuItem(B_TRANSLATE("Clear 
history"),
                new BMessage(CLEAR_HISTORY));
        clearHistoryItem->SetEnabled(count > 0);
        fHistoryMenu->AddItem(clearHistoryItem);
@@ -1885,8 +1912,8 @@ BrowserWindow::_UpdateHistoryMenu()
        BDateTime fiveDaysAgoStart = fourDaysAgoStart;
        fiveDaysAgoStart.Date().AddDays(-1);
 
-       BMenu* todayMenu = new BMenu("Today");
-       BMenu* yesterdayMenu = new BMenu("Yesterday");
+       BMenu* todayMenu = new BMenu(B_TRANSLATE("Today"));
+       BMenu* yesterdayMenu = new BMenu(B_TRANSLATE("Yesterday"));
        BMenu* twoDaysAgoMenu = new BMenu(
                twoDaysAgoStart.Date().LongDayName().String());
        BMenu* threeDaysAgoMenu = new BMenu(
@@ -1895,7 +1922,7 @@ BrowserWindow::_UpdateHistoryMenu()
                fourDaysAgoStart.Date().LongDayName().String());
        BMenu* fiveDaysAgoMenu = new BMenu(
                fiveDaysAgoStart.Date().LongDayName().String());
-       BMenu* earlierMenu = new BMenu("Earlier");
+       BMenu* earlierMenu = new BMenu(B_TRANSLATE("Earlier"));
 
        for (int32 i = 0; i < count; i++) {
                BrowsingHistoryItem historyItem = history->HistoryItemAt(i);
@@ -2075,8 +2102,9 @@ void
 BrowserWindow::_ShowProgressBar(bool show)
 {
        if (show) {
-               if (!fStatusGroup->IsVisible() && (fVisibleInterfaceElements & 
INTERFACE_ELEMENT_STATUS) != 0)
-                       fStatusGroup->SetVisible(true);
+               if (!fStatusGroup->IsVisible() && (fVisibleInterfaceElements
+                       & INTERFACE_ELEMENT_STATUS) != 0)
+                               fStatusGroup->SetVisible(true);
                fLoadingProgressBar->Show();
        } else {
                if (!fInterfaceVisible)
@@ -2130,7 +2158,7 @@ BrowserWindow::_SmartURLHandler(const BString& url) const
 {
        BString result = url;
 
-       // Only process if this doesn't look like a full URL (http:// or 
+       // Only process if this doesn't look like a full URL (http:// or
        // file://, etc.)
        if (url.FindFirst("://") == B_ERROR) {
                if (url.FindFirst(".") == B_ERROR || url.FindFirst(" ") != 
B_ERROR)
@@ -2207,7 +2235,8 @@ BrowserWindow::_HandlePageSourceResult(const BMessage* 
message)
                char buffer[1024];
                snprintf(buffer, sizeof(buffer), "Failed to show the "
                        "page source: %s\n", strerror(ret));
-               BAlert* alert = new BAlert("Page source error", buffer, "OK");
+               BAlert* alert = new BAlert(B_TRANSLATE("Page source error"), 
buffer,
+                       B_TRANSLATE("OK"));
                alert->Go(NULL);
        }
 }
diff --git a/src/apps/webpositive/DownloadProgressView.cpp 
b/src/apps/webpositive/DownloadProgressView.cpp
index 7031e42..16c0ff1 100644
--- a/src/apps/webpositive/DownloadProgressView.cpp
+++ b/src/apps/webpositive/DownloadProgressView.cpp
@@ -32,11 +32,13 @@
 #include <Alert.h>
 #include <Bitmap.h>
 #include <Button.h>
+#include <Catalog.h>
 #include <Clipboard.h>
 #include <Directory.h>
 #include <Entry.h>
 #include <FindDirectory.h>
 #include <GroupLayoutBuilder.h>
+#include <Locale.h>
 #include <MenuItem.h>
 #include <NodeInfo.h>
 #include <NodeMonitor.h>
@@ -51,6 +53,9 @@
 #include "StringForSize.h"
 
 
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Download Window"
+
 enum {
        OPEN_DOWNLOAD                   = 'opdn',
        RESTART_DOWNLOAD                = 'rsdn',
@@ -143,7 +148,8 @@ public:
 
        virtual BSize MinSize()
        {
-               return BSize(fIconBitmap.Bounds().Width(), 
fIconBitmap.Bounds().Height());
+               return BSize(fIconBitmap.Bounds().Width(),
+                       fIconBitmap.Bounds().Height());
        }
 
        virtual BSize PreferredSize()
@@ -218,8 +224,8 @@ DownloadProgressView::Init(BMessage* archive)
        fLastSpeedReferenceSize = 0;
        fEstimatedFinishReferenceSize = 0;
 
-       fProcessStartTime = fLastSpeedReferenceTime = 
fEstimatedFinishReferenceTime
-               = system_time();
+       fProcessStartTime = fLastSpeedReferenceTime
+               = fEstimatedFinishReferenceTime = system_time();
 
        SetViewColor(245, 245, 245);
        SetFlags(Flags() | B_FULL_UPDATE_ON_RESIZE | B_WILL_DRAW);
@@ -245,16 +251,20 @@ DownloadProgressView::Init(BMessage* archive)
        } else
                fIconView = new IconView();
 
-       if (!fDownload && (fStatusBar->CurrentValue() < 100 || !entry.Exists()))
-               fTopButton = new SmallButton("Restart", new 
BMessage(RESTART_DOWNLOAD));
-       else {
-               fTopButton = new SmallButton("Open", new 
BMessage(OPEN_DOWNLOAD));
+       if (!fDownload && (fStatusBar->CurrentValue() < 100 || 
!entry.Exists())) {
+               fTopButton = new SmallButton(B_TRANSLATE("Restart"),
+                       new BMessage(RESTART_DOWNLOAD));
+       } else {
+               fTopButton = new SmallButton(B_TRANSLATE("Open"),
+                       new BMessage(OPEN_DOWNLOAD));
                fTopButton->SetEnabled(fDownload == NULL);
        }
-       if (fDownload)
-               fBottomButton = new SmallButton("Cancel", new 
BMessage(CANCEL_DOWNLOAD));
-       else {
-               fBottomButton = new SmallButton("Remove", new 
BMessage(REMOVE_DOWNLOAD));
+       if (fDownload) {
+               fBottomButton = new SmallButton(B_TRANSLATE("Cancel"),
+                       new BMessage(CANCEL_DOWNLOAD));
+       } else {
+               fBottomButton = new SmallButton(B_TRANSLATE("Remove"),
+                       new BMessage(REMOVE_DOWNLOAD));
                fBottomButton->SetEnabled(fDownload == NULL);
        }
 
@@ -399,8 +409,9 @@ DownloadProgressView::MessageReceived(BMessage* message)
                        if (status == B_OK)
                                status = be_roster->Launch(&ref);
                        if (status != B_OK && status != B_ALREADY_RUNNING) {
-                               BAlert* alert = new BAlert("Open download 
error",
-                                       "The download could not be opened.", 
"OK");
+                               BAlert* alert = new BAlert(B_TRANSLATE("Open 
download error"),
+                                       B_TRANSLATE("The download could not be 
opened."),
+                                       B_TRANSLATE("OK"));
                                alert->Go(NULL);
                        }
                        break;
@@ -572,11 +583,11 @@ DownloadProgressView::ShowContextMenu(BPoint screenWhere)
        screenWhere += BPoint(2, 2);
 
        BPopUpMenu* contextMenu = new BPopUpMenu("download context");
-       BMenuItem* copyURL = new BMenuItem("Copy URL to clipboard",
+       BMenuItem* copyURL = new BMenuItem(B_TRANSLATE("Copy URL to clipboard"),
                new BMessage(COPY_URL_TO_CLIPBOARD));
        copyURL->SetEnabled(fURL.Length() > 0);
        contextMenu->AddItem(copyURL);
-       BMenuItem* openFolder = new BMenuItem("Open containing folder",
+       BMenuItem* openFolder = new BMenuItem(B_TRANSLATE("Open containing 
folder"),
                new BMessage(OPEN_CONTAINING_FOLDER));
        contextMenu->AddItem(openFolder);
 
@@ -622,7 +633,7 @@ DownloadProgressView::DownloadFinished()
                fExpectedSize = fCurrentSize;
        }
        fTopButton->SetEnabled(true);
-       fBottomButton->SetLabel("Remove");
+       fBottomButton->SetLabel(B_TRANSLATE("Remove"));
        fBottomButton->SetMessage(new BMessage(REMOVE_DOWNLOAD));
        fBottomButton->SetEnabled(true);
        fInfoView->SetText("");
@@ -633,10 +644,10 @@ void
 DownloadProgressView::DownloadCanceled()
 {
        fDownload = NULL;
-       fTopButton->SetLabel("Restart");
+       fTopButton->SetLabel(B_TRANSLATE("Restart"));
        fTopButton->SetMessage(new BMessage(RESTART_DOWNLOAD));
        fTopButton->SetEnabled(true);
-       fBottomButton->SetLabel("Remove");
+       fBottomButton->SetLabel(B_TRANSLATE("Remove"));
        fBottomButton->SetMessage(new BMessage(REMOVE_DOWNLOAD));
        fBottomButton->SetEnabled(true);
        fInfoView->SetText("");
@@ -726,12 +737,14 @@ DownloadProgressView::_UpdateStatusText()
                        currentSize.Truncate(currentSizeUnitPos);
                }
                buffer << currentSize;
-               buffer << " of ";
+               buffer << " ";
+               buffer << B_TRANSLATE_COMMENT("of", "...as in '12kB of 256kB'");
+               buffer << " ";
                buffer << expectedSize;
                buffer << ", ";
                buffer << string_for_size(fBytesPerSecond, sizeBuffer,
                        sizeof(sizeBuffer));
-               buffer << "/s)";
+               buffer << B_TRANSLATE_COMMENT("/s)", "...as in 'per second'");
                float stringWidth = fInfoView->StringWidth(buffer.String());
                if (stringWidth < fInfoView->Bounds().Width())
                        fInfoView->SetText(buffer.String());
@@ -739,7 +752,7 @@ DownloadProgressView::_UpdateStatusText()
                        // complete string too wide, try with shorter version
                        buffer << string_for_size(fBytesPerSecond, sizeBuffer,
                                sizeof(sizeBuffer));
-                       buffer << "/s";
+                       buffer << B_TRANSLATE_COMMENT("/s)", "...as in 'per 
second'");
                        stringWidth = fInfoView->StringWidth(buffer.String());
                        if (stringWidth < fInfoView->Bounds().Width())
                                fInfoView->SetText(buffer.String());
@@ -770,7 +783,7 @@ DownloadProgressView::_UpdateStatusText()
                                2, time->tm_hour, 2, time->tm_min);
                }
 
-               BString buffer1("Finish: ");
+               BString buffer1(B_TRANSLATE_COMMENT("Finish: ", "Finishing 
time"));
                buffer1 << timeText;
                finishTime -= now;
                time = gmtime(&finishTime);
@@ -779,30 +792,36 @@ DownloadProgressView::_UpdateStatusText()
                if (finishTime > secondsPerDay) {
                        int64 days = finishTime / secondsPerDay;
                        if (days == 1)
-                               buffer2 << "Over 1 day";
-                       else
-                               buffer2 << "Over " << days << " days";
+                               buffer2 << B_TRANSLATE("Over 1 day left");
+                       else {
+                               buffer2 << B_TRANSLATE("Over %days days left");
+                               buffer2.ReplaceFirst("%days", BString() << 
days);
+                       }
                } else if (finishTime > 60 * 60) {
                        int64 hours = finishTime / (60 * 60);
                        if (hours == 1)
-                               buffer2 << "Over 1 hour";
-                       else
-                               buffer2 << "Over " << hours << " hours";
+                               buffer2 << B_TRANSLATE("Over 1 hour left");
+                       else {
+                               buffer2 << B_TRANSLATE("Over %hours hours 
left");
+                               buffer2.ReplaceFirst("%hours", BString() << 
hours);
+                       }
                } else if (finishTime > 60) {
                        int64 minutes = finishTime / 60;
                        if (minutes == 1)
-                               buffer2 << "Over 1 minute";
-                       else
-                               buffer2 << minutes << " minutes";
+                               buffer2 << B_TRANSLATE("Over 1 minute left");
+                       else {
+                               buffer2 << B_TRANSLATE("%minutes minutes");
+                               buffer2.ReplaceFirst("%minutes", BString() << 
minutes);
+                       }
                } else {
                        if (finishTime == 1)
-                               buffer2 << "1 second";
-                       else
-                               buffer2 << finishTime << " seconds";
+                               buffer2 << B_TRANSLATE("1 second left");
+                       else {
+                               buffer2 << B_TRANSLATE("%seconds seconds left");
+                               buffer2.ReplaceFirst("%seconds", BString() << 
finishTime);
+                       }
                }
 
-               buffer2 << " left";
-
                buffer = "(";
                buffer << buffer1 << " - " << buffer2 << ")";
 
diff --git a/src/apps/webpositive/DownloadWindow.cpp 
b/src/apps/webpositive/DownloadWindow.cpp
index 859722d..72c7663 100644
--- a/src/apps/webpositive/DownloadWindow.cpp
+++ b/src/apps/webpositive/DownloadWindow.cpp
@@ -31,12 +31,14 @@
 
 #include <Alert.h>
 #include <Button.h>
+#include <Catalog.h>
 #include <ControlLook.h>
 #include <Entry.h>
 #include <File.h>
 #include <FindDirectory.h>
 #include <GroupLayout.h>
 #include <GroupLayoutBuilder.h>
+#include <Locale.h>
 #include <MenuBar.h>
 #include <MenuItem.h>
 #include <Path.h>
@@ -54,6 +56,9 @@
 #include "WebPage.h"
 
 
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Download Window"
+
 enum {
        INIT = 'init',
        OPEN_DOWNLOADS_FOLDER = 'odnf',
@@ -134,7 +139,7 @@ protected:
 
 DownloadWindow::DownloadWindow(BRect frame, bool visible,
                SettingsMessage* settings)
-       : BWindow(frame, "Downloads",
+       : BWindow(frame, B_TRANSLATE("Downloads"),
                B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
                B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | 
B_NOT_ZOOMABLE),
        fMinimizeOnClose(false)
@@ -155,26 +160,27 @@ DownloadWindow::DownloadWindow(BRect frame, bool visible,
        fDownloadViewsLayout = downloadsGroupView->GroupLayout();
 
        BMenuBar* menuBar = new BMenuBar("Menu bar");
-       BMenu* menu = new BMenu("Downloads");
-       menu->AddItem(new BMenuItem("Open downloads folder",
+       BMenu* menu = new BMenu(B_TRANSLATE("Downloads"));
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Open downloads folder"),
                new BMessage(OPEN_DOWNLOADS_FOLDER)));
        BMessage* newWindowMessage = new BMessage(NEW_WINDOW);
        newWindowMessage->AddString("url", "");
-       BMenuItem* newWindowItem = new BMenuItem("New browser window",
+       BMenuItem* newWindowItem = new BMenuItem(B_TRANSLATE("New browser 
window"),
                newWindowMessage, 'N');
        menu->AddItem(newWindowItem);
        newWindowItem->SetTarget(be_app);
        menu->AddSeparatorItem();
-       menu->AddItem(new BMenuItem("Hide", new BMessage(B_QUIT_REQUESTED), 
'D'));
+       menu->AddItem(new BMenuItem(B_TRANSLATE("Hide"),
+               new BMessage(B_QUIT_REQUESTED), 'D'));
        menuBar->AddItem(menu);
 
        fDownloadsScrollView = new 
DownloadContainerScrollView(downloadsGroupView);
 
-       fRemoveFinishedButton = new BButton("Remove finished",
+       fRemoveFinishedButton = new BButton(B_TRANSLATE("Remove finished"),
                new BMessage(REMOVE_FINISHED_DOWNLOADS));
        fRemoveFinishedButton->SetEnabled(false);
 
-       fRemoveMissingButton = new BButton("Remove missing",
+       fRemoveMissingButton = new BButton(B_TRANSLATE("Remove missing"),
                new BMessage(REMOVE_MISSING_DOWNLOADS));
        fRemoveMissingButton->SetEnabled(false);
 
@@ -274,11 +280,12 @@ DownloadWindow::MessageReceived(BMessage* message)
                        if (status == B_OK)
                                status = be_roster->Launch(&ref);
                        if (status != B_OK && status != B_ALREADY_RUNNING) {
-                               BString errorString("The downloads folder could 
not be "
-                                       "opened.\n\n");
-                               errorString << "Error: " << strerror(status);
-                               BAlert* alert = new BAlert("Error opening 
downloads folder",
-                                       errorString.String(), "OK");
+                               BString errorString(B_TRANSLATE_COMMENT("The 
downloads folder could "
+                                       "not be opened.\n\nError: %error", 
"Don't translate "
+                                       "variable %error"));
+                               errorString.ReplaceFirst("%error", 
strerror(status));
+                               BAlert* alert = new BAlert(B_TRANSLATE("Error 
opening downloads "
+                                       "folder"), errorString.String(), 
B_TRANSLATE("OK"));
                                alert->Go(NULL);
                        }
                        break;
@@ -528,9 +535,10 @@ DownloadWindow::_SaveSettings()
                        item->View());
                if (!view)
                        continue;
-          BMessage downloadArchive;
-          if (view->SaveSettings(&downloadArchive) == B_OK)
-                  message.AddMessage("download", &downloadArchive);
+
+       BMessage downloadArchive;
+               if (view->SaveSettings(&downloadArchive) == B_OK)
+                       message.AddMessage("download", &downloadArchive);
        }
        message.Flatten(&file);
 }
diff --git a/src/apps/webpositive/URLInputGroup.cpp 
b/src/apps/webpositive/URLInputGroup.cpp
index f84f0e1..421d78f 100644
--- a/src/apps/webpositive/URLInputGroup.cpp
+++ b/src/apps/webpositive/URLInputGroup.cpp
@@ -7,10 +7,12 @@
 
 #include <Bitmap.h>
 #include <Button.h>
+#include <Catalog.h>
 #include <ControlLook.h>
 #include <Clipboard.h>
 #include <GroupLayout.h>
 #include <GroupLayoutBuilder.h>
+#include <Locale.h>
 #include <LayoutUtils.h>
 #include <MenuItem.h>
 #include <PopUpMenu.h>
@@ -28,6 +30,10 @@
 #include "TextViewCompleter.h"
 
 
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "URL Bar"
+
+
 class URLChoice : public BAutoCompleter::Choice {
 public:
        URLChoice(const BString& choiceText, const BString& displayText,
@@ -235,10 +241,14 @@ URLInputGroup::URLTextView::MouseDown(BPoint where)
                        be_clipboard->Unlock();
                }
 
-               BMenuItem* cutItem = new BMenuItem("Cut", new BMessage(B_CUT));
-               BMenuItem* copyItem = new BMenuItem("Copy", new 
BMessage(B_COPY));
-               BMenuItem* pasteItem = new BMenuItem("Paste", new 
BMessage(B_PASTE));
-               BMenuItem* clearItem = new BMenuItem("Clear", new 
BMessage(MSG_CLEAR));
+               BMenuItem* cutItem = new BMenuItem(B_TRANSLATE("Cut"),
+                       new BMessage(B_CUT));
+               BMenuItem* copyItem = new BMenuItem(B_TRANSLATE("Copy"),
+                       new BMessage(B_COPY));
+               BMenuItem* pasteItem = new BMenuItem(B_TRANSLATE("Paste"),
+                       new BMessage(B_PASTE));
+               BMenuItem* clearItem = new BMenuItem(B_TRANSLATE("Clear"),
+                       new BMessage(MSG_CLEAR));
                cutItem->SetEnabled(canCutOrCopy);
                copyItem->SetEnabled(canCutOrCopy);
                pasteItem->SetEnabled(canPaste);
@@ -362,8 +372,8 @@ URLInputGroup::URLTextView::InsertText(const char* inText, 
int32 inLength,
                baseUrlEnd = TextLength();
        BFont font;
        GetFont(&font);
-       const rgb_color black = (rgb_color){ 0, 0, 0, 255 };
-       const rgb_color gray = (rgb_color){ 60, 60, 60, 255 };
+       const rgb_color black = (rgb_color) { 0, 0, 0, 255 };
+       const rgb_color gray = (rgb_color) { 60, 60, 60, 255 };
        if (baseUrlStart > 0)
                SetFontAndColor(0, baseUrlStart - 1, &font, B_FONT_ALL, &gray);
        if (baseUrlEnd > baseUrlStart) {


Other related posts:

  • » [haiku-commits] haiku: hrev44315 - src/apps/webpositive - alex