diff --git a/src/apps/packageinstaller/PackageImageViewer.cpp b/src/apps/packageinstaller/PackageImageViewer.cpp index 9bce25d397..77ea313063 100644 --- a/src/apps/packageinstaller/PackageImageViewer.cpp +++ b/src/apps/packageinstaller/PackageImageViewer.cpp @@ -37,7 +37,7 @@ ImageView::ImageView(BPositionIO *image) // Initialize and translate the image BTranslatorRoster *roster = BTranslatorRoster::Default(); BBitmapStream stream; - if (roster->Translate(image, NULL, NULL, &stream, B_TRANSLATOR_BITMAP) + if (roster->Translate(image, NULL, NULL, &stream, B_TRANSLATOR_BITMAP) < B_OK) { fSuccess = false; return; @@ -80,8 +80,8 @@ ImageView::Draw(BRect updateRect) if (fSuccess) DrawBitmapAsync(fImage, Bounds()); else { - float length = StringWidth(TR("Image not loaded correctly")); - DrawString(TR("Image not loaded correctly"), + float length = StringWidth(B_TRANSLATE("Image not loaded correctly")); + DrawString(B_TRANSLATE("Image not loaded correctly"), BPoint((Bounds().Width() - length) / 2.0f, 30.0f)); } } @@ -111,7 +111,7 @@ PackageImageViewer::PackageImageViewer(BPositionIO *image) BScreen screen(this); BRect frame = screen.Frame(); - MoveTo((frame.Width() - Bounds().Width()) / 2.0f, + MoveTo((frame.Width() - Bounds().Width()) / 2.0f, (frame.Height() - Bounds().Height()) / 2.0f); } @@ -148,7 +148,7 @@ PackageImageViewer::Go() break; parent->UpdateIfNeeded(); } - } + } else { // Since there are no spinlocks, wait until the semaphore is free while (acquire_sem(fSemaphore) == B_INTERRUPTED) { diff --git a/src/apps/packageinstaller/PackageInfo.cpp b/src/apps/packageinstaller/PackageInfo.cpp index 479626b1f3..24d232196c 100644 --- a/src/apps/packageinstaller/PackageInfo.cpp +++ b/src/apps/packageinstaller/PackageInfo.cpp @@ -50,7 +50,7 @@ PackageInfo::PackageInfo() : fStatus(B_NO_INIT), fPackageFile(0), - fDescription(TR("No package available.")), + fDescription(B_TRANSLATE("No package available.")), fProfiles(2), fHasImage(false) { @@ -61,7 +61,7 @@ PackageInfo::PackageInfo(const entry_ref *ref) : fStatus(B_NO_INIT), fPackageFile(new BFile(ref, B_READ_ONLY)), - fDescription(TR("No package selected.")), + fDescription(B_TRANSLATE("No package selected.")), fProfiles(2), fHasImage(false) { @@ -999,7 +999,7 @@ PackageInfo::Parse() localType, ctime, mtime, mode, offset, size); } } else if (element == P_SCRIPT) { - fScripts.AddItem(new PackageScript(fPackageFile, offset, size, + fScripts.AddItem(new PackageScript(fPackageFile, offset, size, originalSize)); } else { // If the directory tree count is equal to zero, this means all @@ -1029,7 +1029,7 @@ PackageInfo::Parse() parser_debug("PtcI\n"); break; } else { - fprintf(stderr, TR("Unknown file tag %s\n"), buffer); + fprintf(stderr, B_TRANSLATE("Unknown file tag %s\n"), buffer); RETURN_AND_SET_STATUS(B_ERROR); } } @@ -1038,10 +1038,11 @@ PackageInfo::Parse() // Inform the user of a possible error int32 selection; BAlert *warning = new BAlert("filesize_wrong", - TR("There seems to be a file size mismatch in the package file. " - "The package might be corrupted or have been modified after its " - "creation. Do you still wish to continue?"), TR("Continue"), - TR("Abort"), NULL, + B_TRANSLATE("There seems to be a file size mismatch in the " + "package file. The package might be corrupted or have been " + "modified after its creation. Do you still wish to continue?"), + B_TRANSLATE("Continue"), + B_TRANSLATE("Abort"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); selection = warning->Go(); diff --git a/src/apps/packageinstaller/PackageInstall.cpp b/src/apps/packageinstaller/PackageInstall.cpp index 2be7ae79cc..797b4b2076 100644 --- a/src/apps/packageinstaller/PackageInstall.cpp +++ b/src/apps/packageinstaller/PackageInstall.cpp @@ -57,7 +57,7 @@ PackageInstall::Start() if (fThreadId > -1) { ret = B_BUSY; } else { - fThreadId = spawn_thread(install_function, "install_package", B_NORMAL_PRIORITY, + fThreadId = spawn_thread(install_function, "install_package", B_NORMAL_PRIORITY, static_cast(this)); resume_thread(fThreadId); } @@ -111,7 +111,7 @@ PackageInstall::_Install() PackageStatus *progress = fParent->GetStatusWindow(); progress->Reset(n + m + 5); - progress->StageStep(1, TR("Preparing package")); + progress->StageStep(1, B_TRANSLATE("Preparing package")); InstalledPackageInfo packageInfo(info->GetName(), info->GetVersion()); @@ -119,21 +119,23 @@ PackageInstall::_Install() if (err == B_OK) { // The package is already installed, inform the user BAlert *reinstall = new BAlert("reinstall", - TR("The given package seems to be already installed on your " - "system. Would you like to uninstall the existing one and " - "continue the installation?"), TR("Continue"), TR("Abort")); + B_TRANSLATE("The given package seems to be already installed on " + "your system. Would you like to uninstall the existing one " + "and continue the installation?"), + B_TRANSLATE("Continue"), + B_TRANSLATE("Abort")); if (reinstall->Go() == 0) { // Uninstall the package err = packageInfo.Uninstall(); if (err != B_OK) { - fprintf(stderr, TR("Error on uninstall\n")); + fprintf(stderr, B_TRANSLATE("Error on uninstall\n")); return P_MSG_I_ERROR; } err = packageInfo.SetTo(info->GetName(), info->GetVersion(), true); if (err != B_OK) { - fprintf(stderr, TR("Error on SetTo\n")); + fprintf(stderr, B_TRANSLATE("Error on SetTo\n")); return P_MSG_I_ERROR; } } else { @@ -143,17 +145,17 @@ PackageInstall::_Install() } else if (err == B_ENTRY_NOT_FOUND) { err = packageInfo.SetTo(info->GetName(), info->GetVersion(), true); if (err != B_OK) { - fprintf(stderr, TR("Error on SetTo\n")); + fprintf(stderr, B_TRANSLATE("Error on SetTo\n")); return P_MSG_I_ERROR; } } else if (progress->Stopped()) { return P_MSG_I_ABORT; } else { - fprintf(stderr, TR("returning on error\n")); + fprintf(stderr, B_TRANSLATE("returning on error\n")); return P_MSG_I_ERROR; } - progress->StageStep(1, TR("Installing files and folders")); + progress->StageStep(1, B_TRANSLATE("Installing files and folders")); // Install files and directories PackageItem *iter; @@ -195,7 +197,7 @@ PackageInstall::_Install() } if (err != B_OK) { - fprintf(stderr, TR("Error while writing path\n")); + fprintf(stderr, B_TRANSLATE("Error while writing path\n")); return P_MSG_I_ERROR; } @@ -208,7 +210,8 @@ PackageInstall::_Install() packageInfo.AddItem(state.destination.Path()); } - progress->StageStep(1, TR("Running post-installation scripts"), ""); + progress->StageStep(1, B_TRANSLATE("Running post-installation scripts"), + ""); PackageScript *scr; status_t status; @@ -220,7 +223,7 @@ PackageInstall::_Install() fCurrentScript = scr; if (scr->DoInstall() != B_OK) { - fprintf(stderr, TR("Error while running script\n")); + fprintf(stderr, B_TRANSLATE("Error while running script\n")); return P_MSG_I_ERROR; } fCurrentScriptLocker.Unlock(); @@ -238,13 +241,13 @@ PackageInstall::_Install() progress->StageStep(1, NULL, label.String()); } - progress->StageStep(1, TR("Finishing installation"), ""); + progress->StageStep(1, B_TRANSLATE("Finishing installation"), ""); err = packageInfo.Save(); if (err != B_OK) return P_MSG_I_ERROR; - progress->StageStep(1, TR("Done")); + progress->StageStep(1, B_TRANSLATE("Done")); // Inform our parent that we finished return P_MSG_I_FINISHED; diff --git a/src/apps/packageinstaller/PackageStatus.cpp b/src/apps/packageinstaller/PackageStatus.cpp index c75c40b481..394351bd50 100644 --- a/src/apps/packageinstaller/PackageStatus.cpp +++ b/src/apps/packageinstaller/PackageStatus.cpp @@ -23,7 +23,8 @@ StopButton::StopButton() : - BButton(BRect(0, 0, 22, 18), "stop", TR("Stop"), new BMessage(P_MSG_STOP)) + BButton(BRect(0, 0, 22, 18), "stop", B_TRANSLATE("Stop"), + new BMessage(P_MSG_STOP)) { } @@ -48,7 +49,7 @@ StopButton::Draw(BRect updateRect) // #pragma mark - -/*PackageStatus::PackageStatus(BHandler *parent, const char *title, +/*PackageStatus::PackageStatus(BHandler *parent, const char *title, const char *label, const char *trailing) : BWindow(BRect(200, 200, 550, 275), title, B_TITLED_WINDOW, B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE, 0) @@ -72,7 +73,7 @@ StopButton::Draw(BRect updateRect) font_height fontHeight; fBackground->GetFontHeight(&fontHeight); BRect frame = fStatus->Frame(); - fBackground->ResizeTo(Bounds().Width(), (2 * frame.top) + frame.Height() + + fBackground->ResizeTo(Bounds().Width(), (2 * frame.top) + frame.Height() + fontHeight.leading + fontHeight.ascent + fontHeight.descent); rect = Bounds(); @@ -93,7 +94,7 @@ StopButton::Draw(BRect updateRect) }*/ -PackageStatus::PackageStatus(const char *title, const char *label, +PackageStatus::PackageStatus(const char *title, const char *label, const char *trailing, BHandler *parent) : BWindow(BRect(200, 200, 550, 255), title, B_TITLED_WINDOW, @@ -103,7 +104,7 @@ PackageStatus::PackageStatus(const char *title, const char *label, { SetLayout(new BGroupLayout(B_VERTICAL)); - fStatus = new BStatusBar("status_bar", TR("Installing package")); + fStatus = new BStatusBar("status_bar", B_TRANSLATE("Installing package")); fStatus->SetBarHeight(12); fButton = new StopButton(); @@ -114,9 +115,9 @@ PackageStatus::PackageStatus(const char *title, const char *label, .Add(fStatus) .Add(fButton); fBackground->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - + AddChild(fBackground); - + fButton->SetTarget(this); Run(); } diff --git a/src/apps/packageinstaller/PackageTextViewer.cpp b/src/apps/packageinstaller/PackageTextViewer.cpp index 5e7e545055..25d4c1d3af 100644 --- a/src/apps/packageinstaller/PackageTextViewer.cpp +++ b/src/apps/packageinstaller/PackageTextViewer.cpp @@ -29,8 +29,8 @@ enum { PackageTextViewer::PackageTextViewer(const char *text, bool disclaimer) : - BWindow(BRect(125, 125, 675, 475), TR("Disclaimer"), B_MODAL_WINDOW, - B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE), + BWindow(BRect(125, 125, 675, 475), B_TRANSLATE("Disclaimer"), + B_MODAL_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE), fValue(0) { _InitView(text, disclaimer); @@ -69,7 +69,7 @@ PackageTextViewer::Go() break; parent->UpdateIfNeeded(); } - } + } else { // Since there are no spinlocks, wait until the semaphore is free while (acquire_sem(fSemaphore) == B_INTERRUPTED) { @@ -117,7 +117,7 @@ PackageTextViewer::_InitView(const char *text, bool disclaimer) BRect rect = Bounds(); if (disclaimer) { BButton *button = new BButton(BRect(0, 0, 1, 1), "accept", - TR("Accept"), new BMessage(P_MSG_ACCEPT)); + B_TRANSLATE("Accept"), new BMessage(P_MSG_ACCEPT)); button->ResizeToPreferred(); bounds = button->Bounds(); @@ -129,8 +129,8 @@ PackageTextViewer::_InitView(const char *text, bool disclaimer) button->MakeDefault(true); fBackground->AddChild(button); - button = new BButton(BRect(0, 0, 1, 1), "decline", TR("Decline"), - new BMessage(P_MSG_DECLINE)); + button = new BButton(BRect(0, 0, 1, 1), "decline", + B_TRANSLATE("Decline"), new BMessage(P_MSG_DECLINE)); button->ResizeToPreferred(); bounds = button->Bounds(); @@ -139,7 +139,7 @@ PackageTextViewer::_InitView(const char *text, bool disclaimer) fBackground->AddChild(button); } else { BButton *button = new BButton(BRect(0, 0, 1, 1), "accept", - TR("Continue"), new BMessage(P_MSG_ACCEPT)); + B_TRANSLATE("Continue"), new BMessage(P_MSG_ACCEPT)); button->ResizeToPreferred(); bounds = button->Bounds(); @@ -164,7 +164,7 @@ PackageTextViewer::_InitView(const char *text, bool disclaimer) BScrollView *scroll = new BScrollView("scroll_view", fText, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true); - + fBackground->AddChild(scroll); AddChild(fBackground); @@ -175,8 +175,8 @@ PackageTextViewer::_InitView(const char *text, bool disclaimer) PackageTextViewer::_InitView(const char *text, bool disclaimer) { SetLayout(new BGroupLayout(B_HORIZONTAL)); - - fText = new BTextView(BRect(0, 0, 1, 1), "text_view", BRect(0, 0, 1, 1), + + fText = new BTextView(BRect(0, 0, 1, 1), "text_view", BRect(0, 0, 1, 1), B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT); fText->MakeEditable(false); fText->MakeSelectable(true); @@ -184,10 +184,10 @@ PackageTextViewer::_InitView(const char *text, bool disclaimer) B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true); if (disclaimer) { - BButton *accept = new BButton("accept", TR("Accept"), + BButton *accept = new BButton("accept", B_TRANSLATE("Accept"), new BMessage(P_MSG_ACCEPT)); - BButton *decline = new BButton("decline", TR("Decline"), + BButton *decline = new BButton("decline", B_TRANSLATE("Decline"), new BMessage(P_MSG_DECLINE)); fBackground = BGroupLayoutBuilder(B_VERTICAL) @@ -199,7 +199,7 @@ PackageTextViewer::_InitView(const char *text, bool disclaimer) .End(); } else { - BButton *button = new BButton("accept", TR("Continue"), + BButton *button = new BButton("accept", B_TRANSLATE("Continue"), new BMessage(P_MSG_ACCEPT)); fBackground = BGroupLayoutBuilder(B_VERTICAL) @@ -211,7 +211,7 @@ PackageTextViewer::_InitView(const char *text, bool disclaimer) } AddChild(fBackground); - + fBackground->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fText->SetText(text); }*/ diff --git a/src/apps/packageinstaller/PackageView.cpp b/src/apps/packageinstaller/PackageView.cpp index f900e1923d..1b279171b2 100644 --- a/src/apps/packageinstaller/PackageView.cpp +++ b/src/apps/packageinstaller/PackageView.cpp @@ -46,14 +46,15 @@ static void convert_size(uint64 size, char *buffer, uint32 n) { if (size < 1024) - snprintf(buffer, n, TR("%llu bytes"), size); + snprintf(buffer, n, B_TRANSLATE("%llu bytes"), size); else if (size < 1024 * 1024) - snprintf(buffer, n, TR("%.1f KiB"), size / 1024.0f); + snprintf(buffer, n, B_TRANSLATE("%.1f KiB"), size / 1024.0f); else if (size < 1024 * 1024 * 1024) - snprintf(buffer, n, TR("%.1f MiB"), size / (1024.0f * 1024.0f)); + snprintf(buffer, n, B_TRANSLATE("%.1f MiB"), + size / (1024.0f * 1024.0f)); else { - snprintf(buffer, n, TR("%.1f GiB"), size - / (1024.0f * 1024.0f * 1024.0f)); + snprintf(buffer, n, B_TRANSLATE("%.1f GiB"), + size / (1024.0f * 1024.0f * 1024.0f)); } } @@ -93,10 +94,10 @@ PackageView::AttachedToWindow() status_t ret = fInfo.InitCheck(); if (ret != B_OK && ret != B_NO_INIT) { BAlert *warning = new BAlert("parsing_failed", - TR("The package file is not readable.\nOne of the possible " - "reasons for this might be that the requested file is not a " - "valid BeOS .pkg package."), TR("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_WARNING_ALERT); + B_TRANSLATE("The package file is not readable.\nOne of the " + "possible reasons for this might be that the requested file " + "is not a valid BeOS .pkg package."), B_TRANSLATE("OK"), + NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); warning->Go(); Window()->PostMessage(B_QUIT_REQUESTED); @@ -108,10 +109,10 @@ PackageView::AttachedToWindow() BString title; BString name = fInfo.GetName(); if (name.CountChars() == 0) { - title = TR("Package installer"); + title = B_TRANSLATE("Package installer"); } else { - title = TR("Install "); + title = B_TRANSLATE("Install "); title += name; } parent->SetTitle(title.String()); @@ -126,8 +127,9 @@ PackageView::AttachedToWindow() // attaching the view to the window _GroupChanged(0); - fStatusWindow = new PackageStatus(TR("Installation progress"), NULL, - NULL, this); + fStatusWindow = new PackageStatus + (B_TRANSLATE("Installation progress"), + NULL, NULL, this); // Show the splash screen, if present BMallocIO *image = fInfo.GetSplashScreen(); @@ -190,8 +192,9 @@ PackageView::MessageReceived(BMessage *msg) case P_MSG_I_FINISHED: { BAlert *notify = new BAlert("installation_success", - TR("The package you requested has been successfully installed " - "on your system."), TR("OK")); + B_TRANSLATE("The package you requested has been successfully " + "installed on your system."), + B_TRANSLATE("OK")); notify->Go(); fStatusWindow->Hide(); @@ -208,8 +211,9 @@ PackageView::MessageReceived(BMessage *msg) case P_MSG_I_ABORT: { BAlert *notify = new BAlert("installation_aborted", - TR("The installation of the package has been aborted."), - TR("OK")); + B_TRANSLATE( + "The installation of the package has been aborted."), + B_TRANSLATE("OK")); notify->Go(); fStatusWindow->Hide(); fInstall->SetEnabled(true); @@ -222,11 +226,14 @@ PackageView::MessageReceived(BMessage *msg) { // TODO: Review this BAlert *notify = new BAlert("installation_failed", - TR("The requested package failed to install on your system. " - "This might be a problem with the target package file. Please " - "consult this issue with the package distributor."), - TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - fprintf(stderr, TR("Error while installing the package\n")); + B_TRANSLATE("The requested package failed to install on your " + "system. This might be a problem with the target package " + "file. Please consult this issue with the package " + "distributor."), + B_TRANSLATE("OK"), + NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + fprintf(stderr, + B_TRANSLATE("Error while installing the package\n")); notify->Go(); fStatusWindow->Hide(); fInstall->SetEnabled(true); @@ -313,38 +320,40 @@ PackageView::ItemExists(PackageItem &item, BPath &path, int32 &policy) const char* formatString; switch (item.ItemKind()){ case P_KIND_SCRIPT: - formatString = TR("The script named \'%s\' already exits " - "in the given path.\nReplace the script with the one " - "from this package or skip it?"); + formatString = B_TRANSLATE("The script named \'%s\' " + "already exits in the given path.\nReplace the script " + "with the one from this package or skip it?"); break; case P_KIND_FILE: - formatString = TR("The file named \'%s\' already exits " - "in the given path.\nReplace the file with the one " - "from this package or skip it?"); + formatString = B_TRANSLATE("The file named \'%s\' already " + "exits in the given path.\nReplace the file with the " + "one from this package or skip it?"); break; case P_KIND_DIRECTORY: - formatString = TR("The directory named \'%s\' already " - "exits in the given path.\nReplace the directory with " - "one from this package or skip it?"); + formatString = B_TRANSLATE("The directory named \'%s\' " + "already exits in the given path.\nReplace the " + "directory with one from this package or skip it?"); break; case P_KIND_SYM_LINK: - formatString = TR("The symbolic link named \'%s\' already " - "exists in the give path.\nReplace the link with the " - "one from this package or skip it?"); + formatString = B_TRANSLATE("The symbolic link named \'%s\' " + "already exists in the give path.\nReplace the link " + "with the one from this package or skip it?"); break; default: - formatString = TR("The item named \'%s\' already exits " - "in the given path.\nReplace the item with the one " - "from this package or skip it?"); + formatString = B_TRANSLATE("The item named \'%s\' already " + "exits in the given path.\nReplace the item with the " + "one from this package or skip it?"); break; } char buffer[512]; snprintf(buffer, sizeof(buffer), formatString, path.Leaf()); - + BString alertString = buffer; - + BAlert *alert = new BAlert("file_exists", alertString.String(), - TR("Replace"), TR("Skip"), TR("Abort")); + B_TRANSLATE("Replace"), + B_TRANSLATE("Skip"), + B_TRANSLATE("Abort")); choice = alert->Go(); switch (choice) { @@ -360,14 +369,14 @@ PackageView::ItemExists(PackageItem &item, BPath &path, int32 &policy) if (policy == P_EXISTS_NONE) { // TODO: Maybe add 'No, but ask again' type of choice as well? - alertString = TR("Do you want to remember this decision for " - "the rest of this installation?\n"); + alertString = B_TRANSLATE("Do you want to remember this " + "decision for the rest of this installation?\n"); alertString << ((choice == P_EXISTS_OVERWRITE) - ? TR("All existing files will be replaced?") - : TR("All existing files will be skipped?")); + ? B_TRANSLATE("All existing files will be replaced?") + : B_TRANSLATE("All existing files will be skipped?")); alert = new BAlert("policy_decision", alertString.String(), - TR("Replace all"), TR("Ask again")); + B_TRANSLATE("Replace all"), B_TRANSLATE("Ask again")); int32 decision = alert->Go(); if (decision == 0) @@ -399,7 +408,7 @@ PackageView::_InitView() fInstallTypes = new BPopUpMenu("none"); BMenuField *installType = new BMenuField("install_type", - TR("Installation type:"), fInstallTypes, 0); + B_TRANSLATE("Installation type:"), fInstallTypes, 0); installType->SetAlignment(B_ALIGN_RIGHT); installType->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); @@ -408,10 +417,10 @@ PackageView::_InitView() fInstallDesc->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fInstallDesc->MakeEditable(false); fInstallDesc->MakeSelectable(false); - fInstallDesc->SetText(TR("No installation type selected")); + fInstallDesc->SetText(B_TRANSLATE("No installation type selected")); fInstallDesc->TextHeight(0, fInstallDesc->TextLength()); - fInstall = new BButton("install_button", TR("Install"), + fInstall = new BButton("install_button", B_TRANSLATE("Install"), new BMessage(P_MSG_INSTALL)); BView *installField = BGroupLayoutBuilder(B_VERTICAL, 5.0f) @@ -476,7 +485,8 @@ PackageView::_InitView() fInstallTypes = new BPopUpMenu("none"); BMenuField *installType = new BMenuField(BRect(2, 2, 100, 50), - "install_type", TR("Installation type:"), fInstallTypes, false); + "install_type", B_TRANSLATE("Installation type:"), + fInstallTypes, false); installType->SetDivider(installType->StringWidth(installType->Label()) + 8); installType->SetAlignment(B_ALIGN_RIGHT); installType->ResizeToPreferred(); @@ -490,7 +500,7 @@ PackageView::_InitView() B_WILL_DRAW); fInstallDesc->MakeEditable(false); fInstallDesc->MakeSelectable(false); - fInstallDesc->SetText(TR("No installation type selected")); + fInstallDesc->SetText(B_TRANSLATE("No installation type selected")); fInstallDesc->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fInstallDesc->ResizeTo(rect.Width() - B_V_SCROLL_BAR_WIDTH, 60); @@ -509,7 +519,7 @@ PackageView::_InitView() rect = installBox->Frame(); rect.top = rect.bottom + 5; rect.bottom += 35; - fDestField = new BMenuField(rect, "install_to", TR("Install to:"), + fDestField = new BMenuField(rect, "install_to", B_TRANSLATE("Install to:"), fDestination, false); fDestField->SetDivider(fDestField->StringWidth(fDestField->Label()) + 8); fDestField->SetAlignment(B_ALIGN_RIGHT); @@ -517,7 +527,7 @@ PackageView::_InitView() AddChild(fDestField); - fInstall = new BButton(rect, "install_button", TR("Install"), + fInstall = new BButton(rect, "install_button", B_TRANSLATE("Install"), new BMessage(P_MSG_INSTALL)); fInstall->ResizeToPreferred(); AddChild(fInstall); @@ -600,7 +610,7 @@ PackageView::_GroupChanged(int32 index) BMessage *temp; BVolume volume; char buffer[512]; - const char *tmp = TR("(%s free)"); + const char *tmp = B_TRANSLATE("(%s free)"); if (prof->path_type == P_INSTALL_PATH) { dev_t device; @@ -645,7 +655,7 @@ PackageView::_GroupChanged(int32 index) } fDestination->AddSeparatorItem(); - item = new BMenuItem(TR("Other" B_UTF8_ELLIPSIS), + item = new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS), new BMessage(P_MSG_OPEN_PANEL)); item->SetTarget(this); fDestination->AddItem(item); diff --git a/src/apps/packageinstaller/PackageWindow.cpp b/src/apps/packageinstaller/PackageWindow.cpp index 00af379253..6ddbae3a69 100644 --- a/src/apps/packageinstaller/PackageWindow.cpp +++ b/src/apps/packageinstaller/PackageWindow.cpp @@ -21,7 +21,7 @@ PackageWindow::PackageWindow(const entry_ref *ref) : - BWindow(BRect(100, 100, 600, 300), TR("PackageInstaller"), + BWindow(BRect(100, 100, 600, 300), B_TRANSLATE("PackageInstaller"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) { //SetLayout(new BGroupLayout(B_HORIZONTAL)); @@ -36,7 +36,7 @@ PackageWindow::PackageWindow(const entry_ref *ref) PackageWindow::~PackageWindow() { RemoveChild(fBackground); - + delete fBackground; } diff --git a/src/apps/packageinstaller/main.cpp b/src/apps/packageinstaller/main.cpp index c2f4feb119..3a908858e2 100644 --- a/src/apps/packageinstaller/main.cpp +++ b/src/apps/packageinstaller/main.cpp @@ -28,13 +28,13 @@ class PackageInstaller : public BApplication { public: PackageInstaller(); ~PackageInstaller(); - + void RefsReceived(BMessage *msg); void ArgvReceived(int32 argc, char **argv); void ReadyToRun(); - + void MessageReceived(BMessage *msg); - + void AboutRequested(); private: @@ -92,7 +92,7 @@ PackageInstaller::RefsReceived(BMessage *msg) } -void +void PackageInstaller::ArgvReceived(int32 argc, char **argv) { int i; @@ -100,17 +100,20 @@ PackageInstaller::ArgvReceived(int32 argc, char **argv) entry_ref ref; status_t ret = B_OK; PackageWindow *iter = 0; - + for (i = 1; i < argc; i++) { if (path.SetTo(argv[i]) != B_OK) { - fprintf(stderr, TR("Error! \"%s\" is not a valid path.\n"), argv[i]); + fprintf(stderr, + B_TRANSLATE("Error! \"%s\" is not a valid path.\n"), + argv[i]); continue; } - + ret = get_ref_for_path(path.Path(), &ref); if (ret != B_OK) { - fprintf(stderr, TR("Error (%s)! Could not open \"%s\".\n"), strerror(ret), - argv[i]); + fprintf(stderr, + B_TRANSLATE("Error (%s)! Could not open \"%s\".\n"), + strerror(ret), argv[i]); continue; } @@ -144,11 +147,11 @@ void PackageInstaller::AboutRequested() { BAlert *about = new BAlert("about", - TR("PackageInstaller\n" + B_TRANSLATE("PackageInstaller\n" "BeOS legacy .pkg file installer for Haiku.\n\n" "Copyright 2007,\nŁukasz 'Sil2100' Zemczak\n\n" "Copyright (c) 2007 Haiku, Inc. \n"), - TR("OK")); + B_TRANSLATE("OK")); BTextView *view = about->TextView(); BFont font; @@ -167,7 +170,7 @@ main(void) { PackageInstaller app; app.Run(); - + return 0; }