Updated add-ons/* to use B_TRANSLATE* macros. relates to #5408.

To note, I'm grepping for "TR_CONTEXT" to identify which files to update.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36660 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-05-06 15:55:56 +00:00
parent 9bf722bd79
commit b842a5efaf
3 changed files with 67 additions and 64 deletions
+23 -23
View File
@@ -45,7 +45,7 @@ ZipOMatic::~ZipOMatic()
} }
void void
ZipOMatic::RefsReceived(BMessage* message) ZipOMatic::RefsReceived(BMessage* message)
{ {
entry_ref ref; entry_ref ref;
@@ -66,7 +66,7 @@ ZipOMatic::ReadyToRun()
} }
void void
ZipOMatic::MessageReceived(BMessage* message) ZipOMatic::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
@@ -96,7 +96,7 @@ ZipOMatic::MessageReceived(BMessage* message)
default: default:
BApplication::MessageReceived(message); BApplication::MessageReceived(message);
break; break;
} }
} }
@@ -106,33 +106,33 @@ ZipOMatic::QuitRequested(void)
{ {
if (CountWindows() <= 0) if (CountWindows() <= 0)
return true; return true;
BWindow* window; BWindow* window;
ZippoWindow* zippo; ZippoWindow* zippo;
ZippoWindow* lastFoundZippo = NULL; ZippoWindow* lastFoundZippo = NULL;
int32 zippoCount = 0; int32 zippoCount = 0;
for (int32 i = 0;; i++) { for (int32 i = 0;; i++) {
window = WindowAt(i); window = WindowAt(i);
if (window == NULL) if (window == NULL)
break; break;
zippo = dynamic_cast<ZippoWindow*>(window); zippo = dynamic_cast<ZippoWindow*>(window);
if (zippo == NULL) if (zippo == NULL)
continue; continue;
lastFoundZippo = zippo; lastFoundZippo = zippo;
if (zippo->Lock()) { if (zippo->Lock()) {
if (zippo->IsZipping()) if (zippo->IsZipping())
zippoCount++; zippoCount++;
else else
zippo->PostMessage(B_QUIT_REQUESTED); zippo->PostMessage(B_QUIT_REQUESTED);
zippo->Unlock(); zippo->Unlock();
} }
} }
if (zippoCount == 1) { if (zippoCount == 1) {
// This is likely the most frequent case - a single zipper. // This is likely the most frequent case - a single zipper.
// We post a message to the window so it can put up its own // We post a message to the window so it can put up its own
@@ -153,32 +153,32 @@ ZipOMatic::QuitRequested(void)
// in that zippers are not paused while the BAlert is up. // in that zippers are not paused while the BAlert is up.
BString question; BString question;
question << TR("You have %ld Zip-O-Matic running.\n\n"); question << B_TRANSLATE("You have %ld Zip-O-Matic running.\n\n");
question << TR("Do you want to stop them?"); question << B_TRANSLATE("Do you want to stop them?");
BString temp; BString temp;
temp << zippoCount; temp << zippoCount;
question.ReplaceFirst("%ld", temp.String()); question.ReplaceFirst("%ld", temp.String());
BAlert* alert = new BAlert(NULL, question.String(), BAlert* alert = new BAlert(NULL, question.String(),
TR("Stop them"), TR("Let them continue"), NULL, B_WIDTH_AS_USUAL, B_TRANSLATE("Stop them"), B_TRANSLATE("Let them continue"), NULL,
B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->Go(fInvoker); alert->Go(fInvoker);
alert->Activate(); alert->Activate();
// BAlert, being modal, does not show on the current workspace // BAlert, being modal, does not show on the current workspace
// if the application has no window there. Activate() triggers // if the application has no window there. Activate() triggers
// a switch to a workspace where it does have a window. // a switch to a workspace where it does have a window.
// TODO: See if AS_ACTIVATE_WINDOW should be handled differently // TODO: See if AS_ACTIVATE_WINDOW should be handled differently
// in src/servers/app/Desktop.cpp Desktop::ActivateWindow() // in src/servers/app/Desktop.cpp Desktop::ActivateWindow()
// or if maybe BAlert should (and does not?) activate itself. // or if maybe BAlert should (and does not?) activate itself.
return false; return false;
} }
if (CountWindows() <= 0) if (CountWindows() <= 0)
return true; return true;
return false; return false;
} }
@@ -208,7 +208,7 @@ ZipOMatic::_UseExistingOrCreateNewWindow(BMessage* message)
continue; continue;
list.AddItem(zWindow); list.AddItem(zWindow);
if (zWindow->Lock()) { if (zWindow->Lock()) {
if (!zWindow->IsZipping()) { if (!zWindow->IsZipping()) {
if (message != NULL) if (message != NULL)
@@ -239,16 +239,16 @@ ZipOMatic::_StopZipping()
BWindow* window; BWindow* window;
ZippoWindow* zippo; ZippoWindow* zippo;
BList list; BList list;
for (int32 i = 0;; i++) { for (int32 i = 0;; i++) {
window = WindowAt(i); window = WindowAt(i);
if (window == NULL) if (window == NULL)
break; break;
zippo = dynamic_cast<ZippoWindow*>(window); zippo = dynamic_cast<ZippoWindow*>(window);
if (zippo == NULL) if (zippo == NULL)
continue; continue;
list.AddItem(zippo); list.AddItem(zippo);
} }
@@ -264,6 +264,6 @@ ZipOMatic::_StopZipping()
zippo->PostMessage(B_QUIT_REQUESTED); zippo->PostMessage(B_QUIT_REQUESTED);
zippo->Unlock(); zippo->Unlock();
} }
} }
} }
@@ -55,11 +55,13 @@ ZippoWindow::ZippoWindow(BList windowList, bool keepOpen)
fArchiveNameView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, fArchiveNameView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET)); B_ALIGN_VERTICAL_UNSET));
fZipOutputView = new BStringView("output_text", TR("Drop files to zip.")); fZipOutputView = new BStringView("output_text",
B_TRANSLATE("Drop files to zip."));
fZipOutputView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, fZipOutputView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET)); B_ALIGN_VERTICAL_UNSET));
fStopButton = new BButton("stop", TR("Stop"), new BMessage(B_QUIT_REQUESTED)); fStopButton = new BButton("stop", B_TRANSLATE("Stop"),
new BMessage(B_QUIT_REQUESTED));
fStopButton->SetEnabled(false); fStopButton->SetEnabled(false);
fStopButton->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, fStopButton->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT,
B_ALIGN_VERTICAL_UNSET)); B_ALIGN_VERTICAL_UNSET));
@@ -81,54 +83,54 @@ ZippoWindow::ZippoWindow(BList windowList, bool keepOpen)
} }
ZippoWindow::~ZippoWindow() ZippoWindow::~ZippoWindow()
{ {
delete fWindowInvoker; delete fWindowInvoker;
} }
void void
ZippoWindow::MessageReceived(BMessage* message) ZippoWindow::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case B_REFS_RECEIVED: case B_REFS_RECEIVED:
case B_SIMPLE_DATA: case B_SIMPLE_DATA:
if (IsZipping()) { if (IsZipping()) {
message->what = B_REFS_RECEIVED; message->what = B_REFS_RECEIVED;
be_app_messenger.SendMessage(message); be_app_messenger.SendMessage(message);
} else { } else {
_StartZipping(message); _StartZipping(message);
} }
break; break;
case ZIPPO_THREAD_EXIT: case ZIPPO_THREAD_EXIT:
fThread = NULL; fThread = NULL;
fActivityView->Stop(); fActivityView->Stop();
fStopButton->SetEnabled(false); fStopButton->SetEnabled(false);
fArchiveNameView->SetText(" "); fArchiveNameView->SetText(" ");
if (fZippingWasStopped) if (fZippingWasStopped)
fZipOutputView->SetText(TR("Stopped")); fZipOutputView->SetText(B_TRANSLATE("Stopped"));
else else
fZipOutputView->SetText(TR("Archive created OK")); fZipOutputView->SetText(B_TRANSLATE("Archive created OK"));
_CloseWindowOrKeepOpen(); _CloseWindowOrKeepOpen();
break; break;
case ZIPPO_THREAD_EXIT_ERROR: case ZIPPO_THREAD_EXIT_ERROR:
// TODO: figure out why this case does not happen when it should // TODO: figure out why this case does not happen when it should
fThread = NULL; fThread = NULL;
fActivityView->Stop(); fActivityView->Stop();
fStopButton->SetEnabled(false); fStopButton->SetEnabled(false);
fArchiveNameView->SetText(""); fArchiveNameView->SetText("");
fZipOutputView->SetText(TR("Error creating archive")); fZipOutputView->SetText(B_TRANSLATE("Error creating archive"));
break; break;
case ZIPPO_TASK_DESCRIPTION: case ZIPPO_TASK_DESCRIPTION:
{ {
BString filename; BString filename;
if (message->FindString("archive_filename", &filename) == B_OK) { if (message->FindString("archive_filename", &filename) == B_OK) {
fArchiveName = filename; fArchiveName = filename;
BString temp(TR("Creating archive: %s")); BString temp(B_TRANSLATE("Creating archive: %s"));
temp.ReplaceFirst("%s", filename.String()); temp.ReplaceFirst("%s", filename.String());
fArchiveNameView->SetText(temp.String()); fArchiveNameView->SetText(temp.String());
} }
@@ -145,7 +147,7 @@ ZippoWindow::MessageReceived(BMessage* message)
// behavior as the window resizes for each line of output. // behavior as the window resizes for each line of output.
// Instead of showing the true output of /bin/zip // Instead of showing the true output of /bin/zip
// we display a file count and whether the archive is // we display a file count and whether the archive is
// being created (added to) or if we're updating an // being created (added to) or if we're updating an
// already existing archive. // already existing archive.
BString output; BString output;
@@ -154,9 +156,9 @@ ZippoWindow::MessageReceived(BMessage* message)
count << fFileCount; count << fFileCount;
if (fFileCount == 1) { if (fFileCount == 1) {
output << TR("1 file added."); output << B_TRANSLATE("1 file added.");
} else { } else {
output << TR("%ld files added."); output << B_TRANSLATE("%ld files added.");
output.ReplaceFirst("%ld", count.String()); output.ReplaceFirst("%ld", count.String());
} }
@@ -177,13 +179,13 @@ ZippoWindow::MessageReceived(BMessage* message)
} else { } else {
if (fThread != NULL) if (fThread != NULL)
fThread->ResumeExternalZip(); fThread->ResumeExternalZip();
fActivityView->Start(); fActivityView->Start();
} }
} }
break; break;
} }
default: default:
BWindow::MessageReceived(message); BWindow::MessageReceived(message);
break; break;
@@ -204,14 +206,15 @@ ZippoWindow::QuitRequested()
fActivityView->Pause(); fActivityView->Pause();
BString message; BString message;
message << TR("Are you sure you want to stop creating this archive?"); message << B_TRANSLATE("Are you sure you want to stop creating this "
"archive?");
message << "\n\n"; message << "\n\n";
message << TR("Filename: %s"); message << B_TRANSLATE("Filename: %s");
message << "\n"; message << "\n";
message.ReplaceFirst("%s", fArchiveName.String()); message.ReplaceFirst("%s", fArchiveName.String());
BAlert* alert = new BAlert(NULL, message.String(), TR("Stop"), BAlert* alert = new BAlert(NULL, message.String(), B_TRANSLATE("Stop"),
TR("Continue"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_TRANSLATE("Continue"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->Go(fWindowInvoker); alert->Go(fWindowInvoker);
return false; return false;
@@ -228,7 +231,7 @@ ZippoWindow::_StartZipping(BMessage* message)
fThread = new ZipperThread(message, this); fThread = new ZipperThread(message, this);
fThread->Start(); fThread->Start();
fZippingWasStopped = false; fZippingWasStopped = false;
} }
@@ -243,13 +246,13 @@ ZippoWindow::StopZipping()
fThread->InterruptExternalZip(); fThread->InterruptExternalZip();
fThread->Quit(); fThread->Quit();
status_t status = B_OK; status_t status = B_OK;
fThread->WaitForThread(&status); fThread->WaitForThread(&status);
fThread = NULL; fThread = NULL;
fArchiveNameView->SetText(" "); fArchiveNameView->SetText(" ");
fZipOutputView->SetText(TR("Stopped")); fZipOutputView->SetText(B_TRANSLATE("Stopped"));
_CloseWindowOrKeepOpen(); _CloseWindowOrKeepOpen();
} }
@@ -308,7 +311,7 @@ ZippoWindow::_FindBestPlacement()
tryRect = centeredRect; tryRect = centeredRect;
while (true) { while (true) {
_OffsetRect(&tryRect, primaryDirection); _OffsetRect(&tryRect, primaryDirection);
if (!screen.Frame().Contains(tryRect)) if (!screen.Frame().Contains(tryRect))
_OffscreenBounceBack(&tryRect, &primaryDirection, right); _OffscreenBounceBack(&tryRect, &primaryDirection, right);
@@ -327,7 +330,7 @@ ZippoWindow::_FindBestPlacement()
ZippoWindow* window = dynamic_cast<ZippoWindow*>(win); ZippoWindow* window = dynamic_cast<ZippoWindow*>(win);
if (window == NULL) if (window == NULL)
continue; continue;
if (window == this) if (window == this)
continue; continue;
@@ -351,7 +354,7 @@ ZippoWindow::_FindBestPlacement()
// find nearest rect // find nearest rect
bool gotRect = false; bool gotRect = false;
BRect nearestRect(0, 0, 0, 0); BRect nearestRect(0, 0, 0, 0);
while (true) { while (true) {
BRect* rect = static_cast<BRect*>(tryRectList.RemoveItem((int32)0)); BRect* rect = static_cast<BRect*>(tryRectList.RemoveItem((int32)0));
if (rect == NULL) if (rect == NULL)
+12 -12
View File
@@ -44,7 +44,7 @@ ZipperThread::ZipperThread(BMessage* refsMessage, BWindow* window)
} }
ZipperThread::~ZipperThread() ZipperThread::~ZipperThread()
{ {
} }
@@ -112,7 +112,7 @@ ZipperThread::ThreadStartup()
BString archiveName; BString archiveName;
if (refCount > 1) if (refCount > 1)
archiveName = TR("Archive"); archiveName = B_TRANSLATE("Archive");
else else
archiveName = lastRef.name; archiveName = lastRef.name;
@@ -154,7 +154,7 @@ ZipperThread::ThreadStartup()
argv[argc] = NULL; argv[argc] = NULL;
fZipProcess = _PipeCommand(argc, argv, fStdIn, fStdOut, fStdErr); fZipProcess = _PipeCommand(argc, argv, fStdIn, fStdOut, fStdErr);
delete [] argv; delete [] argv;
@@ -170,7 +170,7 @@ ZipperThread::ThreadStartup()
_SendMessageToWindow(ZIPPO_TASK_DESCRIPTION, "archive_filename", _SendMessageToWindow(ZIPPO_TASK_DESCRIPTION, "archive_filename",
archiveName.String()); archiveName.String());
_SendMessageToWindow(ZIPPO_LINE_OF_STDOUT, "zip_output", _SendMessageToWindow(ZIPPO_LINE_OF_STDOUT, "zip_output",
TR("Preparing to archive")); B_TRANSLATE("Preparing to archive"));
return B_OK; return B_OK;
} }
@@ -206,8 +206,8 @@ ZipperThread::ExecuteUnit()
status_t status_t
ZipperThread::ThreadShutdown() ZipperThread::ThreadShutdown()
{ {
close(fStdIn); close(fStdIn);
close(fStdOut); close(fStdOut);
close(fStdErr); close(fStdErr);
// _SelectInTracker(); // _SelectInTracker();
@@ -250,8 +250,8 @@ void
ZipperThread::_MakeShellSafe(BString* string) ZipperThread::_MakeShellSafe(BString* string)
{ {
string->CharacterEscape("\"$`", '\\'); string->CharacterEscape("\"$`", '\\');
string->Prepend("\""); string->Prepend("\"");
string->Append("\""); string->Append("\"");
} }
@@ -294,9 +294,9 @@ ZipperThread::_PipeCommand(int argc, const char** argv, int& in, int& out,
close(errPipe[1]); close(errPipe[1]);
if (errno == 0) { if (errno == 0) {
in = inPipe[1]; // Write to in, appears on cmd's stdin in = inPipe[1]; // Write to in, appears on cmd's stdin
out = outPipe[0]; // Read from out, taken from cmd's stdout out = outPipe[0]; // Read from out, taken from cmd's stdout
err = errPipe[0]; // Read from err, taken from cmd's stderr err = errPipe[0]; // Read from err, taken from cmd's stderr
// execute command // execute command
thread = load_image(argc, argv, envp); thread = load_image(argc, argv, envp);
@@ -419,7 +419,7 @@ ZipperThread::_SelectInTracker(int32 tryNumber)
BMessenger trackerMessenger("application/x-vnd.Be-TRAK"); BMessenger trackerMessenger("application/x-vnd.Be-TRAK");
if (!trackerMessenger.IsValid()) if (!trackerMessenger.IsValid())
return B_ERROR; return B_ERROR;
BMessage request; BMessage request;
BMessage reply; BMessage reply;
status_t status; status_t status;