Author: pulkomandy Date: 2010-12-24 10:52:32 +0100 (Fri, 24 Dec 2010) New Revision: 39937 Changeset: http://dev.haiku-os.org/changeset/39937 Modified: haiku/trunk/src/apps/launchbox/App.cpp haiku/trunk/src/apps/launchbox/IconButton.cpp haiku/trunk/src/apps/launchbox/Jamfile haiku/trunk/src/apps/launchbox/LaunchButton.cpp haiku/trunk/src/apps/launchbox/MainWindow.cpp haiku/trunk/src/apps/launchbox/NamePanel.cpp haiku/trunk/src/apps/launchbox/PadView.cpp Log: Patch by Mike Roll as part of GCI: i18n LaunchBox Modified: haiku/trunk/src/apps/launchbox/App.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/App.cpp 2010-12-24 09:42:38 UTC (rev 39936) +++ haiku/trunk/src/apps/launchbox/App.cpp 2010-12-24 09:52:32 UTC (rev 39937) @@ -8,6 +8,7 @@ #include <stdio.h> #include <AboutWindow.h> +#include <Catalog.h> #include <Entry.h> #include <Message.h> #include <String.h> @@ -16,6 +17,8 @@ #include "MainWindow.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "LaunchBox" App::App() : @@ -49,11 +52,13 @@ status_t status = load_settings(&settings, "main_settings", "LaunchBox"); if (status >= B_OK) { BMessage windowMessage; - for (int32 i = 0; settings.FindMessage("window", i, &windowMessage) >= B_OK; i++) { - BString name("Pad "); + for (int32 i = 0; settings.FindMessage("window", i, &windowMessage) + >= B_OK; i++) { + BString name(B_TRANSLATE("Pad ")); name << i + 1; BMessage* windowSettings = new BMessage(windowMessage); - MainWindow* window = new MainWindow(name.String(), frame, windowSettings); + MainWindow* window = new MainWindow(name.String(), frame, + windowSettings); window->Show(); windowAdded = true; frame.OffsetBy(10.0, 10.0); @@ -62,7 +67,7 @@ } if (!windowAdded) { - MainWindow* window = new MainWindow("Pad 1", frame, true); + MainWindow* window = new MainWindow(B_TRANSLATE("Pad 1"), frame, true); window->Show(); } } @@ -75,7 +80,7 @@ case MSG_ADD_WINDOW: { BMessage* settings = new BMessage('sett'); bool wasCloned = message->FindMessage("window", settings) == B_OK; - BString name("Pad "); + BString name(B_TRANSLATE("Pad ")); name << CountWindows() + 1; MainWindow* window = new MainWindow(name.String(), BRect(50.0, 50.0, 65.0, 100.0), settings); @@ -99,9 +104,10 @@ App::AboutRequested() { const char* authors[2]; - authors[0] = "Stephan Aßmus (aka stippi)"; + authors[0] = B_TRANSLATE("Stephan Aßmus (aka stippi)"); authors[1] = NULL; - BAboutWindow("LaunchBox", 2004, authors).Show(); + BString appName = B_TRANSLATE("LaunchBox"); + BAboutWindow(appName, 2004, authors).Show(); } Modified: haiku/trunk/src/apps/launchbox/IconButton.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/IconButton.cpp 2010-12-24 09:42:38 UTC (rev 39936) +++ haiku/trunk/src/apps/launchbox/IconButton.cpp 2010-12-24 09:52:32 UTC (rev 39937) @@ -16,6 +16,7 @@ #include <Application.h> #include <Bitmap.h> +#include <Catalog.h> #include <Control.h> #include <ControlLook.h> #include <Entry.h> @@ -28,6 +29,8 @@ #include <TranslationUtils.h> #include <Window.h> +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "LaunchBox" using std::nothrow; // constructor @@ -384,13 +387,17 @@ if (status == B_OK) fileBitmap = BTranslationUtils::GetBitmap(path.Path()); else - printf("IconButton::SetIcon() - path.Append() failed: %s\n", strerror(status)); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "path.Append() failed: %s\n"), strerror(status)); } else - printf("IconButton::SetIcon() - path.GetParent() failed: %s\n", strerror(status)); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "path.GetParent() failed: %s\n"), strerror(status)); } else - printf("IconButton::SetIcon() - path.InitCheck() failed: %s\n", strerror(status)); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "path.InitCheck() failed: %s\n"), strerror(status)); } else - printf("IconButton::SetIcon() - be_app->GetAppInfo() failed: %s\n", strerror(status)); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "be_app->GetAppInfo() failed: %s\n"), strerror(status)); } else fileBitmap = BTranslationUtils::GetBitmap(pathToBitmap); if (fileBitmap) { @@ -433,14 +440,18 @@ status = _MakeBitmaps(bitmap); delete bitmap; } else - printf("IconButton::SetIcon() - B_RGB32 bitmap is not valid\n"); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "B_RGB32 bitmap is not valid\n")); } else - printf("IconButton::SetIcon() - fileType->GetIcon() failed: %s\n", strerror(status)); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "fileType->GetIcon() failed: %s\n"), strerror(status)); } else - printf("IconButton::SetIcon() - B_CMAP8 bitmap is not valid\n"); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "B_CMAP8 bitmap is not valid\n")); delete mimeBitmap; } else - printf("IconButton::SetIcon() - fileType is not valid: %s\n", strerror(status)); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "fileType is not valid: %s\n"), strerror(status)); return status; } @@ -474,7 +485,7 @@ } status = _MakeBitmaps(bitmap); } else - printf("IconButton::SetIcon() - B_RGB32 bitmap is not valid\n"); + printf(B_TRANSLATE("IconButton::SetIcon() - B_RGB32 bitmap is not valid\n")); delete bitmap; } else { // native colorspace (32 bits) @@ -498,7 +509,8 @@ status = _MakeBitmaps(quickResBitmap); } } else - printf("IconButton::SetIcon() - error allocating bitmap: %s\n", strerror(status)); + printf(B_TRANSLATE("IconButton::SetIcon() - " + "error allocating bitmap: %s\n"), strerror(status)); delete quickResBitmap; } return status; @@ -747,17 +759,20 @@ } // unsupported format } else { - printf("IconButton::_MakeBitmaps() - bitmap has unsupported colorspace\n"); + printf(B_TRANSLATE("IconButton::_MakeBitmaps() - " + "bitmap has unsupported colorspace\n")); status = B_MISMATCHED_VALUES; _DeleteBitmaps(); } } else { - printf("IconButton::_MakeBitmaps() - error allocating local bitmaps\n"); + printf(B_TRANSLATE("IconButton::_MakeBitmaps() - " + "error allocating local bitmaps\n")); status = B_NO_MEMORY; _DeleteBitmaps(); } } else - printf("IconButton::_MakeBitmaps() - bitmap is not valid\n"); + printf(B_TRANSLATE("IconButton::_MakeBitmaps() - " + "bitmap is not valid\n")); return status; } Modified: haiku/trunk/src/apps/launchbox/Jamfile =================================================================== --- haiku/trunk/src/apps/launchbox/Jamfile 2010-12-24 09:42:38 UTC (rev 39936) +++ haiku/trunk/src/apps/launchbox/Jamfile 2010-12-24 09:52:32 UTC (rev 39937) @@ -12,7 +12,17 @@ PadView.cpp Panel.cpp support.cpp - : be translation libshared.a $(TARGET_LIBSUPC++) + : be translation libshared.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) : LaunchBox.rdef ; +DoCatalogs LaunchBox : + x-vnd.Haiku-LaunchBox + : + App.cpp + IconButton.cpp + LaunchButton.cpp + MainWindow.cpp + NamePanel.cpp + PadView.cpp +; Modified: haiku/trunk/src/apps/launchbox/LaunchButton.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/LaunchButton.cpp 2010-12-24 09:42:38 UTC (rev 39936) +++ haiku/trunk/src/apps/launchbox/LaunchButton.cpp 2010-12-24 09:52:32 UTC (rev 39937) @@ -13,6 +13,7 @@ #include <AppDefs.h> #include <AppFileInfo.h> #include <Bitmap.h> +#include <Catalog.h> #include <File.h> #include <Node.h> #include <NodeInfo.h> @@ -23,10 +24,12 @@ #include "PadView.h" #include "MainWindow.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "LaunchBox" static const float kDragStartDist = 10.0; static const float kDragBitmapAlphaScale = 0.6; -static const char* kEmptyHelpString = "You can drag an icon here."; +static const char* kEmptyHelpString = B_TRANSLATE("You can drag an icon here."); bigtime_t @@ -302,10 +305,12 @@ if (info.GetSignature(mimeSig) == B_OK) { SetTo(mimeSig, false); } else { - fprintf(stderr, "no MIME signature for '%s'\n", fRef->name); + fprintf(stderr, B_TRANSLATE("no MIME signature for '%s'\n"), + fRef->name); } } else { - fprintf(stderr, "no BAppFileInfo for '%s'\n", fRef->name); + fprintf(stderr, B_TRANSLATE("no BAppFileInfo for '%s'\n"), + fRef->name); } } else { fRef = NULL; Modified: haiku/trunk/src/apps/launchbox/MainWindow.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/MainWindow.cpp 2010-12-24 09:42:38 UTC (rev 39936) +++ haiku/trunk/src/apps/launchbox/MainWindow.cpp 2010-12-24 09:52:32 UTC (rev 39937) @@ -9,6 +9,7 @@ #include <Alert.h> #include <Application.h> +#include <Catalog.h> #include <GroupLayout.h> #include <Menu.h> #include <MenuItem.h> @@ -24,6 +25,8 @@ #include "PadView.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "LaunchBox" MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons) : BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, @@ -94,9 +97,10 @@ be_app->PostMessage(B_QUIT_REQUESTED); return false; } else { - BAlert* alert = new BAlert("last chance", "Really close this pad?\n" - "(The pad will not be remembered.)", - "Close", "Cancel", NULL); + BAlert* alert = new BAlert(B_TRANSLATE("last chance"), + B_TRANSLATE("Really close this pad?\n" + "(The pad will not be remembered.)"), + B_TRANSLATE("Close"), B_TRANSLATE("Cancel"), NULL); if (alert->Go() == 1) return false; } @@ -127,24 +131,24 @@ trackerMessage.AddRef("refs", button->Ref()); status_t ret = messenger.SendMessage(&trackerMessage); if (ret < B_OK) { - errorMessage = "Failed to send 'open folder' " - "command to Tracker.\n\nError: "; + errorMessage = B_TRANSLATE("Failed to send " + "'open folder' command to Tracker.\n\nError: "); errorMessage << strerror(ret); } else launchedByRef = true; } else - errorMessage = "Failed to open folder - is Tracker " - "running?"; + errorMessage = ("Failed to open folder - is Tracker " + "running?"); } else { status_t ret = be_roster->Launch(button->Ref()); if (ret < B_OK && ret != B_ALREADY_RUNNING) { - errorMessage = "Failed to launch '"; + errorMessage = B_TRANSLATE("Failed to launch '"); BPath path(button->Ref()); if (path.InitCheck() >= B_OK) errorMessage << path.Path(); else errorMessage << button->Ref()->name; - errorMessage << "'.\n\nError: "; + errorMessage << B_TRANSLATE("'.\n\nError: "); errorMessage << strerror(ret); } else launchedByRef = true; @@ -153,9 +157,10 @@ if (!launchedByRef && button->AppSignature()) { status_t ret = be_roster->Launch(button->AppSignature()); if (ret != B_OK && ret != B_ALREADY_RUNNING) { - errorMessage = "Failed to launch application with " - "signature '"; - errorMessage << button->AppSignature() << "'.\n\nError: "; + errorMessage = B_TRANSLATE("Failed to launch application" + " with signature '"); + errorMessage << button->AppSignature() << + B_TRANSLATE("'.\n\nError: "); errorMessage << strerror(ret); } else { // clear error message on success (might have been @@ -163,12 +168,12 @@ errorMessage = ""; } } else if (!launchedByRef) { - errorMessage = "Failed to launch 'something', error in " - "Pad data."; + errorMessage = B_TRANSLATE("Failed to launch 'something'," + "error in Pad data."); } if (errorMessage.Length() > 0) { BAlert* alert = new BAlert("error", errorMessage.String(), - "Bummer", NULL, NULL, B_WIDTH_FROM_WIDEST); + B_TRANSLATE("Bummer"), NULL, NULL, B_WIDTH_FROM_WIDEST); alert->Go(NULL); } break; @@ -207,7 +212,7 @@ // message comes from pad view entry_ref* ref = button->Ref(); if (ref) { - BString helper("Description for '"); + BString helper(B_TRANSLATE("Description for '")); helper << ref->name << "'"; make_sure_frame_is_on_screen(fNamePanelFrame, this); new NamePanel(helper.String(), button->Description(), Modified: haiku/trunk/src/apps/launchbox/NamePanel.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/NamePanel.cpp 2010-12-24 09:42:38 UTC (rev 39936) +++ haiku/trunk/src/apps/launchbox/NamePanel.cpp 2010-12-24 09:52:32 UTC (rev 39937) @@ -6,12 +6,15 @@ #include <stdio.h> #include <Button.h> +#include <Catalog.h> #include <LayoutBuilder.h> #include <Screen.h> #include <TextControl.h> #include "NamePanel.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "LaunchBox" enum { MSG_PANEL_OK, MSG_PANEL_CANCEL, @@ -21,7 +24,7 @@ NamePanel::NamePanel(const char* label, const char* text, BWindow* window, BHandler* target, BMessage* message, BRect frame) : - Panel(frame, "Name Panel", + Panel(frame, B_TRANSLATE("Name Panel"), B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS), @@ -29,8 +32,9 @@ fTarget(target), fMessage(message) { - BButton* defaultButton = new BButton("OK", new BMessage(MSG_PANEL_OK)); - BButton* cancelButton = new BButton("Cancel", + BButton* defaultButton = new BButton(B_TRANSLATE("OK"), + new BMessage(MSG_PANEL_OK)); + BButton* cancelButton = new BButton(B_TRANSLATE("Cancel"), new BMessage(MSG_PANEL_CANCEL)); fNameTC = new BTextControl(label, text, NULL); Modified: haiku/trunk/src/apps/launchbox/PadView.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/PadView.cpp 2010-12-24 09:42:38 UTC (rev 39936) +++ haiku/trunk/src/apps/launchbox/PadView.cpp 2010-12-24 09:52:32 UTC (rev 39937) @@ -8,6 +8,7 @@ #include <stdio.h> #include <Application.h> +#include <Catalog.h> #include <GroupLayout.h> #include <MenuItem.h> #include <Message.h> @@ -20,6 +21,10 @@ #include "MainWindow.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "LaunchBox" + + static bigtime_t sActivationDelay = 40000; static const uint32 kIconSizes[] = { 16, 20, 24, 32, 40, 48, 64 }; @@ -315,11 +320,11 @@ break; } } - BPopUpMenu* menu = new BPopUpMenu("launch popup", false, false); + BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE("launch popup"), false, false); // add button BMessage* message = new BMessage(MSG_ADD_SLOT); message->AddPointer("be:source", (void*)nearestButton); - BMenuItem* item = new BMenuItem("Add button here", message); + BMenuItem* item = new BMenuItem(B_TRANSLATE("Add button here"), message); item->SetTarget(window); menu->AddItem(item); // button options @@ -327,20 +332,21 @@ // clear button message = new BMessage(MSG_CLEAR_SLOT); message->AddPointer("be:source", (void*)button); - item = new BMenuItem("Clear button", message); + item = new BMenuItem(B_TRANSLATE("Clear button"), message); item->SetTarget(window); menu->AddItem(item); // remove button message = new BMessage(MSG_REMOVE_SLOT); message->AddPointer("be:source", (void*)button); - item = new BMenuItem("Remove button", message); + item = new BMenuItem(B_TRANSLATE("Remove button"), message); item->SetTarget(window); menu->AddItem(item); // set button description if (button->Ref()) { message = new BMessage(MSG_SET_DESCRIPTION); message->AddPointer("be:source", (void*)button); - item = new BMenuItem("Set description"B_UTF8_ELLIPSIS, message); + item = new BMenuItem(B_TRANSLATE("Set description"B_UTF8_ELLIPSIS), + message); item->SetTarget(window); menu->AddItem(item); } @@ -352,14 +358,14 @@ const char* toggleLayoutLabel; if (fButtonLayout->Orientation() == B_HORIZONTAL) - toggleLayoutLabel = "Vertical layout"; + toggleLayoutLabel = B_TRANSLATE("Vertical layout"); else - toggleLayoutLabel = "Horizontal layout"; + toggleLayoutLabel = B_TRANSLATE("Horizontal layout"); item = new BMenuItem(toggleLayoutLabel, new BMessage(MSG_TOGGLE_LAYOUT)); item->SetTarget(this); settingsM->AddItem(item); - BMenu* iconSizeM = new BMenu("Icon size"); + BMenu* iconSizeM = new BMenu(B_TRANSLATE("Icon size")); for (uint32 i = 0; i < sizeof(kIconSizes) / sizeof(uint32); i++) { uint32 iconSize = kIconSizes[i]; message = new BMessage(MSG_SET_ICON_SIZE); @@ -373,24 +379,24 @@ } settingsM->AddItem(iconSizeM); - item = new BMenuItem("Ignore double-click", + item = new BMenuItem(B_TRANSLATE("Ignore double-click"), new BMessage(MSG_SET_IGNORE_DOUBLECLICK)); item->SetTarget(this); item->SetMarked(IgnoreDoubleClick()); settingsM->AddItem(item); uint32 what = window->Look() == B_BORDERED_WINDOW_LOOK ? MSG_SHOW_BORDER : MSG_HIDE_BORDER; - item = new BMenuItem("Show window border", new BMessage(what)); + item = new BMenuItem(B_TRANSLATE("Show window border"), new BMessage(what)); item->SetTarget(window); item->SetMarked(what == MSG_HIDE_BORDER); settingsM->AddItem(item); - item = new BMenuItem("Auto-raise", new BMessage(MSG_TOGGLE_AUTORAISE)); + item = new BMenuItem(B_TRANSLATE("Auto-raise"), new BMessage(MSG_TOGGLE_AUTORAISE)); item->SetTarget(window); item->SetMarked(window->AutoRaise()); settingsM->AddItem(item); - item = new BMenuItem("Show on all workspaces", new BMessage(MSG_SHOW_ON_ALL_WORKSPACES)); + item = new BMenuItem(B_TRANSLATE("Show on all workspaces"), new BMessage(MSG_SHOW_ON_ALL_WORKSPACES)); item->SetTarget(window); item->SetMarked(window->ShowOnAllWorkspaces()); settingsM->AddItem(item); @@ -400,31 +406,31 @@ menu->AddSeparatorItem(); // pad commands - BMenu* padM = new BMenu("Pad"); + BMenu* padM = new BMenu(B_TRANSLATE("Pad")); padM->SetFont(be_plain_font); // new pad - item = new BMenuItem("New", new BMessage(MSG_ADD_WINDOW)); + item = new BMenuItem(B_TRANSLATE("New"), new BMessage(MSG_ADD_WINDOW)); item->SetTarget(be_app); padM->AddItem(item); // new pad - item = new BMenuItem("Clone", new BMessage(MSG_ADD_WINDOW)); + item = new BMenuItem(B_TRANSLATE("Clone"), new BMessage(MSG_ADD_WINDOW)); item->SetTarget(window); padM->AddItem(item); padM->AddSeparatorItem(); // close - item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED)); + item = new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_QUIT_REQUESTED)); item->SetTarget(window); padM->AddItem(item); menu->AddItem(padM); // app commands - BMenu* appM = new BMenu("LaunchBox"); + BMenu* appM = new BMenu(B_TRANSLATE("LaunchBox")); appM->SetFont(be_plain_font); // about - item = new BMenuItem("About", new BMessage(B_ABOUT_REQUESTED)); + item = new BMenuItem(B_TRANSLATE("About"), new BMessage(B_ABOUT_REQUESTED)); item->SetTarget(be_app); appM->AddItem(item); // quit - item = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED)); + item = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED)); item->SetTarget(be_app); appM->AddItem(item); menu->AddItem(appM);