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