Author: mmadia Date: 2010-05-06 18:46:42 +0200 (Thu, 06 May 2010) New Revision: 36666 Changeset: http://dev.haiku-os.org/changeset/36666/haiku Ticket: http://dev.haiku-os.org/ticket/5408 Modified: haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp haiku/trunk/src/apps/expander/ExpanderApp.cpp haiku/trunk/src/apps/expander/ExpanderPreferences.cpp haiku/trunk/src/apps/expander/ExpanderWindow.cpp Log: Updated to use B_TRANSLATE* macros. relates to #5408. Modified: haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp =================================================================== --- haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp 2010-05-06 16:33:24 UTC (rev 36665) +++ haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp 2010-05-06 16:46:42 UTC (rev 36666) @@ -77,16 +77,18 @@ } rect.right = rect.left -= 30; - float width = be_plain_font->StringWidth(TR("Select current")) + 20; + float width = be_plain_font->StringWidth( + B_TRANSLATE("Select current")) + 20; rect.left = width > 75 ? rect.right - width : rect.right - 75; - fCurrentButton = new BButton(rect, "directoryButton", TR("Select current"), - new BMessage(MSG_DIRECTORY), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); + fCurrentButton = new BButton(rect, "directoryButton", + B_TRANSLATE("Select current"), new BMessage(MSG_DIRECTORY), + B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); background->AddChild(fCurrentButton); fCurrentButton->SetTarget(Messenger()); - SetButtonLabel(B_DEFAULT_BUTTON, TR("Select")); - Window()->SetTitle(TR("Expander: Choose destination")); + SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Select")); + Window()->SetTitle(B_TRANSLATE("Expander: Choose destination")); Window()->Unlock(); @@ -106,7 +108,7 @@ entry_ref ref; GetPanelDirectory(&ref); if (snprintf(label, sizeof(label), - TR("Select '%s'"), ref.name) >= (int)sizeof(label)) + B_TRANSLATE("Select '%s'"), ref.name) >= (int)sizeof(label)) strcpy(label + sizeof(label) - 5, B_UTF8_ELLIPSIS "'"); // Resize button so that the label fits Modified: haiku/trunk/src/apps/expander/ExpanderApp.cpp =================================================================== --- haiku/trunk/src/apps/expander/ExpanderApp.cpp 2010-05-06 16:33:24 UTC (rev 36665) +++ haiku/trunk/src/apps/expander/ExpanderApp.cpp 2010-05-06 16:46:42 UTC (rev 36666) @@ -31,13 +31,13 @@ void ExpanderApp::AboutRequested() { - BString appName = TR("Expander"); + BString appName = B_TRANSLATE("Expander"); int nameLength = appName.CountChars(); - BAlert* alert = new BAlert("about", - appName.Append(TR("\n\twritten by Jérôme Duval\n" + BAlert* alert = new BAlert("about", + appName.Append(B_TRANSLATE("\n\twritten by Jérôme Duval\n" "\tCopyright 2004-2006, Haiku Inc.\n\noriginal Be version by \n" "Dominic, Hiroshi, Peter, Pavel and Robert\n")), - TR("OK")); + B_TRANSLATE("OK")); BTextView* view = alert->TextView(); BFont font; Modified: haiku/trunk/src/apps/expander/ExpanderPreferences.cpp =================================================================== --- haiku/trunk/src/apps/expander/ExpanderPreferences.cpp 2010-05-06 16:33:24 UTC (rev 36665) +++ haiku/trunk/src/apps/expander/ExpanderPreferences.cpp 2010-05-06 16:46:42 UTC (rev 36666) @@ -31,39 +31,40 @@ fUsePanel(NULL) { BBox* box = new BBox("background"); - box->SetLabel(TR("Expander settings")); + box->SetLabel(B_TRANSLATE("Expander settings")); fAutoExpand = new BCheckBox("autoExpand", - TR("Automatically expand files"), NULL); - fCloseWindow = new BCheckBox("closeWindowWhenDone", - TR("Close window when done expanding"), NULL); + B_TRANSLATE("Automatically expand files"), NULL); + fCloseWindow = new BCheckBox("closeWindowWhenDone", + B_TRANSLATE("Close window when done expanding"), NULL); fLeaveDest = new BRadioButton("leaveDest", - TR("Leave destination folder path empty"), + B_TRANSLATE("Leave destination folder path empty"), new BMessage(MSG_LEAVEDEST)); fSameDest = new BRadioButton("sameDir", - TR("Same directory as source (archive) file"), + B_TRANSLATE("Same directory as source (archive) file"), new BMessage(MSG_SAMEDIR)); fDestUse = new BRadioButton("destUse", - TR("Use:"), new BMessage(MSG_DESTUSE)); - fDestText = new BTextControl("destText", "", "", new BMessage(MSG_DESTTEXT)); + B_TRANSLATE("Use:"), new BMessage(MSG_DESTUSE)); + fDestText = new BTextControl("destText", "", "", + new BMessage(MSG_DESTTEXT)); fDestText->SetDivider(0); fDestText->TextView()->MakeEditable(false); fDestText->SetEnabled(false); - fSelect = new BButton("selectButton", TR("Select"), + fSelect = new BButton("selectButton", B_TRANSLATE("Select"), new BMessage(MSG_DESTSELECT)); fSelect->SetEnabled(false); fOpenDest = new BCheckBox("openDestination", - TR("Open destination folder after extraction"), NULL); + B_TRANSLATE("Open destination folder after extraction"), NULL); fAutoShow = new BCheckBox("autoShow", - TR("Automatically show contents listing"), NULL); + B_TRANSLATE("Automatically show contents listing"), NULL); BView* view = new BGroupView(); - view->SetLayout(new BGroupLayout(B_HORIZONTAL)); - view->AddChild(BGroupLayoutBuilder(B_VERTICAL) + view->SetLayout(new BGroupLayout(B_HORIZONTAL)); + view->AddChild(BGroupLayoutBuilder(B_VERTICAL) .AddGroup(B_HORIZONTAL) - .Add(new BStringView("expansion", TR("Expansion:"))) + .Add(new BStringView("expansion", B_TRANSLATE("Expansion:"))) .AddGlue() .End() .AddGroup(B_VERTICAL, 1) @@ -72,7 +73,8 @@ .SetInsets(10, 0, 0, 10) .End() .AddGroup(B_HORIZONTAL) - .Add(new BStringView("destinationFolder", TR("Destination folder:"))) + .Add(new BStringView("destinationFolder", + B_TRANSLATE("Destination folder:"))) .AddGlue() .End() .AddGroup(B_VERTICAL, 1) @@ -87,7 +89,7 @@ .SetInsets(10, 0, 0, 10) .End() .AddGroup(B_HORIZONTAL) - .Add(new BStringView("other", TR("Other:"))) + .Add(new BStringView("other", B_TRANSLATE("Other:"))) .AddGlue() .End() .AddGroup(B_VERTICAL, 1) @@ -99,21 +101,22 @@ ); box->AddChild(view); - BButton* button = new BButton("OKButton", TR("OK"), new BMessage(MSG_OK)); + BButton* button = new BButton("OKButton", B_TRANSLATE("OK"), + new BMessage(MSG_OK)); button->MakeDefault(true); - BButton* cancel = new BButton("CancelButton", TR("Cancel"), + BButton* cancel = new BButton("CancelButton", B_TRANSLATE("Cancel"), new BMessage(MSG_CANCEL)); - SetLayout(new BGroupLayout(B_HORIZONTAL)); - AddChild(BGroupLayoutBuilder(B_VERTICAL, 11) - .Add(box) - .AddGroup(B_HORIZONTAL, 10) - .AddGlue() - .Add(cancel) - .Add(button) - .End() - .SetInsets(10, 10, 10, 10) - ); + SetLayout(new BGroupLayout(B_HORIZONTAL)); + AddChild(BGroupLayoutBuilder(B_VERTICAL, 11) + .Add(box) + .AddGroup(B_HORIZONTAL, 10) + .AddGlue() + .Add(cancel) + .Add(button) + .End() + .SetInsets(10, 10, 10, 10) + ); CenterOnScreen(); @@ -220,13 +223,18 @@ Hide(); break; case MSG_OK: - fSettings->ReplaceBool("automatically_expand_files", fAutoExpand->Value() == B_CONTROL_ON); - fSettings->ReplaceBool("close_when_done", fCloseWindow->Value() == B_CONTROL_ON); - fSettings->ReplaceInt8("destination_folder", (fSameDest->Value() == B_CONTROL_ON) ? 0x63 + fSettings->ReplaceBool("automatically_expand_files", + fAutoExpand->Value() == B_CONTROL_ON); + fSettings->ReplaceBool("close_when_done", + fCloseWindow->Value() == B_CONTROL_ON); + fSettings->ReplaceInt8("destination_folder", + (fSameDest->Value() == B_CONTROL_ON) ? 0x63 : ((fLeaveDest->Value() == B_CONTROL_ON) ? 0x66 : 0x65)); fSettings->ReplaceRef("destination_folder_use", &fRef); - fSettings->ReplaceBool("open_destination_folder", fOpenDest->Value() == B_CONTROL_ON); - fSettings->ReplaceBool("show_contents_listing", fAutoShow->Value() == B_CONTROL_ON); + fSettings->ReplaceBool("open_destination_folder", + fOpenDest->Value() == B_CONTROL_ON); + fSettings->ReplaceBool("show_contents_listing", + fAutoShow->Value() == B_CONTROL_ON); Hide(); break; default: Modified: haiku/trunk/src/apps/expander/ExpanderWindow.cpp =================================================================== --- haiku/trunk/src/apps/expander/ExpanderWindow.cpp 2010-05-06 16:33:24 UTC (rev 36665) +++ haiku/trunk/src/apps/expander/ExpanderWindow.cpp 2010-05-06 16:46:42 UTC (rev 36666) @@ -50,7 +50,8 @@ ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref, BMessage* settings) : - BWindow(frame, TR_CMT("Expander", "!! Window Title !!"), B_TITLED_WINDOW, B_NORMAL_WINDOW_FEEL), + BWindow(frame, B_TRANSLATE_COMMENT("Expander", "!! Window Title !!"), + B_TITLED_WINDOW, B_NORMAL_WINDOW_FEEL), fSourcePanel(NULL), fDestPanel(NULL), fSourceChanged(true), @@ -66,9 +67,12 @@ _AddMenuBar(layout); - fDestButton = new BButton(TR("Destination"), new BMessage(MSG_DEST)); - fSourceButton = new BButton(TR("Source"), new BMessage(MSG_SOURCE)); - fExpandButton = new BButton(TR("Expand"), new BMessage(MSG_EXPAND)); + fDestButton = new BButton(B_TRANSLATE("Destination"), + new BMessage(MSG_DEST)); + fSourceButton = new BButton(B_TRANSLATE("Source"), + new BMessage(MSG_SOURCE)); + fExpandButton = new BButton(B_TRANSLATE("Expand"), + new BMessage(MSG_EXPAND)); BSize size = fDestButton->PreferredSize(); size.width = max_c(size.width, fSourceButton->PreferredSize().width); @@ -103,7 +107,8 @@ .Add(fDestText = new BTextControl(NULL, NULL, new BMessage(MSG_DESTTEXT))) .AddGroup(B_HORIZONTAL, spacing) - .Add(fShowContents = new BCheckBox(TR("Show contents"), + .Add(fShowContents = new BCheckBox( + B_TRANSLATE("Show contents"), new BMessage(MSG_SHOWCONTENTS))) .Add(fStatusView = new BStringView(NULL, NULL)) .End() @@ -144,23 +149,23 @@ BEntry entry(fDestText->Text(), true); BVolume volume; if (!entry.Exists()) { - BAlert* alert = new BAlert("destAlert", - TR("The destination folder does not exist."), - TR("Cancel"), NULL, NULL, + BAlert* alert = new BAlert("destAlert", + B_TRANSLATE("The destination folder does not exist."), + B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); alert->Go(); return false; } else if (!entry.IsDirectory()) { (new BAlert("destAlert", - TR("The destination is not a folder."), - TR("Cancel"), NULL, NULL, + B_TRANSLATE("The destination is not a folder."), + B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT))->Go(); return false; } else if (entry.GetVolume(&volume) != B_OK || volume.IsReadOnly()) { (new BAlert("destAlert", - TR("The destination is read only."), - TR("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, - B_WARNING_ALERT))->Go(); + B_TRANSLATE("The destination is read only."), + B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, + B_EVEN_SPACING, B_WARNING_ALERT))->Go(); return false; } else { entry.GetRef(&fDestRef); @@ -183,7 +188,8 @@ BMessenger messenger(this); fSourcePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &srcRef, B_FILE_NODE, false, NULL, new RuleRefFilter(fRules), true); - (fSourcePanel->Window())->SetTitle(TR("Expander: Open")); + (fSourcePanel->Window())->SetTitle( + B_TRANSLATE("Expander: Open")); } else fSourcePanel->SetPanelDirectory(&srcRef); fSourcePanel->Show(); @@ -191,7 +197,7 @@ } case MSG_DEST: - { + { BEntry entry(fDestText->Text(), true); entry_ref destRef; if (entry.Exists() && entry.IsDirectory()) @@ -201,7 +207,7 @@ fDestPanel = new DirectoryFilePanel(B_OPEN_PANEL, &messenger, &destRef, B_DIRECTORY_NODE, false, NULL, new DirectoryRefFilter(), true); - } else + } else fDestPanel->SetPanelDirectory(&destRef); fDestPanel->Show(); break; @@ -236,8 +242,9 @@ if (fExpandingStarted) { fExpandingThread->SuspendExternalExpander(); BAlert* alert = new BAlert("stopAlert", - TR("Are you sure you want to stop expanding this\narchive? The expanded items may not be complete."), - TR("Stop"), TR("Continue"), NULL, + B_TRANSLATE("Are you sure you want to stop expanding this\n" + "archive? The expanded items may not be complete."), + B_TRANSLATE("Stop"), B_TRANSLATE("Continue"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); if (alert->Go() == 0) { fExpandingThread->ResumeExternalExpander(); @@ -254,7 +261,7 @@ case MSG_SHOWCONTENTS: // change menu item label fShowItem->SetLabel(fShowContents->Value() == B_CONTROL_OFF - ? TR("Show contents") : TR("Hide contents")); + ? B_TRANSLATE("Show contents") : B_TRANSLATE("Hide contents")); if (fShowContents->Value() == B_CONTROL_OFF) { if (fListingStarted) @@ -269,8 +276,9 @@ { BEntry entry(fSourceText->Text(), true); if (!entry.Exists()) { - BAlert* alert = new BAlert("srcAlert", TR("The file doesn't exist"), - TR("Cancel"), NULL, NULL, + BAlert* alert = new BAlert("srcAlert", + B_TRANSLATE("The file doesn't exist"), + B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); alert->Go(); break; @@ -291,8 +299,9 @@ BString string = "The file : "; string += fSourceText->Text(); - string += TR_MARK(" is not supported"); - BAlert* alert = new BAlert("srcAlert", string.String(), TR("Cancel"), + string += B_TRANSLATE_MARK(" is not supported"); + BAlert* alert = new BAlert("srcAlert", string.String(), + B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT); alert->Go(); @@ -333,7 +342,7 @@ // thread has finished (finished, quit, killed, we don't know) // reset window state if (fExpandingStarted) { - fStatusView->SetText(TR("File expanded")); + fStatusView->SetText(B_TRANSLATE("File expanded")); StopExpanding(); OpenDestFolder(); CloseWindowOrKeepOpen(); @@ -348,7 +357,7 @@ case 'exrr': // thread has finished // reset window state - fStatusView->SetText(TR("Error when expanding archive")); + fStatusView->SetText(B_TRANSLATE("Error when expanding archive")); CloseWindowOrKeepOpen(); break; @@ -369,9 +378,10 @@ if (fExpandingStarted) { fExpandingThread->SuspendExternalExpander(); BAlert* alert = new BAlert("stopAlert", - TR("Are you sure you want to stop expanding this\narchive? The expanded items may not be complete."), - TR("Stop"), TR("Continue"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, - B_WARNING_ALERT); + B_TRANSLATE("Are you sure you want to stop expanding this\n" + "archive? The expanded items may not be complete."), + B_TRANSLATE("Stop"), B_TRANSLATE("Continue"), NULL, + B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); if (alert->Go() == 0) { fExpandingThread->ResumeExternalExpander(); StopExpanding(); @@ -463,33 +473,34 @@ ExpanderWindow::_AddMenuBar(BLayout* layout) { fBar = new BMenuBar("menu_bar", B_ITEMS_IN_ROW, B_INVALIDATE_AFTER_LAYOUT); - BMenu* menu = new BMenu(TR("File")); + BMenu* menu = new BMenu(B_TRANSLATE("File")); BMenuItem* item; - menu->AddItem(item = new BMenuItem(TR("About Expander…"), + menu->AddItem(item = new BMenuItem(B_TRANSLATE("About Expander…"), new BMessage(B_ABOUT_REQUESTED))); item->SetTarget(be_app_messenger); menu->AddSeparatorItem(); - menu->AddItem(fSourceItem = new BMenuItem(TR("Set source…"), + menu->AddItem(fSourceItem = new BMenuItem(B_TRANSLATE("Set source…"), new BMessage(MSG_SOURCE), 'O')); - menu->AddItem(fDestItem = new BMenuItem(TR("Set destination…"), + menu->AddItem(fDestItem = new BMenuItem(B_TRANSLATE("Set destination…"), new BMessage(MSG_DEST), 'D')); menu->AddSeparatorItem(); - menu->AddItem(fExpandItem = new BMenuItem(TR("Expand"), + menu->AddItem(fExpandItem = new BMenuItem(B_TRANSLATE("Expand"), new BMessage(MSG_EXPAND), 'E')); fExpandItem->SetEnabled(false); - menu->AddItem(fShowItem = new BMenuItem(TR("Show contents"), + menu->AddItem(fShowItem = new BMenuItem(B_TRANSLATE("Show contents"), new BMessage(MSG_SHOW), 'L')); fShowItem->SetEnabled(false); menu->AddSeparatorItem(); - menu->AddItem(fStopItem = new BMenuItem(TR("Stop"), + menu->AddItem(fStopItem = new BMenuItem(B_TRANSLATE("Stop"), new BMessage(MSG_STOP), 'K')); fStopItem->SetEnabled(false); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem(TR("Close"), new BMessage(B_QUIT_REQUESTED), 'W')); + menu->AddItem(new BMenuItem(B_TRANSLATE("Close"), + new BMessage(B_QUIT_REQUESTED), 'W')); fBar->AddItem(menu); - menu = new BMenu(TR("Settings")); - menu->AddItem(fPreferencesItem = new BMenuItem(TR("Settings…"), + menu = new BMenu(B_TRANSLATE("Settings")); + menu->AddItem(fPreferencesItem = new BMenuItem(B_TRANSLATE("Settings…"), new BMessage(MSG_PREFERENCES), 'S')); fBar->AddItem(menu); layout->AddView(fBar); @@ -509,8 +520,8 @@ BEntry destEntry(fDestText->Text(), true); if (!destEntry.Exists()) { BAlert* alert = new BAlert("destAlert", - TR("The folder was either moved, renamed or not\nsupported."), - TR("Cancel"), NULL, NULL, + B_TRANSLATE("The folder was either moved, renamed or not\nsupported."), + B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); alert->Go(); return; @@ -521,7 +532,7 @@ message.AddRef("srcRef", &fSourceRef); message.AddRef("destRef", &fDestRef); - fExpandButton->SetLabel(TR("Stop")); + fExpandButton->SetLabel(B_TRANSLATE("Stop")); fSourceButton->SetEnabled(false); fDestButton->SetEnabled(false); fShowContents->SetEnabled(false); @@ -534,7 +545,7 @@ BEntry entry(&fSourceRef); BPath path(&entry); - BString text(TR("Expanding file ")); + BString text(B_TRANSLATE("Expanding file ")); text.Append(path.Leaf()); fStatusView->SetText(text.String()); @@ -555,7 +566,7 @@ fExpandingStarted = false; - fExpandButton->SetLabel(TR("Expand")); + fExpandButton->SetLabel(B_TRANSLATE("Expand")); fSourceButton->SetEnabled(true); fDestButton->SetEnabled(true); fShowContents->SetEnabled(true); @@ -579,7 +590,7 @@ if (Frame().right + delta > screenFrame.right) delta = screenFrame.right - Frame().right - 4.0f; - + ResizeBy(delta, 0.0f); } @@ -614,7 +625,7 @@ if (fPreviousHeight < 0.0) { BFont font; font_height fontHeight; - fListingText->GetFont(&font); + fListingText->GetFont(&font); font.GetHeight(&fontHeight); fLineHeight = ceilf(fontHeight.ascent + fontHeight.descent + fontHeight.leading); @@ -622,7 +633,7 @@ } minHeight = bottom + 5.0 * fLineHeight; maxHeight = 32767.0; - + bottom = max_c(fPreviousHeight, minHeight); } else { minHeight = fSizeLimit; @@ -660,7 +671,7 @@ fDestItem->SetEnabled(false); fExpandItem->SetEnabled(false); fShowItem->SetEnabled(true); - fShowItem->SetLabel(TR("Hide contents")); + fShowItem->SetLabel(B_TRANSLATE("Hide contents")); fStopItem->SetEnabled(false); fPreferencesItem->SetEnabled(false); @@ -670,7 +681,7 @@ BEntry entry(&fSourceRef); BPath path(&entry); - BString text(TR("Creating listing for ")); + BString text(B_TRANSLATE("Creating listing for ")); text.Append(path.Leaf()); fStatusView->SetText(text.String()); fListingText->SetText("");