Updated to use B_TRANSLATE* macros. relates to #5408.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36666 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-05-06 16:46:42 +00:00
parent 28ebad8ff6
commit e07f1f2f50
4 changed files with 112 additions and 91 deletions
+8 -6
View File
@@ -77,16 +77,18 @@ DirectoryFilePanel::Show()
}
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 @@ DirectoryFilePanel::SelectionChanged()
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
+4 -4
View File
@@ -31,13 +31,13 @@ ExpanderApp::ExpanderApp()
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;
+41 -33
View File
@@ -31,39 +31,40 @@ ExpanderPreferences::ExpanderPreferences(BMessage *settings)
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 @@ ExpanderPreferences::ExpanderPreferences(BMessage *settings)
.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 @@ ExpanderPreferences::ExpanderPreferences(BMessage *settings)
.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 @@ ExpanderPreferences::ExpanderPreferences(BMessage *settings)
);
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 @@ ExpanderPreferences::MessageReceived(BMessage* msg)
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:
+59 -48
View File
@@ -50,7 +50,8 @@ const uint32 MSG_SHOWCONTENTS = 'mSCT';
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 @@ ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
_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 @@ ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
.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 @@ ExpanderWindow::ValidateDest()
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 @@ ExpanderWindow::MessageReceived(BMessage* msg)
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 @@ ExpanderWindow::MessageReceived(BMessage* msg)
}
case MSG_DEST:
{
{
BEntry entry(fDestText->Text(), true);
entry_ref destRef;
if (entry.Exists() && entry.IsDirectory())
@@ -201,7 +207,7 @@ ExpanderWindow::MessageReceived(BMessage* msg)
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 @@ ExpanderWindow::MessageReceived(BMessage* msg)
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 @@ ExpanderWindow::MessageReceived(BMessage* msg)
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 @@ ExpanderWindow::MessageReceived(BMessage* msg)
{
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 @@ ExpanderWindow::MessageReceived(BMessage* msg)
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 @@ ExpanderWindow::MessageReceived(BMessage* msg)
// 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 @@ ExpanderWindow::MessageReceived(BMessage* msg)
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 @@ ExpanderWindow::CanQuit()
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 @@ void
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 @@ ExpanderWindow::StartExpanding()
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 @@ ExpanderWindow::StartExpanding()
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 @@ ExpanderWindow::StartExpanding()
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 @@ ExpanderWindow::StopExpanding(void)
fExpandingStarted = false;
fExpandButton->SetLabel(TR("Expand"));
fExpandButton->SetLabel(B_TRANSLATE("Expand"));
fSourceButton->SetEnabled(true);
fDestButton->SetEnabled(true);
fShowContents->SetEnabled(true);
@@ -579,7 +590,7 @@ ExpanderWindow::_ExpandListingText()
if (Frame().right + delta > screenFrame.right)
delta = screenFrame.right - Frame().right - 4.0f;
ResizeBy(delta, 0.0f);
}
@@ -614,7 +625,7 @@ ExpanderWindow::_UpdateWindowSize(bool showContents)
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 @@ ExpanderWindow::_UpdateWindowSize(bool showContents)
}
minHeight = bottom + 5.0 * fLineHeight;
maxHeight = 32767.0;
bottom = max_c(fPreviousHeight, minHeight);
} else {
minHeight = fSizeLimit;
@@ -660,7 +671,7 @@ ExpanderWindow::StartListing()
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 @@ ExpanderWindow::StartListing()
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("");