Ticket #5889: tracker.patch

File tracker.patch, 181.9 KB (added by mt, 9 years ago)
  • VolumeWindow.cpp

     
    3232All rights reserved.
    3333*/
    3434
     35#include <Catalog.h>
    3536#include <Debug.h>
     37#include <Locale.h>
    3638#include <Menu.h>
    3739#include <MenuBar.h>
    3840#include <MenuItem.h>
     
    4749#include "MountMenu.h"
    4850
    4951
     52
     53#undef B_TRANSLATE_CONTEXT
     54#define B_TRANSLATE_CONTEXT "libTracker"
     55
    5056BVolumeWindow::BVolumeWindow(LockingList<BWindow> *windowList, uint32 openFlags)
    5157    :   BContainerWindow(windowList, openFlags)
    5258{
     
    7985        }
    8086    }
    8187
    82     BMenuItem *item = fMenuBar->FindItem("Unmount");
     88    BMenuItem* item = fMenuBar->FindItem(
     89        B_TRANSLATE("Unmount"));
    8390    if (item)
    8491        item->SetEnabled(ejectableVolumeSelected);
    8592}
     
    8895void
    8996BVolumeWindow::AddFileMenu(BMenu *menu)
    9097{
    91     menu->AddItem(new BMenuItem("Find"B_UTF8_ELLIPSIS,
     98    menu->AddItem(new BMenuItem(
     99        B_TRANSLATE("Find"B_UTF8_ELLIPSIS),
    92100        new BMessage(kFindButton), 'F'));
    93101    menu->AddSeparatorItem();
    94102
    95     menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
    96     menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
    97     menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
     103    menu->AddItem(new BMenuItem(
     104        B_TRANSLATE("Open"),
     105        new BMessage(kOpenSelection), 'O'));
     106    menu->AddItem(new BMenuItem(
     107        B_TRANSLATE("Get info"),
     108        new BMessage(kGetInfo), 'I'));
     109    menu->AddItem(new BMenuItem(
     110        B_TRANSLATE("Edit name"),
     111        new BMessage(kEditItem), 'E'));
    98112
    99     BMenuItem *item = new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U');
     113    BMenuItem* item = new BMenuItem(
     114        B_TRANSLATE("Unmount"),
     115        new BMessage(kUnmountVolume), 'U');
    100116    item->SetEnabled(false);
    101117    menu->AddItem(item);
    102118
    103     menu->AddItem(new BMenuItem("Mount settings" B_UTF8_ELLIPSIS,
     119    menu->AddItem(new BMenuItem(
     120        B_TRANSLATE("Mount settings" B_UTF8_ELLIPSIS),
    104121        new BMessage(kRunAutomounterSettings)));
    105122
    106123    menu->AddSeparatorItem();
    107     menu->AddItem(new BMenu(kAddOnsMenuName));
     124    menu->AddItem(new BMenu(
     125        B_TRANSLATE("Add-ons")));
    108126    menu->SetTargetForItems(PoseView());
    109127}
    110128
     
    118136        return;
    119137    }
    120138
    121     menu->AddItem(new BMenuItem("Icon view", new BMessage(kIconMode)));
    122     menu->AddItem(new BMenuItem("Mini icon view", new BMessage(kMiniIconMode)));
    123     menu->AddItem(new BMenuItem("List view", new BMessage(kListMode)));
     139    menu->AddItem(new BMenuItem(
     140        B_TRANSLATE("Icon view"),
     141        new BMessage(kIconMode)));
     142    menu->AddItem(new BMenuItem(
     143        B_TRANSLATE("Mini icon view"),
     144        new BMessage(kMiniIconMode)));
     145    menu->AddItem(new BMenuItem(
     146        B_TRANSLATE("List view"),
     147        new BMessage(kListMode)));
    124148    menu->AddSeparatorItem();
    125149
    126     BMenuItem *resizeItem = new BMenuItem("Resize to fit",new BMessage(kResizeToFit), 'Y');
     150    BMenuItem* resizeItem = new BMenuItem(
     151        B_TRANSLATE("Resize to fit"),
     152        new BMessage(kResizeToFit), 'Y');
    127153    menu->AddItem(resizeItem);
    128     menu->AddItem(new BMenuItem("Clean up", new BMessage(kCleanup), 'K'));
    129     menu->AddItem(new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
    130     menu->AddItem(new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
    131     menu->AddItem(new BMenuItem("Invert selection", new BMessage(kInvertSelection), 'S'));
     154    menu->AddItem(new BMenuItem(
     155        B_TRANSLATE("Clean up"),
     156        new BMessage(kCleanup), 'K'));
     157    menu->AddItem(new BMenuItem(
     158        B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
     159        new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
     160    menu->AddItem(new BMenuItem(
     161        B_TRANSLATE("Select all"),
     162        new BMessage(B_SELECT_ALL), 'A'));
     163    menu->AddItem(new BMenuItem(
     164        B_TRANSLATE("Invert selection"),
     165        new BMessage(kInvertSelection), 'S'));
    132166
    133     BMenuItem *closeItem = new BMenuItem("Close",new BMessage(B_QUIT_REQUESTED), 'W');
     167    BMenuItem* closeItem = new BMenuItem(
     168        B_TRANSLATE("Close"),
     169        new BMessage(B_QUIT_REQUESTED), 'W');
    134170    menu->AddItem(closeItem);
    135171    menu->AddSeparatorItem();
    136172
    137     menu->AddItem(new MountMenu("Mount"));
     173    menu->AddItem(new MountMenu(
     174        B_TRANSLATE("Mount")));
    138175    menu->AddSeparatorItem();
    139176
    140     menu->AddItem(new BMenu(kAddOnsMenuName));
     177    menu->AddItem(new BMenu(
     178        B_TRANSLATE("Add-ons")));
    141179
    142180    // target items as needed
    143181    menu->SetTargetForItems(PoseView());
  • SettingsViews.cpp

     
    4343
    4444#include <Box.h>
    4545#include <Button.h>
     46#include <Catalog.h>
     47#include <Locale.h>
    4648#include <MenuField.h>
    4749#include <ColorControl.h>
    4850#include <NodeMonitor.h>
     
    7880//  #pragma mark -
    7981
    8082
     83#undef B_TRANSLATE_CONTEXT
     84#define B_TRANSLATE_CONTEXT "libTracker"
     85
    8186SettingsView::SettingsView(BRect rect, const char *name)
    8287    : BView(rect, name, B_FOLLOW_ALL, 0)
    8388{
     
    164169    : SettingsView(rect, "DesktopSettingsView")
    165170{
    166171    rect.OffsetTo(B_ORIGIN);
    167     fShowDisksIconRadioButton = new BRadioButton(rect, "", "Show Disks icon",
     172    fShowDisksIconRadioButton = new BRadioButton(rect, "",
     173        B_TRANSLATE("Show Disks icon"),
    168174        new BMessage(kShowDisksIconChanged));
    169175    fShowDisksIconRadioButton->ResizeToPreferred();
    170176    AddChild(fShowDisksIconRadioButton);
     
    173179    rect.OffsetBy(0, itemSpacing);
    174180
    175181    fMountVolumesOntoDesktopRadioButton = new BRadioButton(rect, "",
    176         "Show volumes on Desktop", new BMessage(kVolumesOnDesktopChanged));
     182        B_TRANSLATE("Show volumes on Desktop"),
     183        new BMessage(kVolumesOnDesktopChanged));
    177184    AddChild(fMountVolumesOntoDesktopRadioButton);
    178185    fMountVolumesOntoDesktopRadioButton->ResizeToPreferred();
    179186
    180187    rect.OffsetBy(20, itemSpacing);
    181188
    182189    fMountSharedVolumesOntoDesktopCheckBox = new BCheckBox(rect, "",
    183         "Show shared volumes on Desktop", new BMessage(kVolumesOnDesktopChanged));
     190        B_TRANSLATE("Show shared volumes on Desktop"),
     191        new BMessage(kVolumesOnDesktopChanged));
    184192    AddChild(fMountSharedVolumesOntoDesktopCheckBox);
    185193    fMountSharedVolumesOntoDesktopCheckBox->ResizeToPreferred();
    186194
     
    188196
    189197    rect = Bounds();
    190198    rect.top = rect.bottom;
    191     fMountButton = new BButton(rect, "", "Mount settings" B_UTF8_ELLIPSIS,
     199    fMountButton = new BButton(rect, "",
     200        B_TRANSLATE("Mount settings" B_UTF8_ELLIPSIS),
    192201        new BMessage(kRunAutomounterSettings), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
    193202    fMountButton->ResizeToPreferred();
    194203    fMountButton->MoveBy(0, -fMountButton->Bounds().Height());
     
    409418    : SettingsView(rect, "WindowsSettingsView")
    410419{
    411420    rect.OffsetTo(B_ORIGIN);
    412     fShowFullPathInTitleBarCheckBox = new BCheckBox(rect, "", "Show folder location in title tab",
     421    fShowFullPathInTitleBarCheckBox = new BCheckBox(rect, "",
     422        B_TRANSLATE("Show folder location in title tab"),
    413423        new BMessage(kWindowsShowFullPathChanged));
    414424    fShowFullPathInTitleBarCheckBox->ResizeToPreferred();
    415425    AddChild(fShowFullPathInTitleBarCheckBox);
     
    417427    const float itemSpacing = fShowFullPathInTitleBarCheckBox->Bounds().Height() + kItemExtraSpacing;
    418428    rect.OffsetBy(0, itemSpacing);
    419429
    420     fSingleWindowBrowseCheckBox = new BCheckBox(rect, "", "Single window navigation",
     430    fSingleWindowBrowseCheckBox = new BCheckBox(rect, "",
     431        B_TRANSLATE("Single window navigation"),
    421432        new BMessage(kSingleWindowBrowseChanged));
    422433    fSingleWindowBrowseCheckBox->ResizeToPreferred();
    423434    AddChild(fSingleWindowBrowseCheckBox);
    424435
    425436    rect.OffsetBy(20, itemSpacing);
    426437
    427     fShowNavigatorCheckBox = new BCheckBox(rect, "", "Show navigator",
     438    fShowNavigatorCheckBox = new BCheckBox(rect, "",
     439        B_TRANSLATE("Show navigator"),
    428440        new BMessage(kShowNavigatorChanged));
    429441    fShowNavigatorCheckBox->ResizeToPreferred();
    430442    AddChild(fShowNavigatorCheckBox);
    431443
    432444    rect.OffsetBy(-20, itemSpacing);
    433445
    434     fOutlineSelectionCheckBox = new BCheckBox(rect, "", "Outline selection rectangle only",
     446    fOutlineSelectionCheckBox = new BCheckBox(rect, "",
     447        B_TRANSLATE("Outline selection rectangle only"),
    435448        new BMessage(kTransparentSelectionChanged));
    436449    fOutlineSelectionCheckBox->ResizeToPreferred();
    437450    AddChild(fOutlineSelectionCheckBox);
    438451
    439452    rect.OffsetBy(0, itemSpacing);
    440453
    441     fSortFolderNamesFirstCheckBox = new BCheckBox(rect, "", "List folders first",
     454    fSortFolderNamesFirstCheckBox = new BCheckBox(rect, "",
     455        B_TRANSLATE("List folders first"),
    442456        new BMessage(kSortFolderNamesFirstChanged));
    443457    fSortFolderNamesFirstCheckBox->ResizeToPreferred();
    444458    AddChild(fSortFolderNamesFirstCheckBox);
    445459
    446460    rect.OffsetBy(0, itemSpacing);
    447461
    448     fTypeAheadFilteringCheckBox = new BCheckBox(rect, "", "Enable type-ahead filtering",
     462    fTypeAheadFilteringCheckBox = new BCheckBox(rect, "",
     463        B_TRANSLATE("Enable type-ahead filtering"),
    449464        new BMessage(kTypeAheadFilteringChanged));
    450465    fTypeAheadFilteringCheckBox->ResizeToPreferred();
    451466    AddChild(fTypeAheadFilteringCheckBox);
     
    714729
    715730    rect.bottom = ceilf(fontHeight.ascent + fontHeight.descent) + 10;
    716731    BBox *clockBox = new BBox(rect, "Clock");
    717     clockBox->SetLabel("Clock");
     732    clockBox->SetLabel(B_TRANSLATE("Clock"));
    718733    AddChild(clockBox);
    719734
    720735    rect.left = 8;
    721736    rect.top = rect.bottom - 8;
    722     f24HrRadioButton = new BRadioButton(rect, "", "24 hour",
     737    f24HrRadioButton = new BRadioButton(rect, "",
     738        B_TRANSLATE("24 hour"),
    723739        new BMessage(kSettingsContentsModified));
    724740    f24HrRadioButton->ResizeToPreferred();
    725741    clockBox->AddChild(f24HrRadioButton);
     
    727743    const float itemSpacing = f24HrRadioButton->Bounds().Height() + kItemExtraSpacing;
    728744    rect.OffsetBy(0, itemSpacing);
    729745
    730     f12HrRadioButton = new BRadioButton(rect, "", "12 hour",
     746    f12HrRadioButton = new BRadioButton(rect, "",
     747        B_TRANSLATE("12 hour"),
    731748        new BMessage(kSettingsContentsModified));
    732749    f12HrRadioButton->ResizeToPreferred();
    733750    clockBox->AddChild(f12HrRadioButton);
     
    739756    rect = clockBox->Frame();
    740757    rect.OffsetBy(rect.Width() + 8, 0);
    741758    BBox *dateFormatBox = new BBox(rect, "Date order");
    742     dateFormatBox->SetLabel("Date order");
     759    dateFormatBox->SetLabel(B_TRANSLATE("Date order"));
    743760    AddChild(dateFormatBox);
    744761
    745762    rect = f24HrRadioButton->Frame();
    746     fYMDRadioButton = new BRadioButton(rect, "", "Year-month-day",
     763    fYMDRadioButton = new BRadioButton(rect, "",
     764        B_TRANSLATE("Year-month-day"),
    747765        new BMessage(kSettingsContentsModified));
    748766    fYMDRadioButton->ResizeToPreferred();
    749767    dateFormatBox->AddChild(fYMDRadioButton);
    750768
    751769    rect.OffsetBy(0, itemSpacing);
    752770
    753     fDMYRadioButton = new BRadioButton(rect, "", "Day-month-year",
     771    fDMYRadioButton = new BRadioButton(rect, "",
     772        B_TRANSLATE("Day-month-year"),
    754773        new BMessage(kSettingsContentsModified));
    755774    fDMYRadioButton->ResizeToPreferred();
    756775    dateFormatBox->AddChild(fDMYRadioButton);
    757776
    758777    rect.OffsetBy(0, itemSpacing);
    759778
    760     fMDYRadioButton = new BRadioButton(rect, "", "Month-day-year",
     779    fMDYRadioButton = new BRadioButton(rect, "",
     780        B_TRANSLATE("Month-day-year"),
    761781        new BMessage(kSettingsContentsModified));
    762782    fMDYRadioButton->ResizeToPreferred();
    763783    dateFormatBox->AddChild(fMDYRadioButton);
     
    766786        dateFormatBox->Bounds().Height());
    767787
    768788    BPopUpMenu *menu = new BPopUpMenu("Separator");
    769     menu->AddItem(new BMenuItem("None", new BMessage(kSettingsContentsModified)));
    770     menu->AddItem(new BMenuItem("Space", new BMessage(kSettingsContentsModified)));
     789    menu->AddItem(new BMenuItem(B_TRANSLATE("None"),
     790        new BMessage(kSettingsContentsModified)));
     791    menu->AddItem(new BMenuItem(B_TRANSLATE("Space"),
     792        new BMessage(kSettingsContentsModified)));
    771793    menu->AddItem(new BMenuItem("-", new BMessage(kSettingsContentsModified)));
    772794    menu->AddItem(new BMenuItem("/", new BMessage(kSettingsContentsModified)));
    773795    menu->AddItem(new BMenuItem("\\", new BMessage(kSettingsContentsModified)));
     
    785807
    786808    rect.OffsetBy(0, itemSpacing + 10);
    787809
    788     BStringView *exampleView = new BStringView(rect, "", "Examples:");
     810    BStringView* exampleView = new BStringView(rect, "", B_TRANSLATE("Examples:"));
    789811    exampleView->ResizeToPreferred();
    790812    AddChild(exampleView);
    791813
     
    10521074    : SettingsView(rect, "SpaceBarSettingsView")
    10531075{
    10541076    rect.OffsetTo(B_ORIGIN);
    1055     fSpaceBarShowCheckBox = new BCheckBox(rect, "", "Show space bars on volumes",
     1077    fSpaceBarShowCheckBox = new BCheckBox(rect, "",
     1078        B_TRANSLATE("Show space bars on volumes"),
    10561079        new BMessage(kUpdateVolumeSpaceBar));
    10571080    fSpaceBarShowCheckBox->ResizeToPreferred();
    10581081    AddChild(fSpaceBarShowCheckBox);
     
    10641087    menu->SetFont(be_plain_font);
    10651088
    10661089    BMenuItem *item;
    1067     menu->AddItem(item = new BMenuItem("Used space color", new BMessage(kSpaceBarSwitchColor)));
     1090    menu->AddItem(item = new BMenuItem(
     1091        B_TRANSLATE("Used space color"),
     1092        new BMessage(kSpaceBarSwitchColor)));
    10681093    item->SetMarked(true);
    10691094    fCurrentColor = 0;
    1070     menu->AddItem(new BMenuItem("Free space color", new BMessage(kSpaceBarSwitchColor)));
    1071     menu->AddItem(new BMenuItem("Warning space color", new BMessage(kSpaceBarSwitchColor)));
     1095    menu->AddItem(new BMenuItem(
     1096        B_TRANSLATE("Free space color"),
     1097        new BMessage(kSpaceBarSwitchColor)));
     1098    menu->AddItem(new BMenuItem(
     1099        B_TRANSLATE("Warning space color"),
     1100        new BMessage(kSpaceBarSwitchColor)));
    10721101
    10731102    BBox *box = new BBox(rect);
    10741103    box->SetLabel(fColorPicker = new BMenuField(rect, NULL, NULL, menu));
     
    13021331    : SettingsView(rect, "TrashSettingsView")
    13031332{
    13041333    rect.OffsetTo(B_ORIGIN);
    1305     fDontMoveFilesToTrashCheckBox = new BCheckBox(rect, "", "Don't move files to Trash",
     1334    fDontMoveFilesToTrashCheckBox = new BCheckBox(rect, "",
     1335        B_TRANSLATE("Don't move files to Trash"),
    13061336            new BMessage(kDontMoveFilesToTrashChanged));
    13071337    fDontMoveFilesToTrashCheckBox->ResizeToPreferred();
    13081338    AddChild(fDontMoveFilesToTrashCheckBox);
     
    13101340    rect = fDontMoveFilesToTrashCheckBox->Frame();
    13111341    rect.OffsetBy(0, fDontMoveFilesToTrashCheckBox->Bounds().Height() + kItemExtraSpacing);
    13121342
    1313     fAskBeforeDeleteFileCheckBox = new BCheckBox(rect, "", "Ask before delete",
     1343    fAskBeforeDeleteFileCheckBox = new BCheckBox(rect, "",
     1344        B_TRANSLATE("Ask before delete"),
    13141345            new BMessage(kAskBeforeDeleteFileChanged));
    13151346    fAskBeforeDeleteFileCheckBox->ResizeToPreferred();
    13161347    AddChild(fAskBeforeDeleteFileCheckBox);
  • InfoWindow.cpp

     
    4040#include <stdlib.h>
    4141
    4242#include <Alert.h>
     43#include <Catalog.h>
    4344#include <Debug.h>
    4445#include <Directory.h>
    4546#include <File.h>
    4647#include <Font.h>
     48#include <Locale.h>
    4749#include <MenuField.h>
    4850#include <Mime.h>
    4951#include <NodeInfo.h>
     
    7375#include "WidgetAttributeText.h"
    7476
    7577
     78#undef B_TRANSLATE_CONTEXT
     79#define B_TRANSLATE_CONTEXT "libTracker"
     80
     81
    7682namespace BPrivate {
    7783
    7884// States for tracking the mouse
     
    214220const uint32 kPaneSwitchOpen = 2;
    215221
    216222
    217 static BString &
    218 PrintFloat(BString &result, float number)
    219 {
    220     char buffer[128];
    221     sprintf(buffer, "%.1f", number);
    222     result += buffer;
    223     return result;
    224 }
    225 
    226 
    227223static void
    228224OpenParentAndSelectOriginal(const entry_ref *ref)
    229225{
     
    389385    if (!TargetModel()->IsVolume() && !TargetModel()->IsRoot()) {
    390386        if (TargetModel()->IsDirectory()) {
    391387            // if this is a folder then spawn thread to calculate size
    392             SetSizeStr("calculating" B_UTF8_ELLIPSIS);
     388            SetSizeStr(
     389                B_TRANSLATE("calculating" B_UTF8_ELLIPSIS));
    393390            fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize",
    394391                B_NORMAL_PRIORITY, this);
    395392            resume_thread(fCalcThreadID);
     
    402399        }
    403400    }
    404401
    405     BString buffer;
    406     buffer << TargetModel()->Name() << " info";
     402    BString buffer(B_TRANSLATE_COMMENT("%name info", "InfoWindow Title"));
     403    buffer.ReplaceFirst("%name", TargetModel()->Name());
    407404    SetTitle(buffer.String());
    408405
    409406    lock.Unlock();
     
    461458
    462459            // Start recalculating..
    463460            fStopCalc = false;
    464             SetSizeStr("calculating" B_UTF8_ELLIPSIS);
     461            SetSizeStr(
     462                B_TRANSLATE("calculating" B_UTF8_ELLIPSIS));
    465463            fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize",
    466464                B_NORMAL_PRIORITY, this);
    467465            resume_thread(fCalcThreadID);
     
    652650void
    653651BInfoWindow::GetSizeString(BString &result, off_t size, int32 fileCount)
    654652{
    655     char numStr[256];
    656     sprintf(numStr, "%Ld", size);
    657     BString bytes;
     653    char sizeString[256];
    658654
    659     uint32 length = strlen(numStr);
    660     if (length >= 4) {
    661         uint32 charsTillComma = length % 3;
    662         if (charsTillComma == 0)
    663             charsTillComma = 3;
     655    if (fileCount) {
     656        if (size >= kGBSize) {
     657            result.SetTo(B_TRANSLATE("%size GiB (%bytes bytes) for %num files"));
     658            sprintf(sizeString, "%.1f", (float)size / kGBSize);
     659            result.ReplaceFirst("%size", sizeString);
     660        } else if (size >= kMBSize) {
     661            result.SetTo(B_TRANSLATE("%size MiB (%bytes bytes) for %num files"));
     662            sprintf(sizeString, "%.1f", (float)size / kMBSize);
     663            result.ReplaceFirst("%size", sizeString);
     664        } else if (size >= kKBSize) {
     665            result.SetTo(B_TRANSLATE("%size KiB (%bytes bytes) for %num files"));
     666            sprintf(sizeString, "%lld", (int64)(size + kHalfKBSize) / kKBSize);
     667            result.ReplaceFirst("%size", sizeString);
     668        } else {
     669            result.SetTo(B_TRANSLATE("%bytes bytes for %num files"));
     670        }
    664671
    665         uint32 numberIndex = 0;
     672        char numString[16];
     673        sprintf(numString, "%ld", fileCount);
     674        result.ReplaceFirst("%num", numString);
    666675
    667         while (numStr[numberIndex]) {
    668             bytes += numStr[numberIndex++];
    669             if (--charsTillComma == 0 && numStr[numberIndex]) {
    670                 bytes += ',';
    671                 charsTillComma = 3;
    672             }
     676    } else {
     677        if (size >= kGBSize) {
     678            result.SetTo(B_TRANSLATE("%size GiB (%bytes bytes)"));
     679            sprintf(sizeString, "%.1f", (float)size / kGBSize);
     680            result.ReplaceFirst("%size", sizeString);
     681        } else if (size >= kMBSize) {
     682            result.SetTo(B_TRANSLATE("%size MiB (%bytes bytes)"));
     683            sprintf(sizeString, "%.1f", (float)size / kMBSize);
     684            result.ReplaceFirst("%size", sizeString);
     685        } else if (size >= kKBSize) {
     686            result.SetTo(B_TRANSLATE("%size KiB (%bytes bytes)"));
     687            sprintf(sizeString, "%lld", (int64)(size + kHalfKBSize) / kKBSize);
     688            result.ReplaceFirst("%size", sizeString);
     689        } else {
     690            result.SetTo(B_TRANSLATE("%bytes bytes"));
    673691        }
    674     } else
    675         bytes = numStr;
     692    }
    676693
    677     if (size >= kGBSize)
    678         PrintFloat(result, (float)size / kGBSize) << " GiB";
    679     else if (size >= kMBSize)
    680         PrintFloat(result, (float)size / kMBSize) << " MiB";
    681     else if (size >= kKBSize)
    682         result << (int64)(size + kHalfKBSize) / kKBSize << "KiB";
    683     else
    684         result << size;
    685 
    686     if (size >= kKBSize)
    687         result << " (" << bytes;
    688 
    689     result << " bytes";
    690 
    691     if (size >= kKBSize)
    692         result  << ")";
    693 
    694     if (fileCount)
    695         result << " for " << fileCount << " files";
     694    char bytesString[32];
     695    sprintf(bytesString, ("%lld"), size);
     696    result.ReplaceFirst("%bytes", bytesString);
    696697}
    697698
    698699
     
    711712        if (!lock)
    712713            return B_ERROR;
    713714
    714         window->SetSizeStr("Error calculating folder size.");
     715        window->SetSizeStr(
     716            B_TRANSLATE("Error calculating folder size."));
    715717        return B_ERROR;
    716718    }
    717719
     
    799801            false, &message);
    800802
    801803        if (fFilePanel != NULL) {
    802             fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON,"Select");
     804            fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON,
     805                B_TRANSLATE("Select"));
    803806            fFilePanel->Window()->ResizeTo(500, 300);
    804             BString title;
    805             title << "Link \"" << fModel->Name() << "\" to:";
     807            BString title(B_TRANSLATE_COMMENT("Link \"%name\" to:", "File dialog title for new sym link"));
     808            title.ReplaceFirst("%name", fModel->Name());
    806809            fFilePanel->Window()->SetTitle(title.String());
    807810            fFilePanel->Show();
    808811            fFilePanelOpen = true;
     
    880883    // Find offset for attributes, might be overiden below if there
    881884    // is a prefered handle menu displayed
    882885    currentFont.SetSize(kAttribFontHeight);
    883     fDivider = currentFont.StringWidth("Modified:") + kBorderMargin + kBorderWidth + 1;
     886    fDivider = currentFont.StringWidth(
     887        B_TRANSLATE("Modified:"))
     888        + kBorderMargin + kBorderWidth + 1;
    884889    // Add a preferred handler pop-up menu if this item
    885890    // is a file...This goes in place of the Link To:
    886891    // string...
     
    897902                fTitleRect.bottom + (lineHeight * 7),
    898903                Bounds().Width() - 5, fTitleRect.bottom + (lineHeight * 8));
    899904            fPreferredAppMenu = new BMenuField(preferredAppRect, "", "", new BPopUpMenu(""));
    900             fDivider = currentFont.StringWidth("Opens with:") + 5;
     905            fDivider = currentFont.StringWidth(
     906                B_TRANSLATE("Opens with:")) + 5;
    901907            fPreferredAppMenu->SetDivider(fDivider);
    902908            fDivider += (preferredAppRect.left - 2);
    903909            fPreferredAppMenu->SetFont(&currentFont);
    904910            fPreferredAppMenu->SetHighColor(kAttrTitleColor);
    905             fPreferredAppMenu->SetLabel("Opens with:");
     911            fPreferredAppMenu->SetLabel(
     912                B_TRANSLATE("Opens with:"));
    906913
    907914            char prefSignature[B_MIME_TYPE_LENGTH];
    908915            nodeInfo.GetPreferredApp(prefSignature);
     
    912919
    913920            // Add the default menu item and set it to marked
    914921            BMenuItem *result;
    915             result = new BMenuItem("Default application", new BMessage(kSetPreferredApp));
     922            result = new BMenuItem(
     923                B_TRANSLATE("Default application"),
     924                new BMessage(kSetPreferredApp));
    916925            result->SetTarget(this);
    917926            fPreferredAppMenu->Menu()->AddItem(result);
    918927            result->SetMarked(true);
     
    952961
    953962    fPermissionsSwitch = new PaneSwitch(BRect(), "Permissions");
    954963    fPermissionsSwitch->SetMessage(new BMessage(kPermissionsSelected));
    955     fPermissionsSwitch->SetLabels(NULL, "Permissions");
     964    fPermissionsSwitch->SetLabels(NULL,
     965        B_TRANSLATE("Permissions"));
    956966    AddChild(fPermissionsSwitch);
    957967    fPermissionsSwitch->ResizeToPreferred();
    958968    fPermissionsSwitch->MoveTo(kBorderWidth + 3,
     
    15471557            return;
    15481558
    15491559        fFreeBytes = freeBytes;
    1550         char buffer[500];
    1551         if (capacity >= kGBSize)
    1552             sprintf(buffer, "%.1f G", (float)capacity / kGBSize);
    1553         else
    1554             sprintf(buffer, "%.1f M", (float)capacity / kMBSize);
    15551560
    1556         sprintf(buffer + strlen(buffer), "B (%.1f MB used -- %.1f MB free)",
    1557             (float)(capacity - fFreeBytes) / kMBSize,
    1558             (float)fFreeBytes / kMBSize);
     1561        char capacityStr[16], usedStr[16], freeStr[16];
     1562        sprintf(usedStr, "%.1f", (float)(capacity - fFreeBytes) / kMBSize);
     1563        sprintf(freeStr, "%.1f", (float)fFreeBytes / kMBSize);
    15591564
    1560         fSizeStr = buffer;
     1565        if (capacity >= kGBSize) {
     1566            fSizeStr.SetTo(B_TRANSLATE("%capacity GB (%used MB used -- %free MB free)"));
     1567            sprintf(capacityStr, "%.1f", (float)capacity / kGBSize);
     1568        } else {
     1569            fSizeStr.SetTo(B_TRANSLATE("%capacity MB (%used MB used -- %free MB free)"));
     1570            sprintf(capacityStr, "%.1f", (float)capacity / kMBSize);
     1571        }
     1572        fSizeStr.ReplaceFirst("%capacity", capacityStr);
     1573        fSizeStr.ReplaceFirst("%used", usedStr);
     1574        fSizeStr.ReplaceFirst("%free", freeStr);
     1575
    15611576    } else if (fModel->IsFile()) {
    15621577        // poll for size changes because they do not get node monitored
    15631578        // until a file gets closed (with the old BFS)
     
    16871702    // Capacity/size
    16881703    SetHighColor(kAttrTitleColor);
    16891704    if (fModel->IsVolume() || fModel->IsRoot()) {
    1690         MovePenTo(BPoint(fDivider - (StringWidth("Capacity:")), lineBase));
    1691         DrawString("Capacity:");
     1705        MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Capacity:"))),
     1706            lineBase));
     1707        DrawString(B_TRANSLATE("Capacity:"));
    16921708    } else {
    1693         MovePenTo(BPoint(fDivider - (StringWidth("Size:")), lineBase));
     1709        MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Size:"))),
     1710            lineBase));
    16941711        fSizeRect.left = fDivider + 2;
    16951712        fSizeRect.top = lineBase - fontMetrics.ascent;
    16961713        fSizeRect.bottom = lineBase + fontMetrics.descent;
    1697         DrawString("Size:");
     1714        DrawString(B_TRANSLATE("Size:"));
    16981715    }
    16991716
    17001717    MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
     
    17141731
    17151732    // Created
    17161733    SetHighColor(kAttrTitleColor);
    1717     MovePenTo(BPoint(fDivider - (StringWidth("Created:")), lineBase));
     1734    MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Created:"))),
     1735        lineBase));
    17181736    SetHighColor(kAttrTitleColor);
    1719     DrawString("Created:");
     1737    DrawString(B_TRANSLATE("Created:"));
    17201738    MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
    17211739    SetHighColor(kAttrValueColor);
    17221740    DrawString(fCreatedStr.String());
    17231741    lineBase += lineHeight;
    17241742
    17251743    // Modified
    1726     MovePenTo(BPoint(fDivider - (StringWidth("Modified:")), lineBase));
     1744    MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Modified:"))),
     1745        lineBase));
    17271746    SetHighColor(kAttrTitleColor);
    1728     DrawString("Modified:");
     1747    DrawString(B_TRANSLATE("Modified:"));
    17291748    MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
    17301749    SetHighColor(kAttrValueColor);
    17311750    DrawString(fModifiedStr.String());
    17321751    lineBase += lineHeight;
    17331752
    17341753    // Kind
    1735     MovePenTo(BPoint(fDivider - (StringWidth("Kind:")), lineBase));
     1754    MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Kind:"))), lineBase));
    17361755    SetHighColor(kAttrTitleColor);
    1737     DrawString("Kind:");
     1756    DrawString(B_TRANSLATE("Kind:"));
    17381757    MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
    17391758    SetHighColor(kAttrValueColor);
    17401759    DrawString(fKindStr.String());
     
    17441763    GetFont(&normalFont);
    17451764
    17461765    // Path
    1747     MovePenTo(BPoint(fDivider - (StringWidth("Location:")), lineBase));
     1766    MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Location:"))),
     1767        lineBase));
    17481768    SetHighColor(kAttrTitleColor);
    1749     DrawString("Location:");
     1769    DrawString(B_TRANSLATE("Location:"));
    17501770
    17511771    MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
    17521772    SetHighColor(kLinkColor);
     
    17701790
    17711791    // Link to/version
    17721792    if (fModel->IsSymLink()) {
    1773         MovePenTo(BPoint(fDivider - (StringWidth("Link to:")), lineBase));
     1793        MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Link to:"))),
     1794            lineBase));
    17741795        SetHighColor(kAttrTitleColor);
    1775         DrawString("Link To:");
     1796        DrawString(B_TRANSLATE("Link To:"));
    17761797        MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
    17771798        SetHighColor(kLinkColor);
    17781799
     
    17951816        fDescRect = BRect(-1, -1, -1, -1);
    17961817    } else if (fModel->IsExecutable()) {
    17971818        //Version
    1798         MovePenTo(BPoint(fDivider - (StringWidth("Version:")), lineBase));
     1819        MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Version:"))),
     1820            lineBase));
    17991821        SetHighColor(kAttrTitleColor);
    1800         DrawString("Version:");
     1822        DrawString(B_TRANSLATE("Version:"));
    18011823        MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
    18021824        SetHighColor(kAttrValueColor);
    18031825        BString nameString;
     
    18081830        lineBase += lineHeight;
    18091831
    18101832        // Description
    1811         MovePenTo(BPoint(fDivider - (StringWidth("Description:")), lineBase));
     1833        MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Description:"))),
     1834            lineBase));
    18121835        SetHighColor(kAttrTitleColor);
    1813         DrawString("Description:");
     1836        DrawString(B_TRANSLATE("Description:"));
    18141837        MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
    18151838        SetHighColor(kAttrValueColor);
    18161839        // Check for truncation
     
    18931916        if (entry.InitCheck() == B_OK
    18941917            && entry.GetParent(&parent) == B_OK) {
    18951918            if (parent.Contains(text)) {
    1896                 (new BAlert("", "That name is already taken. "
    1897                     "Please type another one.", "OK", 0, 0,
    1898                     B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     1919                (new BAlert("",
     1920                    B_TRANSLATE("That name is already taken. "
     1921                    "Please type another one."),
     1922                    B_TRANSLATE("OK"),
     1923                    0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    18991924                reopen = true;
    19001925            } else {
    19011926                if (fModel->IsVolume()) {
     
    19141939            }
    19151940        }
    19161941    } else if (length >= B_FILE_NAME_LENGTH) {
    1917         (new BAlert("", "That name is too long. "
    1918             "Please type another one.", "OK", 0, 0,
    1919             B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     1942        (new BAlert("",
     1943            B_TRANSLATE("That name is too long. "
     1944            "Please type another one."),
     1945            B_TRANSLATE("OK"),
     1946            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    19201947        reopen = true;
    19211948    }
    19221949
     
    20202047        navigationItem->SetTarget(be_app);
    20212048    }
    20222049
    2023     parent->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
     2050    parent->AddItem(new BMenuItem(B_TRANSLATE("Open"),
     2051        new BMessage(kOpenSelection), 'O'));
    20242052
    20252053    if (!model.IsTrash()) {
    2026         parent->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
     2054        parent->AddItem(
     2055            new BMenuItem(B_TRANSLATE("Edit name"),
     2056            new BMessage(kEditItem), 'E'));
    20272057        parent->AddSeparatorItem();
    20282058        if (fModel->IsVolume()) {
    2029             BMenuItem *item;
    2030             parent->AddItem(item = new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U'));
     2059            BMenuItem* item;
     2060            parent->AddItem(
     2061                item = new BMenuItem(B_TRANSLATE("Unmount"),
     2062                new BMessage(kUnmountVolume), 'U'));
    20312063            // volume model, enable/disable the Unmount item
    20322064            BVolume boot;
    20332065            BVolumeRoster().GetBootVolume(&boot);
     
    20362068            if (volume == boot)
    20372069                item->SetEnabled(false);
    20382070        } else
    2039             parent->AddItem(new BMenuItem("Identify", new BMessage(kIdentifyEntry)));
     2071            parent->AddItem(
     2072                new BMenuItem(B_TRANSLATE("Identify"),
     2073                new BMessage(kIdentifyEntry)));
    20402074    } else
    2041         parent->AddItem(new BMenuItem("Empty Trash", new BMessage(kEmptyTrash)));
     2075        parent->AddItem(
     2076            new BMenuItem(B_TRANSLATE("Empty Trash"),
     2077            new BMessage(kEmptyTrash)));
    20422078
    20432079    BMenuItem *sizeItem = NULL;
    20442080    if (model.IsDirectory() && !model.IsVolume() && !model.IsRoot())  {
    2045         parent->AddItem(sizeItem = new BMenuItem("Recalculate folder size",
     2081        parent->AddItem(sizeItem = new BMenuItem(B_TRANSLATE("Recalculate folder size"),
    20462082            new BMessage(kRecalculateSize)));
    20472083    }
    20482084
    20492085    if (model.IsSymLink()) {
    2050         parent->AddItem(sizeItem = new BMenuItem("Set new link target",
     2086        parent->AddItem(sizeItem = new BMenuItem(B_TRANSLATE("Set new link target"),
    20512087            new BMessage(kSetLinkTarget)));
    20522088    }
    20532089
    20542090    parent->AddItem(new BSeparatorItem());
    2055     parent->AddItem(new BMenuItem("Permissions", new BMessage(kPermissionsSelected), 'P'));
     2091    parent->AddItem(new BMenuItem(B_TRANSLATE("Permissions"),
     2092        new BMessage(kPermissionsSelected), 'P'));
    20562093
    20572094    parent->SetFont(be_plain_font);
    20582095    parent->SetTargetForItems(this);
  • TemplatesMenu.h

     
    4646class TemplatesMenu : public BMenu {
    4747public:
    4848    TemplatesMenu(const BMessenger &target,
    49         const char *label = kTemplatesMenuName);
     49        const char *label);
    5050    virtual ~TemplatesMenu();
    5151
    5252
  • FilePanelPriv.cpp

     
    5353#include <Alert.h>
    5454#include <Application.h>
    5555#include <Button.h>
     56#include <Catalog.h>
    5657#include <Debug.h>
    5758#include <Directory.h>
    5859#include <FindDirectory.h>
     60#include <Locale.h>
    5961#include <MenuBar.h>
    6062#include <MenuField.h>
    6163#include <MenuItem.h>
     
    7678#include <string.h>
    7779
    7880
     81
    7982const char *kDefaultFilePanelTemplate = "FilePanelSettings";
    8083
    81 
    8284static uint32
    8385GetLinkFlavor(const Model *model, bool resolve = true)
    8486{
     
    133135//  #pragma mark -
    134136
    135137
     138#undef B_TRANSLATE_CONTEXT
     139#define B_TRANSLATE_CONTEXT "libTracker"
     140
    136141TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
    137142        const BEntry *startDir, uint32 nodeFlavors, bool multipleSelection,
    138143        BMessage *message, BRefFilter *filter, uint32 containerWindowFlags,
     
    441446    fPoseView->SetRefFilter(filter);
    442447    fPoseView->CommitActivePose();
    443448    fPoseView->Refresh();
    444     FavoritesMenu *menu = dynamic_cast<FavoritesMenu *>(
    445         fMenuBar->FindItem("Favorites")->Submenu());
     449    FavoritesMenu* menu = dynamic_cast<FavoritesMenu *>(
     450        fMenuBar->FindItem(
     451            B_TRANSLATE("Favorites"))->Submenu());
    446452    if (menu)
    447453        menu->SetRefFilter(filter);
    448454}
     
    498504
    499505    BTextControl *textControl = dynamic_cast<BTextControl *>(FindView("text view"));
    500506    BObjectList<BPose> *selectionList = fPoseView->SelectionList();
    501     const char *buttonText = fButtonText.String();
     507    BString buttonText = fButtonText;
    502508    bool enabled = false;
    503509
    504510    if (fIsSavePanel && textControl) {
     
    509515                Model *model = selectionList->FirstItem()->TargetModel();
    510516                if (model->ResolveIfLink()->IsDirectory()) {
    511517                    enabled = true;
    512                     buttonText = "Open";
     518                    buttonText = B_TRANSLATE("Open");
    513519                } else {
    514520                    // insert the name of the selected model into the text field
    515521                    textControl->SetText(model->Name());
     
    546552        }
    547553    }
    548554
    549     button->SetLabel(buttonText);
     555    button->SetLabel(buttonText.String());
    550556    button->SetEnabled(enabled);
    551557}
    552558
     
    597603    AddMenus();
    598604    AddContextMenus();
    599605
    600     FavoritesMenu *favorites = new FavoritesMenu("Favorites",
     606    FavoritesMenu* favorites = new FavoritesMenu(
     607        B_TRANSLATE("Favorites"),
    601608        new BMessage(kSwitchDirectory), new BMessage(B_REFS_RECEIVED),
    602609        BMessenger(this), IsSavePanel(), fPoseView->RefFilter());
    603     favorites->AddItem(new BMenuItem("Add current folder",
     610    favorites->AddItem(new BMenuItem(
     611        B_TRANSLATE("Add current folder"),
    604612        new BMessage(kAddCurrentDir)));
    605     favorites->AddItem(new BMenuItem("Edit favorites"B_UTF8_ELLIPSIS,
     613    favorites->AddItem(new BMenuItem(
     614        B_TRANSLATE("Edit favorites"B_UTF8_ELLIPSIS),
    606615        new BMessage(kEditFavorites)));
    607616
    608617    fMenuBar->AddItem(favorites);
    609618
    610619    // configure menus
    611     BMenuItem *item = fMenuBar->FindItem("Window");
     620    BMenuItem* item = fMenuBar->FindItem(
     621        B_TRANSLATE("Window"));
    612622    if (item) {
    613623        fMenuBar->RemoveItem(item);
    614624        delete item;
    615625    }
    616626
    617     item = fMenuBar->FindItem("File");
     627    item = fMenuBar->FindItem(B_TRANSLATE("File"));
    618628    if (item) {
    619629        BMenu *menu = item->Submenu();
    620630        if (menu) {
     
    627637                delete item;
    628638
    629639            // remove add-ons menu, identifier menu, separator
    630             item = menu->FindItem(kAddOnsMenuName);
     640            item = menu->FindItem(B_TRANSLATE("Add-ons"));
    631641            if (item) {
    632642                int32 index = menu->IndexOf(item);
    633643                delete menu->RemoveItem(index);
     
    683693        rect.right = rect.left + 170;
    684694        rect.bottom = rect.top + 13;
    685695
    686         fTextControl = new BTextControl(rect, "text view",  "save text", "", NULL,
    687             B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
     696        fTextControl = new BTextControl(rect, "text view",
     697            B_TRANSLATE("save text"),
     698            "", NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
    688699        DisallowMetaKeys(fTextControl->TextView());
    689700        DisallowFilenameKeys(fTextControl->TextView());
    690701        fBackView->AddChild(fTextControl);
    691702        fTextControl->SetDivider(0.0f);
    692703        fTextControl->TextView()->SetMaxBytes(B_FILE_NAME_LENGTH - 1);
    693704
    694         fButtonText = "Save";
     705        fButtonText.SetTo(B_TRANSLATE("Save"));
    695706    } else
    696         fButtonText = "Open";
     707        fButtonText.SetTo(B_TRANSLATE("Open"));
    697708
    698709    rect = windRect;
    699710    rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10);
     
    741752    fBackView->AddChild(default_button);
    742753
    743754    rect.right = rect.left -= 10;
    744     float cancel_width = be_plain_font->StringWidth("Cancel") + 20;
     755    float cancel_width = be_plain_font->StringWidth(
     756        B_TRANSLATE("Cancel")) + 20;
    745757    rect.left = (cancel_width > 75) ? (rect.right - cancel_width) : (rect.right - 75);
    746758
    747     BButton *cancel_button = new BButton(rect, "cancel button", "Cancel",
     759    BButton* cancel_button = new BButton(rect, "cancel button",
     760        B_TRANSLATE("Cancel"),
    748761        new BMessage(kCancelButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
    749762    fBackView->AddChild(cancel_button);
    750763
     
    847860void
    848861TFilePanel::AddFileContextMenus(BMenu *menu)
    849862{
    850     menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
    851     menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
    852     menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() ?
    853             "Delete" : "Move to Trash",
    854             new BMessage(kMoveToTrash), 'T'));
     863    menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
     864        new BMessage(kGetInfo), 'I'));
     865    menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
     866        new BMessage(kEditItem), 'E'));
     867    menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
     868        ? B_TRANSLATE("Delete")
     869        : B_TRANSLATE("Move to Trash"),
     870        new BMessage(kMoveToTrash), 'T'));
    855871    menu->AddSeparatorItem();
    856     menu->AddItem(new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
    857     menu->AddItem(new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
     872    menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"),
     873        new BMessage(B_CUT), 'X'));
     874    menu->AddItem(new BMenuItem(B_TRANSLATE("Copy"),
     875        new BMessage(B_COPY), 'C'));
    858876//  menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
    859877
    860878    menu->SetTargetForItems(PoseView());
     
    864882void
    865883TFilePanel::AddVolumeContextMenus(BMenu *menu)
    866884{
    867     menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
    868     menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
    869     menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
     885    menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
     886        new BMessage(kOpenSelection), 'O'));
     887    menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
     888        new BMessage(kGetInfo), 'I'));
     889    menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
     890        new BMessage(kEditItem), 'E'));
    870891    menu->AddSeparatorItem();
    871     menu->AddItem(new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
    872     menu->AddItem(new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
     892    menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"),
     893        new BMessage(B_CUT), 'X'));
     894    menu->AddItem(new BMenuItem(B_TRANSLATE("Copy"),
     895        new BMessage(B_COPY), 'C'));
    873896//  menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
    874897
    875898    menu->SetTargetForItems(PoseView());
     
    879902void
    880903TFilePanel::AddWindowContextMenus(BMenu *menu)
    881904{
    882     BMenuItem *item = new BMenuItem("New folder", new BMessage(kNewFolder), 'N');
     905    BMenuItem* item = new BMenuItem(
     906        B_TRANSLATE("New folder"),
     907        new BMessage(kNewFolder), 'N');
    883908    item->SetTarget(PoseView());
    884909    menu->AddItem(item);
    885910    menu->AddSeparatorItem();
    886911
    887     item = new BMenuItem("Paste", new BMessage(B_PASTE), 'V');
     912    item = new BMenuItem(
     913        B_TRANSLATE("Paste"),
     914        new BMessage(B_PASTE), 'V');
    888915    item->SetTarget(PoseView());
    889916    menu->AddItem(item);
    890917    menu->AddSeparatorItem();
    891918
    892     item = new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow),
    893         'A', B_SHIFT_KEY);
     919    item = new BMenuItem(
     920        B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
     921        new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
    894922    item->SetTarget(PoseView());
    895923    menu->AddItem(item);
    896924
    897     item = new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A');
     925    item = new BMenuItem(
     926        B_TRANSLATE("Select all"),
     927        new BMessage(B_SELECT_ALL), 'A');
    898928    item->SetTarget(PoseView());
    899929    menu->AddItem(item);
    900930
    901     item = new BMenuItem("Invert selection", new BMessage(kInvertSelection), 'S');
     931    item = new BMenuItem(
     932        B_TRANSLATE("Invert selection"),
     933        new BMessage(kInvertSelection), 'S');
    902934    item->SetTarget(PoseView());
    903935    menu->AddItem(item);
    904936
    905     item = new BMenuItem("Go to parent", new BMessage(kOpenParentDir), B_UP_ARROW);
     937    item = new BMenuItem(
     938        B_TRANSLATE("Go to parent"),
     939        new BMessage(kOpenParentDir), B_UP_ARROW);
    906940    item->SetTarget(this);
    907941    menu->AddItem(item);
    908942}
     
    10511085
    10521086                            // Don't allow saves of multiple files
    10531087                            if (count > 1) {
    1054                                 ShowCenteredAlert("Sorry, saving more than one item is not allowed.",
    1055                                     "Cancel");
     1088                                ShowCenteredAlert(
     1089                                    B_TRANSLATE("Sorry, saving more than one item is not allowed."),
     1090                                    B_TRANSLATE("Cancel"));
    10561091                            } else {
    10571092                                // if we are a savepanel, set up the filepanel correctly
    10581093                                // then pass control so we follow the same path as if the user
     
    13411376    BDirectory dir;
    13421377
    13431378    if (TargetModel()->IsRoot()) {
    1344         ShowCenteredAlert("Sorry, you can't save things at the root of "
    1345             "your system.", "Cancel");
     1379        ShowCenteredAlert(
     1380            B_TRANSLATE("Sorry, you can't save things at the root of "
     1381            "your system."),
     1382            B_TRANSLATE("Cancel"));
    13461383        return;
    13471384    }
    13481385
    13491386    // check for some illegal file names
    13501387    if (strcmp(fTextControl->Text(), ".") == 0
    13511388        || strcmp(fTextControl->Text(), "..") == 0) {
    1352         ShowCenteredAlert("The specified name is illegal. Please choose "
    1353             "another name.", "Cancel");
     1389        ShowCenteredAlert(
     1390            B_TRANSLATE("The specified name is illegal. Please choose "
     1391            "another name."),
     1392            B_TRANSLATE("Cancel"));
    13541393        fTextControl->TextView()->SelectAll();
    13551394        return;
    13561395    }
    13571396
    13581397    if (dir.SetTo(TargetModel()->EntryRef()) != B_OK) {
    1359         ShowCenteredAlert("There was a problem trying to save in the folder "
    1360             "you specified. Please try another one.", "Cancel");
     1398        ShowCenteredAlert(
     1399            B_TRANSLATE("There was a problem trying to save in the folder "
     1400            "you specified. Please try another one."),
     1401            B_TRANSLATE("Cancel"));
    13611402        return;
    13621403    }
    13631404
    13641405    if (dir.Contains(fTextControl->Text())) {
    13651406        if (dir.Contains(fTextControl->Text(), B_DIRECTORY_NODE)) {
    1366             ShowCenteredAlert("The specified name is already used as the name "
    1367                 "of a folder. Please choose another name.", "Cancel");
     1407            ShowCenteredAlert(
     1408                B_TRANSLATE("The specified name is already used as the name "
     1409                "of a folder. Please choose another name."),
     1410                B_TRANSLATE("Cancel"));
    13681411            fTextControl->TextView()->SelectAll();
    13691412            return;
    13701413        } else {
    13711414            // if this was invoked by a dbl click, it is an explicit replacement
    13721415            // of the file.
    1373             BString str;
    1374             str << "The file \"" << fTextControl->Text() << "\" already exists in the "
    1375                 "specified folder. Do you want to replace it?";
     1416            BString str(B_TRANSLATE("The file \"%name\" already exists in the specified folder. Do you want to replace it?"));
     1417            str.ReplaceFirst("%name", fTextControl->Text());
    13761418
    1377             if (ShowCenteredAlert(str.String(), "Cancel", "Replace") == 0) {
     1419            if (ShowCenteredAlert(str.String(),
     1420                B_TRANSLATE("Cancel"),
     1421                B_TRANSLATE("Replace"))
     1422                == 0) {
    13781423                // user canceled
    13791424                fTextControl->TextView()->SelectAll();
    13801425                return;
  • TrackerSettingsWindow.cpp

     
    3232All rights reserved.
    3333*/
    3434
     35#include <Catalog.h>
     36#include <Locale.h>
    3537
    3638#include "SettingsViews.h"
    3739#include "TrackerSettings.h"
     
    6365const uint32 kRevertButtonPressed = 'Rebp';
    6466
    6567
     68#undef B_TRANSLATE_CONTEXT
     69#define B_TRANSLATE_CONTEXT "libTracker"
     70
    6671TrackerSettingsWindow::TrackerSettingsWindow()
    67     : BWindow(BRect(80, 80, 450, 350), "Tracker preferences", B_TITLED_WINDOW,
     72    : BWindow(BRect(80, 80, 450, 350),
     73        B_TRANSLATE("Tracker preferences"),
     74        B_TITLED_WINDOW,
    6875        B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_NO_WORKSPACE_ACTIVATION
    6976        | B_NOT_ANCHORED_ON_ACTIVATE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
    7077{
     
    7481    AddChild(topView);
    7582
    7683    rect.InsetBy(10, 10);
    77     rect.right = rect.left + be_plain_font->StringWidth("Volume Icons")
     84    rect.right = rect.left + be_plain_font->StringWidth(
     85        B_TRANSLATE("Volume Icons"))
    7886        + (float)B_V_SCROLL_BAR_WIDTH + 40.0f;
    7987    fSettingsTypeListView = new BListView(rect, "List View", B_SINGLE_SELECTION_LIST,
    8088        B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM);
     
    8593    rect = scrollView->Frame();
    8694    rect.left = rect.right + 10;
    8795    rect.top = rect.bottom;
    88     fDefaultsButton = new BButton(rect, "Defaults", "Defaults",
     96    fDefaultsButton = new BButton(rect, "Defaults",
     97        B_TRANSLATE("Defaults"),
    8998        new BMessage(kDefaultsButtonPressed), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
    9099    fDefaultsButton->ResizeToPreferred();
    91100    fDefaultsButton->SetEnabled(false);
     
    93102
    94103    rect = fDefaultsButton->Frame();
    95104    rect.left = rect.right + 10;
    96     fRevertButton = new BButton(rect, "Revert", "Revert",
     105    fRevertButton = new BButton(rect, "Revert",
     106        B_TRANSLATE("Revert"),
    97107        new BMessage(kRevertButtonPressed), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
    98108    fRevertButton->SetEnabled(false);
    99109    fRevertButton->ResizeToPreferred();
     
    109119
    110120    rect = _SettingsFrame();
    111121
    112     fSettingsTypeListView->AddItem(new SettingsItem("Desktop",
     122    fSettingsTypeListView->AddItem(new SettingsItem(
     123        B_TRANSLATE("Desktop"),
    113124        new DesktopSettingsView(rect)));
    114     fSettingsTypeListView->AddItem(new SettingsItem("Windows",
     125    fSettingsTypeListView->AddItem(new SettingsItem(
     126        B_TRANSLATE("Windows"),
    115127        new WindowsSettingsView(rect)));
    116     fSettingsTypeListView->AddItem(new SettingsItem("Date & Time",
     128    fSettingsTypeListView->AddItem(new SettingsItem(
     129        B_TRANSLATE("Date & Time"),
    117130        new TimeFormatSettingsView(rect)));
    118     fSettingsTypeListView->AddItem(new SettingsItem("Trash",
     131    fSettingsTypeListView->AddItem(new SettingsItem(
     132        B_TRANSLATE("Trash"),
    119133        new TrashSettingsView(rect)));
    120     fSettingsTypeListView->AddItem(new SettingsItem("Volume icons",
     134    fSettingsTypeListView->AddItem(new SettingsItem(
     135        B_TRANSLATE("Volume icons"),
    121136        new SpaceBarSettingsView(rect)));
    122137
    123138    // compute preferred view size
  • NavMenu.cpp

     
    4242
    4343#include <StopWatch.h>
    4444#include <Application.h>
     45#include <Catalog.h>
    4546#include <Directory.h>
     47#include <Locale.h>
    4648#include <Query.h>
    4749#include <Path.h>
    4850#include <Screen.h>
     
    7981{
    8082    if (!dragmessage || !incoming)
    8183        return false;
    82        
    8384    bool retvalue=false;
    8485    for (int32 inIndex=0; incoming->HasRef("refs", inIndex); inIndex++) {
    8586        entry_ref inRef;
     
    137138        ModelMenuItem *item = dynamic_cast<ModelMenuItem *>(menu->ItemAt(index));
    138139        if (!item)
    139140            continue;
    140            
    141141        const Model *model = item->TargetModel();
    142142        if (!model)
    143143            continue;
     
    183183        return;
    184184       
    185185    nodeinfo.SetTo(&node);
    186    
    187186    char mimestr[B_MIME_TYPE_LENGTH];       
    188187    //  add it to the list
    189188    if (nodeinfo.GetType(mimestr) == B_OK && strlen(mimestr) > 0) {
     
    207206                break;
    208207            }
    209208        }
    210        
    211209        if (unique)
    212210            typeslist->AddItem(new BString(mimestr));
    213211    }
     
    244242//  #pragma mark -
    245243
    246244
     245#undef B_TRANSLATE_CONTEXT
     246#define B_TRANSLATE_CONTEXT "libTracker"
     247
    247248BNavMenu::BNavMenu(const char *title, uint32 message, const BHandler *target,
    248249    BWindow *parentWindow, const BObjectList<BString> *list)
    249250    :   BSlowMenu(title),
     
    574575                   
    575576            PoseInfo poseInfo;
    576577            ssize_t size = -1;
    577            
    578578            if (result->Node())
    579579                size = result->Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
    580580                    &poseInfo, sizeof(poseInfo));
     
    722722    fItemList->MakeEmpty();
    723723
    724724    if (!count) {
    725         BMenuItem *item = new BMenuItem("Empty folder", 0);
     725        BMenuItem *item = new BMenuItem(
     726            B_TRANSLATE("Empty folder"),
     727            0);
    726728        item->SetEnabled(false);
    727729        AddItem(item);
    728730    }
  • TemplatesMenu.cpp

     
    3333*/
    3434
    3535#include <Application.h>
     36#include <Catalog.h>
    3637#include <FindDirectory.h>
    3738#include <Directory.h>
    3839#include <NodeInfo.h>
     40#include <Locale.h>
    3941#include <Mime.h>
    4042#include <Message.h>
    4143#include <Path.h>
     
    5052#include "IconMenuItem.h"
    5153#include "MimeTypes.h"
    5254
     55
     56#undef B_TRANSLATE_CONTEXT
     57#define B_TRANSLATE_CONTEXT "libTracker"
     58
     59
    5360namespace BPrivate {
    5461
    5562const char *kTemplatesDirectory = "Tracker/Tracker New Templates";
    56 const char *kTemplatesMenuName = "New";
    5763
    58 static const char *kOpenTemplatesMenuName = "Edit templates"B_UTF8_ELLIPSIS;
    5964
    6065}
    6166
     
    112117        delete RemoveItem(0L);
    113118
    114119    // Add the Folder
    115     IconMenuItem *menuItem = new IconMenuItem("New folder", new BMessage(kNewFolder),
    116         B_DIR_MIMETYPE,B_MINI_ICON);
     120    IconMenuItem *menuItem = new IconMenuItem(
     121        B_TRANSLATE("New folder"),
     122        new BMessage(kNewFolder),
     123        B_DIR_MIMETYPE, B_MINI_ICON);
    117124    AddItem(menuItem);
    118125    menuItem->SetShortcut('N', 0);
    119126
     
    172179    message->AddRef("refs", &dirRef);
    173180   
    174181    // Add item to show templates folder.
    175     fOpenItem = new BMenuItem(kOpenTemplatesMenuName, message);
     182    fOpenItem =
     183        new BMenuItem(
     184            B_TRANSLATE("Edit templates"B_UTF8_ELLIPSIS),
     185            message);
    176186    AddItem(fOpenItem);
    177187    if (dirRef == entry_ref())
    178188        fOpenItem->SetEnabled(false);
  • OpenWithWindow.cpp

     
    4444
    4545#include <Alert.h>
    4646#include <Button.h>
     47#include <Catalog.h>
     48#include <Locale.h>
    4749#include <Mime.h>
    4850#include <NodeInfo.h>
    4951#include <Path.h>
     
    5557#include <stdio.h>
    5658#include <string.h>
    5759
     60
    5861const char *kDefaultOpenWithTemplate = "OpenWithSettings";
    59 
    6062// ToDo:
    6163// filter out trash
    6264// allow column configuring
     
    7072const rgb_color kOpenWithDefaultColor = { 0xFF, 0xFF, 0xCC, 255};
    7173
    7274
     75#undef B_TRANSLATE_CONTEXT
     76#define B_TRANSLATE_CONTEXT "libTracker"
     77
    7378OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen,
    7479        LockingList<BWindow> *windowList, window_look look, window_feel feel,
    7580        uint32 flags, uint32 workspace)
     
    9297
    9398    // add buttons
    9499
    95     fLaunchButton = new BButton(rect, "ok", "Open",
    96         new BMessage(kDefaultButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
     100    fLaunchButton = new BButton(rect, "ok",
     101        B_TRANSLATE("Open"),
     102        new BMessage(kDefaultButton),
     103        B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
    97104    fLaunchButton->ResizeToPreferred();
    98105    fLaunchButton->MoveTo(rect.right - 10 - kDocumentKnobWidth
    99106        - fLaunchButton->Bounds().Width(),
     
    102109
    103110    BRect buttonRect = fLaunchButton->Frame();
    104111    fLaunchAndMakeDefaultButton = new BButton(buttonRect, "make default",
    105         "Open and make preferred", new BMessage(kOpenAndMakeDefault),
     112        B_TRANSLATE("Open and make preferred"),
     113        new BMessage(kOpenAndMakeDefault),
    106114        B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
    107115    // wide button, have to resize to fit text
    108116    fLaunchAndMakeDefaultButton->ResizeToPreferred();
     
    112120    fLaunchAndMakeDefaultButton->SetEnabled(false);
    113121
    114122    buttonRect = fLaunchAndMakeDefaultButton->Frame();
    115     BButton *button = new BButton(buttonRect, "cancel", "Cancel",
    116         new BMessage(kCancelButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
     123    BButton *button = new BButton(buttonRect, "cancel",
     124        B_TRANSLATE("Cancel"),
     125        new BMessage(kCancelButton),
     126        B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
    117127    button->ResizeToPreferred();
    118128    button->MoveBy(- 10 - button->Bounds().Width(), 0);
    119129    backgroundView->AddChild(button);
     
    147157        SetTitle(buffer.String());
    148158    } else
    149159        // use generic title
    150         SetTitle("Open selection with:");
     160        SetTitle(B_TRANSLATE("Open selection with:"));
    151161
    152162    AddCommonFilter(new BMessageFilter(B_KEY_DOWN, &OpenWithContainerWindow::KeyDownFilter));
    153163}
     
    377387    message->AddInt32("attr_align", B_ALIGN_LEFT);
    378388    message->AddBool("attr_editable", false);
    379389    message->AddBool("attr_statfield", false);
    380     BMenuItem *item = new BMenuItem("Relation", message);
     390    BMenuItem *item = new BMenuItem(
     391        B_TRANSLATE("Relation"),
     392        message);
    381393    menu->AddItem(item);
    382394    message = new BMessage(kAttributeItem);
    383395    message->AddString("attr_name", kAttrAppVersion);
     
    387399    message->AddInt32("attr_align", B_ALIGN_LEFT);
    388400    message->AddBool("attr_editable", false);
    389401    message->AddBool("attr_statfield", false);
    390     item = new BMenuItem("Version", message);
     402    item = new BMenuItem(
     403        B_TRANSLATE("Version"),
     404        message);
    391405    menu->AddItem(item);
    392406}
    393407
     
    662676        errorString << "Could not find application \""
    663677            << pose->TargetModel()->Name() << "\"";
    664678
    665         (new BAlert("", errorString.String(), "OK", 0, 0, B_WIDTH_AS_USUAL,
    666             B_WARNING_ALERT))->Go();
     679        (new BAlert("", errorString.String(),
     680            B_TRANSLATE("OK"),
     681            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    667682        return;
    668683    }
    669684
     
    677692                "publisher of the application and ask them to update their application "
    678693                "to list the type of your document as supported.";
    679694
    680             BAlert *alert = new BAlert("", warning.String(),
    681                 "Cancel", "Open", 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     695            BAlert* alert = new BAlert("", warning.String(),
     696                B_TRANSLATE("Cancel"),
     697                B_TRANSLATE("Open"),
     698                0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    682699            alert->SetShortcut(0, B_ESCAPE);
    683700            if (alert->Go() == 0)
    684701                return;
     
    756773    if (fColumnList->CountItems() != 0)
    757774        return;
    758775
    759     BColumn *nameColumn = new BColumn("Name", kColumnStart, 125, B_ALIGN_LEFT,
     776    BColumn *nameColumn = new BColumn(
     777        B_TRANSLATE("Name"),
     778        kColumnStart, 125, B_ALIGN_LEFT,
    760779        kAttrStatName, B_STRING_TYPE, true, true);
    761780    fColumnList->AddItem(nameColumn);
    762     BColumn *relationColumn = new BColumn("Relation", 180, 100, B_ALIGN_LEFT,
     781    BColumn *relationColumn = new BColumn(
     782        B_TRANSLATE("Relation"),
     783        180, 100, B_ALIGN_LEFT,
    763784        kAttrOpenWithRelation, B_STRING_TYPE, false, false);
    764785    fColumnList->AddItem(relationColumn);
    765     fColumnList->AddItem(new BColumn("Location", 290, 225, B_ALIGN_LEFT,
     786    fColumnList->AddItem(new BColumn(
     787        B_TRANSLATE("Location"),
     788        290, 225, B_ALIGN_LEFT,
    766789        kAttrPath, B_STRING_TYPE, true, false));
    767     fColumnList->AddItem(new BColumn("Version", 525, 70, B_ALIGN_LEFT,
     790    fColumnList->AddItem(new BColumn(
     791        B_TRANSLATE("Version"),
     792        525, 70, B_ALIGN_LEFT,
    768793        kAttrAppVersion, B_STRING_TYPE, false, false));
    769794
    770795    // sort by relation and by name
     
    11521177        SetTargetForItems(fMessenger);
    11531178
    11541179    if (!CountItems()) {
    1155         BMenuItem *item = new BMenuItem("no supporting apps", 0);
     1180        BMenuItem* item = new BMenuItem(
     1181            B_TRANSLATE("no supporting apps"),
     1182            0);
    11561183        item->SetEnabled(false);
    11571184        AddItem(item);
    11581185    }
  • FSUtils.cpp

     
    5151
    5252#include <Alert.h>
    5353#include <Application.h>
     54#include <Catalog.h>
    5455#include <Debug.h>
    5556#include <Directory.h>
    5657#include <Entry.h>
    5758#include <FindDirectory.h>
     59#include <Locale.h>
    5860#include <NodeInfo.h>
    5961#include <Path.h>
    6062#include <Roster.h>
     
    99101
    100102namespace BPrivate {
    101103
     104#undef B_TRANSLATE_CONTEXT
     105#define B_TRANSLATE_CONTEXT "libTracker"
     106
    102107static status_t FSDeleteFolder(BEntry *, CopyLoopControl *, bool updateStatus,
    103108    bool deleteTopDir = true, bool upateFileNameInStatus = false);
    104109static status_t MoveEntryToTrash(BEntry *, BPoint *, Undo &undo);
     
    137142#endif
    138143
    139144
    140 const char *kDeleteConfirmationStr = "Are you sure you want to delete the "
    141     "selected item(s)? This operation cannot be reverted.";
     145static const char* kDeleteConfirmationStr =
     146    B_TRANSLATE_MARK("Are you sure you want to delete the "
     147    "selected item(s)? This operation cannot be reverted.");
    142148
    143 const char *kReplaceStr = "You are trying to replace the item:\n"
    144     "\t%s%s\n"
     149static const char* kReplaceStr =
     150    B_TRANSLATE_MARK("You are trying to replace the item:\n"
     151    "\t%name%dest\n"
    145152    "with:\n"
    146     "\t%s%s\n\n"
    147     "Would you like to replace it with the one you are %s?";
     153    "\t%name%src\n\n"
     154    "Would you like to replace it with the one you are %movemode?");
    148155
    149 const char *kDirectoryReplaceStr = "An item named \"%s\" already exists in "
     156static const char* kDirectoryReplaceStr =
     157    B_TRANSLATE_MARK("An item named \"%name\" already exists in "
    150158    "this folder, and may contain\nitems with the same names. Would you like "
    151     "to replace them with those contained in the folder you are %s?";
     159    "to replace them with those contained in the folder you are %verb?");
    152160
    153 const char *kSymLinkReplaceStr = "An item named \"%s\" already exists in this "
     161static const char* kSymLinkReplaceStr =
     162    B_TRANSLATE_MARK("An item named \"%name\" already exists in this "
    154163    "folder. Would you like to replace it with the symbolic link you are "
    155     "creating?";
     164    "creating?");
    156165
    157 const char *kNoFreeSpace = "Sorry, there is not enough free space on the "
    158     "destination volume to copy the selection.";
     166static const char* kNoFreeSpace =
     167    B_TRANSLATE_MARK("Sorry, there is not enough free space on the "
     168    "destination volume to copy the selection.");
    159169
    160 const char *kFileErrorString = "Error copying file \"%s\":\n\t%s\n\nWould "
    161     "you like to continue?";
    162 const char *kFolderErrorString = "Error copying folder \"%s\":\n\t%s\n\nWould "
    163     "you like to continue?";
    164 const char *kFileDeleteErrorString = "There was an error deleting \"%s\""
    165     ":\n\t%s";
    166 const char *kReplaceManyStr = "Some items already exist in this folder with "
    167     "the same names as the items you are %s.\n \nWould you like to replace "
    168     "them with the ones you are %s or be prompted for each one?";
     170static const char* kFileErrorString =
     171    B_TRANSLATE_MARK("Error copying file \"%name\":\n\t%error\n\nWould "
     172    "you like to continue?");
    169173
    170 const char *kFindAlternativeStr = "Would you like to find some other suitable "
    171     "application?";
    172 const char *kFindApplicationStr = "Would you like to find a suitable "
    173     "application to open the file?";
     174static const char* kFolderErrorString =
     175    B_TRANSLATE_MARK("Error copying folder \"%name\":\n\t%error\n\nWould you like to continue?");
    174176
     177static const char* kFileDeleteErrorString =
     178    B_TRANSLATE_MARK("There was an error deleting \"%name\""
     179    ":\n\t%error");
     180
     181static const char* kReplaceManyStr =
     182    B_TRANSLATE_MARK("Some items already exist in this folder with "
     183    "the same names as the items you are %verb.\n \nWould you like to replace "
     184    "them with the ones you are %verb or be prompted for each one?");
     185
     186static const char* kFindAlternativeStr =
     187    B_TRANSLATE_MARK("Would you like to find some other suitable application?");
     188
     189static const char *kFindApplicationStr = B_TRANSLATE_MARK("Would you like to find a suitable "
     190    "application to open the file?");
     191
    175192// Skip these attributes when copying in Tracker
    176193const char *kSkipAttributes[] = {
    177194    kAttrPoseInfo,
     
    326343TrackerCopyLoopControl::FileError(const char *message, const char *name,
    327344    status_t error, bool allowContinue)
    328345{
    329     char buffer[512];
    330     sprintf(buffer, message, name, strerror(error));
     346    BString buffer(message);
     347    buffer.ReplaceFirst("%name", name);
     348    buffer.ReplaceFirst("%error", strerror(error));
    331349
    332350    if (allowContinue) {
    333         BAlert *alert = new BAlert("", buffer, "Cancel", "OK", 0,
    334             B_WIDTH_AS_USUAL, B_STOP_ALERT);
     351        BAlert* alert = new BAlert("", buffer.String(),
     352            B_TRANSLATE("Cancel"),
     353            B_TRANSLATE("OK"),
     354            0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
    335355        alert->SetShortcut(0, B_ESCAPE);
    336356        return alert->Go() != 0;
    337357    }
    338358
    339     BAlert *alert = new BAlert("", buffer, "Cancel", 0, 0,
    340         B_WIDTH_AS_USUAL, B_STOP_ALERT);
     359    BAlert* alert = new BAlert("", buffer.String(),
     360        B_TRANSLATE("Cancel"),
     361        0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
    341362    alert->SetShortcut(0, B_ESCAPE);
    342363    alert->Go();
    343364    return false;
     
    608629        // quick way out
    609630        return true;
    610631
    611     const char *warning = NULL;
     632    BString warning;
    612633    bool requireOverride = true;
    613634
    614635    if (DirectoryMatchesOrContains(entry, B_BEOS_DIRECTORY)) {
    615         warning = "If you %s the system folder or its contents, you "
     636        warning.SetTo(
     637            B_TRANSLATE("If you %action the system folder or its contents, you "
    616638            "won't be able to boot " OS_NAME "! Are you sure you want to do "
    617             "this? To %s the system folder or its contents anyway, hold down "
    618             "the Shift key and click \"Do it\".";
     639            "this? To %action the system folder or its contents anyway, hold down "
     640            "the Shift key and click \"Do it\"."));
    619641    } else if (DirectoryMatches(entry, B_USER_DIRECTORY)) {
    620         warning = "If you %s the home folder, " OS_NAME " may not "
     642        warning .SetTo(
     643            B_TRANSLATE("If you %action the home folder, " OS_NAME " may not "
    621644            "behave properly! Are you sure you want to do this? "
    622             "To %s the home anyway, click \"Do it\".";
     645            "To %action the home anyway, click \"Do it\"."));
    623646        requireOverride = false;
    624647    } else if (DirectoryMatchesOrContains(entry, B_USER_CONFIG_DIRECTORY)
    625648        || DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) {
     
    628651                B_USER_SETTINGS_DIRECTORY)
    629652            || DirectoryMatchesOrContains(entry, "beos_mime",
    630653                B_COMMON_SETTINGS_DIRECTORY)) {
    631             warning = "If you %s the mime settings, " OS_NAME " may not "
     654            warning.SetTo(
     655                B_TRANSLATE("If you %action the mime settings, " OS_NAME " may not "
    632656                "behave properly! Are you sure you want to do this? "
    633                 "To %s the mime settings anyway, click \"Do it\".";
     657                "To %action the mime settings anyway, click \"Do it\"."));
    634658            requireOverride = false;
    635659        } else if (DirectoryMatches(entry, B_USER_CONFIG_DIRECTORY)) {
    636             warning = "If you %s the config folder, " OS_NAME " may not "
     660            warning.SetTo(
     661                B_TRANSLATE("If you %action the config folder, " OS_NAME " may not "
    637662                "behave properly! Are you sure you want to do this? "
    638                 "To %s the config folder anyway, click \"Do it\".";
     663                "To %action the config folder anyway, click \"Do it\"."));
    639664            requireOverride = false;
    640665        } else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY)
    641666            || DirectoryMatches(entry, B_COMMON_SETTINGS_DIRECTORY)) {
    642             warning = "If you %s the settings folder, " OS_NAME " may not "
     667            warning.SetTo(
     668                B_TRANSLATE("If you %action the settings folder, " OS_NAME " may not "
    643669                "behave properly! Are you sure you want to do this? "
    644                 "To %s the settings folder anyway, click \"Do it\".";
     670                "To %action the settings folder anyway, click \"Do it\"."));
    645671            requireOverride = false;
    646672        }
    647673    }
    648674
    649     if (!warning)
     675    if (!warning.Length())
    650676        return true;
    651677
    652678    if (dontAsk)
     
    657683        // we already warned about moving home this time around
    658684        return true;
    659685
    660     char buffer[256];
    661     sprintf(buffer, warning, action, action);
     686    warning.ReplaceAll("%action", action);
    662687
    663     if ((new OverrideAlert("", buffer, "Do it", (requireOverride
    664             ? B_SHIFT_KEY : 0),
    665             "Cancel", 0, NULL, 0, B_WIDTH_AS_USUAL,
    666             B_WARNING_ALERT))->Go() == 1) {
    667         if (confirmedAlready)
    668             *confirmedAlready = kNotConfirmed;
    669         return false;
     688    if ((new OverrideAlert("", warning.String(),
     689        B_TRANSLATE("Do it"),
     690        (requireOverride ? B_SHIFT_KEY : 0),
     691        B_TRANSLATE("Cancel"),
     692        0, NULL, 0, B_WIDTH_AS_USUAL,
     693        B_WARNING_ALERT))->Go() == 1) {
     694            if (confirmedAlready)
     695                *confirmedAlready = kNotConfirmed;
     696            return false;
    670697    }
    671698
    672699    if (confirmedAlready) {
     
    687714    int32 *collisionCount, ConflictCheckResult *preflightResult)
    688715{
    689716    if (dstVol->IsReadOnly()) {
    690         BAlert *alert = new BAlert("",
    691             "You can't move or copy items to read-only volumes.",
    692             "Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     717        BAlert* alert = new BAlert("",
     718            B_TRANSLATE("You can't move or copy items to read-only volumes."),
     719            B_TRANSLATE("Cancel"),
     720            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    693721        alert->SetShortcut(0, B_ESCAPE);
    694722        alert->Go();
    695723        return B_ERROR;
     
    702730        // the copy loops, except it takes forever to call CalcItemsAndSize
    703731        BEntry entry((entry_ref *)srcList->ItemAt(index));
    704732        if (IsDisksWindowIcon(&entry)) {
    705             const char *errorStr;
     733            BString errorStr;
    706734            if (moveMode == kCreateLink)
    707                 errorStr = "You cannot create a link to the root directory.";
     735                errorStr.SetTo(
     736                    B_TRANSLATE("You cannot create a link to the root directory."));
    708737            else
    709                 errorStr = "You cannot copy or move the root directory.";
     738                errorStr.SetTo(
     739                    B_TRANSLATE("You cannot copy or move the root directory."));
    710740
    711             BAlert *alert = new BAlert("", errorStr, "Cancel", 0, 0,
    712                 B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     741            BAlert* alert = new BAlert("",
     742                errorStr.String(),
     743                B_TRANSLATE("Cancel"),
     744                0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    713745            alert->SetShortcut(0, B_ESCAPE);
    714746            alert->Go();
    715747            return B_ERROR;
    716748        }
    717749        if (moveMode == kMoveSelectionTo
    718             && !ConfirmChangeIfWellKnownDirectory(&entry, "move", false,
    719                 &askOnceOnly)) {
     750            && !ConfirmChangeIfWellKnownDirectory(&entry,
     751                B_TRANSLATE("move"),
     752                false, &askOnceOnly)) {
    720753            return B_ERROR;
    721754        }
    722755    }
     
    753786
    754787                    // check for free space before starting copy
    755788                    if ((totalSize + (4 * kKBSize)) >= dstVol->FreeBytes()) {
    756                         BAlert *alert = new BAlert("", kNoFreeSpace, "Cancel",
     789                        BAlert* alert = new BAlert("",
     790                            B_TRANSLATE(kNoFreeSpace),
     791                            B_TRANSLATE("Cancel"),
    757792                            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    758793                        alert->SetShortcut(0, B_ESCAPE);
    759794                        alert->Go();
     
    923958
    924959            BEntry sourceEntry(srcRef);
    925960            if (sourceEntry.InitCheck() != B_OK) {
    926                 BString error;
    927                 error << "Error moving \"" << srcRef->name << "\".";
    928                 BAlert *alert = new BAlert("", error.String(), "Cancel", 0, 0,
    929                     B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     961                BString error(B_TRANSLATE("Error moving \"%name\"."));
     962                    error.ReplaceFirst("%name", srcRef->name);
     963                BAlert* alert = new BAlert("", error.String(),
     964                    B_TRANSLATE("Cancel"),
     965                    0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    930966                alert->SetShortcut(0, B_ESCAPE);
    931967                alert->Go();
    932968                break;
     
    939975
    940976                result = MoveEntryToTrash(&sourceEntry, loc, undo);
    941977                if (result != B_OK) {
    942                     BString error;
    943                     error << "Error moving \"" << srcRef->name
    944                         << "\" to Trash. (" << strerror(result) << ")";
    945                     BAlert *alert = new BAlert("", error.String(), "Cancel",
     978                    BString error(B_TRANSLATE("Error moving \"%name\" to Trash. (%error)"));
     979                    error.ReplaceFirst("%name", srcRef->name);
     980                    error.ReplaceFirst("%error", strerror(result));
     981                    BAlert* alert = new BAlert("", error.String(),
     982                        B_TRANSLATE("Cancel"),
    946983                        0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    947984                    alert->SetShortcut(0, B_ESCAPE);
    948985                    alert->Go();
     
    10541091
    10551092    // check for free space first
    10561093    if ((srcStat->st_size + kKBSize) >= volume.FreeBytes()) {
    1057         loopControl->FileError(kNoFreeSpace, "", B_DEVICE_FULL, false);
     1094        loopControl->FileError(B_TRANSLATE(kNoFreeSpace),
     1095            "", B_DEVICE_FULL, false);
    10581096        throw (status_t)B_DEVICE_FULL;
    10591097    }
    10601098
     
    10661104    loopControl->UpdateStatus(destName, ref, 1024, true);
    10671105
    10681106    if (makeOriginalName) {
    1069         FSMakeOriginalName(destName, destDir, " copy");
     1107        BString suffix(" ");
     1108        suffix << B_TRANSLATE_COMMENT("copy", "filename copy"),
     1109        FSMakeOriginalName(destName, destDir, suffix.String());
    10701110        undo.UpdateEntry(srcFile, destName);
    10711111    }
    10721112
     
    10981138            throw (status_t)err;
    10991139
    11001140        if (err != B_OK) {
    1101             if (!loopControl->FileError(kFileErrorString, destName, err,
    1102                     true)) {
     1141            if (!loopControl->FileError(
     1142                B_TRANSLATE(kFileErrorString),
     1143                destName, err, true)) {
    11031144                throw (status_t)err;
    11041145            } else {
    11051146                // user selected continue in spite of error, update status bar
     
    13711412    loopControl->UpdateStatus(ref.name, ref, 1024, true);
    13721413
    13731414    if (makeOriginalName) {
    1374         FSMakeOriginalName(destName, destDir, " copy");
     1415        BString suffix(" ");
     1416        suffix << B_TRANSLATE_COMMENT("copy", "filename copy"),
     1417        FSMakeOriginalName(destName, destDir, suffix.String());
    13751418        undo.UpdateEntry(srcEntry, destName);
    13761419    }
    13771420
     
    14171460                err = destDir->CreateDirectory(destName, &newDir);
    14181461        }
    14191462#endif
    1420         if (err != B_OK) {
    1421             if (!loopControl->FileError(kFolderErrorString, destName, err,
    1422                     true)) {
     1463        if (err != B_OK) {
     1464            if (!loopControl->FileError(
     1465                B_TRANSLATE(kFolderErrorString),
     1466                destName, err, true)) {
    14231467                throw err;
    14241468            }
    14251469
     
    15361580            strcpy(name, ref.name);
    15371581
    15381582            BSymLink link;
    1539             FSMakeOriginalName(name, destDir, " link");
     1583            BString suffix(" ");
     1584            suffix << B_TRANSLATE_COMMENT("link", "filename link"),
     1585            FSMakeOriginalName(name, destDir, suffix.String());
    15401586            undo.UpdateEntry(entry, name);
    15411587
    15421588            BPath path;
     
    16161662                err = destDir->CreateSymLink(name, path.Path(), &link);
    16171663
    16181664            if (err == B_UNSUPPORTED) {
    1619                 throw FailWithAlert(err, "The target disk does not support "
    1620                     "creating links.", NULL);
     1665                throw FailWithAlert(err,
     1666                    B_TRANSLATE("The target disk does not support "
     1667                    "creating links."), NULL);
    16211668            }
    16221669
    1623             FailWithAlert::FailOnError(err, "Error creating link to \"%s\".",
     1670            FailWithAlert::FailOnError(err,
     1671                B_TRANSLATE("Error creating link to \"%name\"."),
    16241672                ref.name);
    16251673
    16261674            if (loc && loc != (BPoint *)-1) {
     
    16591707        // no alert, was already taken care of before
    16601708        return error;
    16611709    } catch (MoveError error) {
    1662         BString errorString;
    1663         errorString << "Error moving \"" << ref.name << '"';
    1664         (new BAlert("", errorString.String(), "OK", 0, 0, B_WIDTH_AS_USUAL,
    1665             B_WARNING_ALERT))->Go();
     1710        BString errorString(B_TRANSLATE("Error moving \"%name\""));
     1711        errorString.ReplaceFirst("%name", ref.name);
     1712        (new BAlert("", errorString.String(),
     1713            B_TRANSLATE("OK"),
     1714            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    16661715        return error.fError;
    16671716    } catch (FailWithAlert error) {
    1668         char buffer[256];
     1717        BString buffer(error.fString);
    16691718        if (error.fName)
    1670             sprintf(buffer, error.fString, error.fName);
     1719            buffer.ReplaceFirst("%name", error.fName);
    16711720        else
    1672             strcpy(buffer, error.fString);
    1673         (new BAlert("", buffer, "OK", 0, 0, B_WIDTH_AS_USUAL,
    1674             B_WARNING_ALERT))->Go();
     1721            buffer <<  error.fString;
     1722        (new BAlert("", buffer.String(),
     1723            B_TRANSLATE("OK"),
     1724            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    16751725
    16761726        return error.fError;
    16771727    }
     
    18031853            if (volume == boot) {
    18041854                char name[B_FILE_NAME_LENGTH];
    18051855                volume.GetName(name);
    1806                 char buffer[256];
    1807                 sprintf(buffer, "Cannot unmount the boot volume \"%s\".",
    1808                     name);
    1809                 BAlert *alert = new BAlert("", buffer, "Cancel", 0, 0,
    1810                     B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     1856                BString buffer(B_TRANSLATE("Cannot unmount the boot volume \"%name\"."));
     1857                buffer.ReplaceFirst("%name", name);
     1858                BAlert *alert = new BAlert("", buffer.String(),
     1859                    B_TRANSLATE("Cancel"),
     1860                    0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    18111861                alert->SetShortcut(0, B_ESCAPE);
    18121862                alert->Go();
    18131863            } else {
     
    18281878        trash_dir.GetEntry(&trashEntry);
    18291879
    18301880        if (dir == trash_dir || dir.Contains(&trashEntry)) {
    1831             (new BAlert("", "You cannot put the Trash, home or Desktop "
    1832                 "directory into the trash.", "OK", 0, 0,
    1833                     B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     1881            (new BAlert("",
     1882                B_TRANSLATE("You cannot put the Trash, home or Desktop "
     1883                "directory into the trash."),
     1884                B_TRANSLATE("OK"),
     1885                0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    18341886
    18351887            // return no error so we don't get two dialogs
    18361888            return B_OK;
     
    18541906    char name[B_FILE_NAME_LENGTH];
    18551907    strcpy(name, ref.name);
    18561908    if (trash_dir.Contains(name)) {
    1857         FSMakeOriginalName(name, &trash_dir, " copy");
     1909        BString suffix(" ");
     1910        suffix << B_TRANSLATE_COMMENT("copy", "filename copy"),
     1911        FSMakeOriginalName(name, &trash_dir, suffix.String());
    18581912        undo.UpdateEntry(entry, name);
    18591913    }
    18601914
     
    19111965    // prompt user only if there is more than one collision, otherwise the
    19121966    // single collision case will be handled as a "Prompt" case by CheckName
    19131967    if (*collisionCount > 1) {
    1914         const char *verb = (moveMode == kMoveSelectionTo) ? "moving"
    1915             : "copying";
    1916         char replaceMsg[256];
    1917         sprintf(replaceMsg, kReplaceManyStr, verb, verb);
     1968        const char *verb = (moveMode == kMoveSelectionTo)
     1969            ? B_TRANSLATE("moving")
     1970            : B_TRANSLATE("copying");
     1971        BString replaceMsg(B_TRANSLATE(kReplaceManyStr));
     1972        replaceMsg.ReplaceAll("%verb", verb);
    19181973
    1919         BAlert *alert = new BAlert("", replaceMsg,
    1920             "Cancel", "Prompt", "Replace all");
     1974        BAlert* alert = new BAlert("", replaceMsg.String(),
     1975            B_TRANSLATE("Cancel"),
     1976            B_TRANSLATE("Prompt"),
     1977            B_TRANSLATE("Replace all"));
    19211978        alert->SetShortcut(0, B_ESCAPE);
    19221979        switch (alert->Go()) {
    19231980            case 0:
     
    19742031            && moveMode != kCreateRelativeLink
    19752032            && (srcDirectory == *destDir
    19762033                || srcDirectory.Contains(&destEntry))) {
    1977             (new BAlert("", "You can't move a folder into itself "
    1978                 "or any of its own sub-folders.", "OK", 0, 0,
    1979                 B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     2034            (new BAlert("",
     2035                B_TRANSLATE("You can't move a folder into itself "
     2036                "or any of its own sub-folders."),
     2037                B_TRANSLATE("OK"),
     2038                0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    19802039            return B_ERROR;
    19812040        }
    19822041    }
    19832042
    19842043    if (FSIsTrashDir(sourceEntry) && moveMode != kCreateLink
    19852044        && moveMode != kCreateRelativeLink) {
    1986         (new BAlert("", "You can't move or copy the trash.",
    1987             "OK", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     2045        (new BAlert("",
     2046            B_TRANSLATE("You can't move or copy the trash."),
     2047            B_TRANSLATE("OK"),
     2048            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    19882049        return B_ERROR;
    19892050    }
    19902051
     
    20072068    if (destIsDir) {
    20082069        BDirectory test_dir(&entry);
    20092070        if (test_dir.Contains(sourceEntry)) {
    2010             (new BAlert("", "You can't replace a folder "
    2011                 "with one of its sub-folders.", "OK", 0, 0,
    2012                 B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     2071            (new BAlert("",
     2072                B_TRANSLATE("You can't replace a folder "
     2073                "with one of its sub-folders."),
     2074                B_TRANSLATE("OK"),
     2075                0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    20132076            return B_ERROR;
    20142077        }
    20152078    }
     
    20192082        && moveMode != kCreateRelativeLink
    20202083        && destIsDir != sourceIsDirectory) {
    20212084            (new BAlert("", sourceIsDirectory
    2022                 ? "You cannot replace a file with a folder or a symbolic "
    2023                     "link."
    2024                 : "You cannot replace a folder or a symbolic link with a "
    2025                     "file.", "OK", 0, 0, B_WIDTH_AS_USUAL,
    2026                     B_WARNING_ALERT))->Go();
     2085                ? B_TRANSLATE("You cannot replace a file with a folder or a symbolic "
     2086                "link.")
     2087                : B_TRANSLATE("You cannot replace a folder or a symbolic link with a "
     2088                "file."),
     2089                B_TRANSLATE("OK"),
     2090                0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    20272091            return B_ERROR;
    20282092        }
    20292093
    20302094    if (replaceAll != kReplaceAll) {
    20312095        // prompt user to determine whether to replace or not
    20322096
    2033         char replaceMsg[512];
     2097        BString replaceMsg;
    20342098
    2035         if (moveMode == kCreateLink || moveMode == kCreateRelativeLink)
    2036             sprintf(replaceMsg, kSymLinkReplaceStr, name);
    2037         else if (sourceEntry->IsDirectory())
    2038             sprintf(replaceMsg, kDirectoryReplaceStr, name,
    2039                 moveMode == kMoveSelectionTo ? "moving" : "copying");
    2040         else {
     2099        if (moveMode == kCreateLink || moveMode == kCreateRelativeLink) {
     2100            replaceMsg.SetTo(B_TRANSLATE(kSymLinkReplaceStr));
     2101            replaceMsg.ReplaceFirst("%name", name);
     2102        } else if (sourceEntry->IsDirectory()) {
     2103            replaceMsg.SetTo(B_TRANSLATE(kDirectoryReplaceStr));
     2104            replaceMsg.ReplaceFirst("%name", name);
     2105            replaceMsg.ReplaceFirst("%verb",
     2106                moveMode == kMoveSelectionTo
     2107                ? B_TRANSLATE("moving")
     2108                : B_TRANSLATE("copying"));
     2109        } else {
    20412110            char sourceBuffer[96], destBuffer[96];
    20422111            StatStruct statBuffer;
    20432112
     
    20522121            else
    20532122                destBuffer[0] = '\0';
    20542123
    2055             sprintf(replaceMsg, kReplaceStr, name, destBuffer, name,
    2056                 sourceBuffer, moveMode == kMoveSelectionTo ? "moving"
    2057                     : "copying");
     2124            replaceMsg.SetTo(B_TRANSLATE(kReplaceStr));
     2125            replaceMsg.ReplaceAll("%name", name);
     2126            replaceMsg.ReplaceFirst("%dest", destBuffer);
     2127            replaceMsg.ReplaceFirst("%src", sourceBuffer);
     2128            replaceMsg.ReplaceFirst("%movemode",
     2129                moveMode == kMoveSelectionTo
     2130                ? B_TRANSLATE("moving")
     2131                : B_TRANSLATE("copying"));
    20582132        }
    20592133
    20602134        // special case single collision (don't need Replace All shortcut)
    20612135        BAlert *alert;
    20622136        if (multipleCollisions || sourceIsDirectory)
    2063             alert = new BAlert("", replaceMsg, "Skip", "Replace all");
     2137            alert = new BAlert("", replaceMsg.String(),
     2138                B_TRANSLATE("Skip"),
     2139                B_TRANSLATE("Replace all"));
    20642140        else {
    2065             alert = new BAlert("", replaceMsg, "Cancel", "Replace");
     2141            alert = new BAlert("", replaceMsg.String(),
     2142                B_TRANSLATE("Cancel"),
     2143                B_TRANSLATE("Replace"));
    20662144            alert->SetShortcut(0, B_ESCAPE);
    20672145        }
    20682146        switch (alert->Go()) {
     
    20862164        return B_OK;
    20872165
    20882166    if (err != B_OK) {
    2089         BString error;
    2090         error << "There was a problem trying to replace \""
    2091             << name << "\". The item might be open or busy.";
    2092         BAlert *alert = new BAlert("", error.String(), "Cancel", 0, 0,
    2093             B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     2167        BString error(B_TRANSLATE("There was a problem trying to replace \"%name\". The item might be open or busy."));
     2168        error.ReplaceFirst("%name", name);;
     2169        BAlert* alert = new BAlert("", error.String(),
     2170            B_TRANSLATE("Cancel"),
     2171            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    20942172        alert->SetShortcut(0, B_ESCAPE);
    20952173        alert->Go();
    20962174    }
     
    21362214        else if (err == B_OK)
    21372215            dir.Rewind();
    21382216        else {
    2139             loopControl->FileError(kFileDeleteErrorString, ref.name, err,
     2217            loopControl->FileError(
     2218                B_TRANSLATE(kFileDeleteErrorString),
     2219                ref.name, err,
    21402220                false);
    21412221        }
    21422222    }
     
    27052785    }
    27062786
    27072787    if (err != B_OK && err != kTrashCanceled && err != kUserCanceled) {
    2708         (new BAlert("", "Error emptying Trash!", "OK", NULL, NULL,
    2709             B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     2788        (new BAlert("",
     2789            B_TRANSLATE("Error emptying Trash!"),
     2790            B_TRANSLATE("OK"),
     2791            NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    27102792    }
    27112793
    27122794    return B_OK;
     
    27202802        bool dontMoveToTrash = TrackerSettings().DontMoveFilesToTrash();
    27212803
    27222804        if (!dontMoveToTrash) {
    2723             BAlert *alert = new BAlert("", kDeleteConfirmationStr,
    2724                 "Cancel", "Move to Trash", "Delete", B_WIDTH_AS_USUAL,
    2725                 B_OFFSET_SPACING, B_WARNING_ALERT);
     2805            BAlert* alert = new BAlert("",
     2806                B_TRANSLATE(kDeleteConfirmationStr),
     2807                B_TRANSLATE("Cancel"),
     2808                B_TRANSLATE("Move to Trash"),
     2809                B_TRANSLATE("Delete"),
     2810                B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
    27262811
    27272812            alert->SetShortcut(0, B_ESCAPE);
    27282813            alert->SetShortcut(1, 'm');
     
    27372822                    return B_OK;
    27382823            }
    27392824        } else {
    2740             BAlert *alert = new BAlert("", kDeleteConfirmationStr,
    2741                 "Cancel", "Delete", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
    2742                 B_WARNING_ALERT);
     2825            BAlert* alert = new BAlert("",
     2826                B_TRANSLATE(kDeleteConfirmationStr),
     2827                B_TRANSLATE("Cancel"),
     2828                B_TRANSLATE("Delete"),
     2829                NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
    27432830
    27442831            alert->SetShortcut(0, B_ESCAPE);
    27452832            alert->SetShortcut(1, 'd');
     
    27742861        }
    27752862
    27762863        if (err != kTrashCanceled && err != kUserCanceled && err != B_OK)
    2777             (new BAlert("", "Error deleting items", "OK", NULL, NULL,
    2778                 B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
     2864            (new BAlert("",
     2865                B_TRANSLATE("Error deleting items"),
     2866                B_TRANSLATE("OK"),
     2867                NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
    27792868    }
    27802869
    27812870    delete list;
     
    29303019    status_t result = dir.InitCheck();
    29313020    if (result == B_OK) {
    29323021        char name[B_FILE_NAME_LENGTH];
    2933         strcpy(name, "New folder");
     3022        strcpy(name, B_TRANSLATE("New folder"));
    29343023
    29353024        int32 fnum = 1;
    29363025        while (dir.Contains(name)) {
     
    29383027            // ToDo:
    29393028            // move this logic ot FSMakeOriginalName
    29403029            if (++fnum > 9)
    2941                 sprintf(name, "New folder%ld", fnum);
     3030                snprintf(name, sizeof(name),
     3031                    B_TRANSLATE("New folder%ld"),
     3032                    fnum);
    29423033            else
    2943                 sprintf(name, "New folder %ld", fnum);
     3034                snprintf(name, sizeof(name),
     3035                    B_TRANSLATE("New folder %ld"),
     3036                    fnum);
    29443037        }
    29453038
    29463039        BDirectory newDir;
     
    29603053        }
    29613054    }
    29623055
    2963     BAlert *alert = new BAlert("", "Sorry, could not create a new folder.",
    2964         "Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     3056    BAlert* alert = new BAlert("",
     3057        B_TRANSLATE("Sorry, could not create a new folder."),
     3058        B_TRANSLATE("Cancel"),
     3059        0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    29653060    alert->SetShortcut(0, B_ESCAPE);
    29663061    alert->Go();
    29673062    return result;
     
    31203215        if (nodeToClose)
    31213216            dynamic_cast<TTracker *>(be_app)->CloseParent(*nodeToClose);
    31223217    } else {
    3123         alertString << "Could not open \"" << appRef->name << "\" ("
    3124             << strerror(error) << "). ";
     3218        alertString.SetTo(B_TRANSLATE("Could not open \"%name\" (%error). "));
     3219        alertString.ReplaceFirst("%name", appRef->name);
     3220        alertString.ReplaceFirst("%error", strerror(error));
    31253221        if (refs && openWithOK && error != B_SHUTTING_DOWN) {
    3126             alertString << kFindAlternativeStr;
    3127             BAlert *alert = new BAlert("", alertString.String(),
    3128                 "Cancel", "Find", 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     3222            alertString << B_TRANSLATE(kFindAlternativeStr);
     3223            BAlert* alert = new BAlert("", alertString.String(),
     3224                B_TRANSLATE("Cancel"),
     3225                B_TRANSLATE("Find"),
     3226                0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    31293227            alert->SetShortcut(0, B_ESCAPE);
    31303228            if (alert->Go() == 1)
    31313229                error = TrackerOpenWith(refs);
    31323230        } else {
    3133             BAlert *alert = new BAlert("", alertString.String(),
    3134                 "Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     3231            BAlert* alert = new BAlert("", alertString.String(),
     3232                B_TRANSLATE("Cancel"),
     3233                0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    31353234            alert->SetShortcut(0, B_ESCAPE);
    31363235            alert->Go();
    31373236        }
     
    32743373        }
    32753374
    32763375        if (error != B_OK) {
    3277             alertString << "Could not find an application to open \""
    3278                 << documentRef.name << "\" (" << strerror(error) << "). ";
     3376            alertString.SetTo(B_TRANSLATE("Could not find an application to open \"%name\" (%error). "));
     3377            alertString.ReplaceFirst("%name", documentRef.name);
     3378            alertString.ReplaceFirst("%error", strerror(error));
    32793379            if (openWithOK)
    3280                 alternative = kFindApplicationStr;
     3380                alternative = B_TRANSLATE(kFindApplicationStr);
    32813381
    32823382            break;
    32833383        } else {
     
    33253425        }
    33263426
    33273427        if (error == B_LAUNCH_FAILED_EXECUTABLE && !refsToPass) {
    3328             alertString << "Could not open \"" << app.name
    3329                 << "\". The file is mistakenly marked as executable. ";
     3428            alertString.SetTo(B_TRANSLATE("Could not open \"%name\". The file is mistakenly marked as executable. "));
     3429            alertString.ReplaceFirst("%name", app.name);
    33303430
    33313431            if (!openWithOK) {
    33323432                // offer the possibility to change the permissions
    33333433
    3334                 alertString << "\nShould this be fixed?";
    3335                 BAlert *alert = new BAlert("", alertString.String(),
    3336                     "Cancel", "Proceed", 0, B_WIDTH_AS_USUAL,
    3337                     B_WARNING_ALERT);
     3434                alertString << B_TRANSLATE("\nShould this be fixed?");
     3435                BAlert* alert = new BAlert("", alertString.String(),
     3436                    B_TRANSLATE("Cancel"),
     3437                    B_TRANSLATE("Proceed"),
     3438                    0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    33383439                alert->SetShortcut(0, B_ESCAPE);
    33393440                if (alert->Go() == 1) {
    33403441                    BEntry entry(&documentRef);
     
    33503451                        _TrackerLaunchDocuments(NULL, refs, false);
    33513452                        return;
    33523453                    } else {
    3353                         alertString = "Could not update permissions of "
    3354                             "file \"";
    3355                         alertString << app.name << "\". " << strerror(error);
     3454                        alertString.SetTo(B_TRANSLATE("Could not update permissions of file \"%name\". %error"));
     3455                        alertString.ReplaceFirst("%name", app.name);
     3456                        alertString.ReplaceFirst("%error", strerror(error));
    33563457                    }
    33573458                } else
    33583459                    return;
    33593460            }
    33603461
    3361             alternative = kFindApplicationStr;
     3462            alternative = B_TRANSLATE(kFindApplicationStr);
    33623463        } else if (error == B_LAUNCH_FAILED_APP_IN_TRASH) {
    3363             alertString << "Could not open \"" << documentRef.name
    3364                 << "\" because application \"" << app.name << "\" is in the "
    3365                     "Trash. ";
    3366             alternative = kFindAlternativeStr;
     3464            alertString.SetTo(B_TRANSLATE("Could not open \"%document\" because application \"%app\" is in the Trash. "));
     3465            alertString.ReplaceFirst("%document", documentRef.name);
     3466            alertString.ReplaceFirst("%app", app.name);
     3467            alternative = B_TRANSLATE(kFindAlternativeStr);
    33673468        } else if (error == B_LAUNCH_FAILED_APP_NOT_FOUND) {
    3368             alertString << "Could not open \"" << documentRef.name << "\" "
    3369                 << "(" << strerror(error) << "). ";
    3370             alternative = kFindAlternativeStr;
     3469            alertString.SetTo(B_TRANSLATE("Could not open \"%name\" (%error). "));
     3470            alertString.ReplaceFirst("%name", documentRef.name);
     3471            alertString.ReplaceFirst("%error", strerror(error));
     3472            alternative = B_TRANSLATE(kFindAlternativeStr);
    33713473        } else if (error == B_MISSING_SYMBOL
    33723474            && LoaderErrorDetails(&app, loaderErrorString) == B_OK) {
    3373             alertString << "Could not open \"" << documentRef.name << "\" ";
    3374             if (openedDocuments)
    3375                 alertString << "with application \"" << app.name << "\" ";
    3376             alertString << "(Missing symbol: " << loaderErrorString << "). \n";
    3377             alternative = kFindAlternativeStr;
     3475            if (openedDocuments) {
     3476                alertString.SetTo(B_TRANSLATE("Could not open \"%document\" with application \"%app\" (Missing symbol: %symbol). \n"));
     3477                alertString.ReplaceFirst("%document", documentRef.name);
     3478                alertString.ReplaceFirst("%app", app.name);
     3479                alertString.ReplaceFirst("%symbol", loaderErrorString.String());
     3480            } else {
     3481                alertString.SetTo(B_TRANSLATE("Could not open \"%document\" (Missing symbol: %symbol). \n"));
     3482                alertString.ReplaceFirst("%document", documentRef.name);
     3483                alertString.ReplaceFirst("%symbol", loaderErrorString.String());
     3484            }
     3485            alternative = B_TRANSLATE(kFindAlternativeStr);
    33783486        } else if (error == B_MISSING_LIBRARY
    33793487            && LoaderErrorDetails(&app, loaderErrorString) == B_OK) {
    3380             alertString << "Could not open \"" << documentRef.name << "\" ";
    3381             if (openedDocuments)
    3382                 alertString << "with application \"" << app.name << "\" ";
    3383             alertString << "(Missing libraries: " << loaderErrorString
    3384                 << "). \n";
    3385             alternative = kFindAlternativeStr;
     3488            if (openedDocuments) {
     3489                alertString.SetTo(B_TRANSLATE("Could not open \"%document\" with application \"%app\" (Missing libraries: %library). \n"));
     3490                alertString.ReplaceFirst("%document", documentRef.name);
     3491                alertString.ReplaceFirst("%app", app.name);
     3492                alertString.ReplaceFirst("%library", loaderErrorString.String());
     3493            } else {
     3494                alertString.SetTo(B_TRANSLATE("Could not open \"%document\" (Missing libraries: %library). \n"));
     3495                alertString.ReplaceFirst("%document", documentRef.name);
     3496                alertString.ReplaceFirst("%library", loaderErrorString.String());
     3497            }
     3498            alternative = B_TRANSLATE(kFindAlternativeStr);
    33863499        } else {
    3387             alertString << "Could not open \"" << documentRef.name
    3388                 << "\" with application \"" << app.name << "\" ("
    3389                 << strerror(error) << "). ";
    3390             alternative = kFindAlternativeStr;
     3500            alertString.SetTo(B_TRANSLATE("Could not open \"%document\" with application \"%app\" (%error). "));
     3501                alertString.ReplaceFirst("%document", documentRef.name);
     3502                alertString.ReplaceFirst("%app", app.name);
     3503                alertString.ReplaceFirst("%error", strerror(error));
     3504            alternative = B_TRANSLATE(kFindAlternativeStr);
    33913505        }
    33923506    }
    33933507
     
    33953509        if (openWithOK) {
    33963510            ASSERT(alternative);
    33973511            alertString << alternative;
    3398             BAlert *alert = new BAlert("", alertString.String(),
    3399                 "Cancel", "Find", 0, B_WIDTH_AS_USUAL,
    3400                 B_WARNING_ALERT);
     3512            BAlert* alert = new BAlert("", alertString.String(),
     3513                B_TRANSLATE("Cancel"),
     3514                B_TRANSLATE("Find"),
     3515                0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    34013516            alert->SetShortcut(0, B_ESCAPE);
    34023517            if (alert->Go() == 1)
    34033518                error = TrackerOpenWith(refs);
    34043519        } else {
    3405             BAlert *alert = new BAlert("", alertString.String(),
    3406                 "Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     3520            BAlert* alert = new BAlert("", alertString.String(),
     3521                B_TRANSLATE("Cancel"),
     3522                0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    34073523            alert->SetShortcut(0, B_ESCAPE);
    34083524            alert->Go();
    34093525        }
  • StatusWindow.cpp

     
    3939
    4040#include <Application.h>
    4141#include <Button.h>
     42#include <Catalog.h>
    4243#include <ControlLook.h>
    4344#include <Debug.h>
     45#include <Locale.h>
    4446#include <MessageFilter.h>
    4547#include <StringView.h>
    4648#include <String.h>
     
    182184// #pragma mark - BStatusWindow
    183185
    184186
     187#undef B_TRANSLATE_CONTEXT
     188#define B_TRANSLATE_CONTEXT "libTracker"
     189
     190
    185191BStatusWindow::BStatusWindow()
    186192    :
    187     BWindow(kStatusRect, "Tracker status", B_TITLED_WINDOW,
     193    BWindow(kStatusRect,
     194        B_TRANSLATE("Tracker status"),
     195        B_TITLED_WINDOW,
    188196        B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE,
    189197        B_ALL_WORKSPACES),
    190198    fRetainDesktopFocus(false)
     
    446454    rect.top += 6;
    447455    rect.bottom = rect.top + 15;
    448456
    449     const char* caption = NULL;
     457    BString caption;
    450458    int32 id = 0;
    451459
    452460    switch (type) {
    453461        case kCopyState:
    454             caption = "Preparing to copy items" B_UTF8_ELLIPSIS;
     462            caption = B_TRANSLATE("Preparing to copy items" B_UTF8_ELLIPSIS);
    455463            id = R_CopyStatusBitmap;
    456464            break;
    457465
    458466        case kMoveState:
    459             caption = "Preparing to move items" B_UTF8_ELLIPSIS;
     467            caption = B_TRANSLATE("Preparing to move items" B_UTF8_ELLIPSIS);
    460468            id = R_MoveStatusBitmap;
    461469            break;
    462470
    463471        case kCreateLinkState:
    464             caption = "Preparing to create links" B_UTF8_ELLIPSIS;
     472            caption = B_TRANSLATE("Preparing to create links" B_UTF8_ELLIPSIS);
    465473            id = R_MoveStatusBitmap;
    466474            break;
    467475
    468476        case kTrashState:
    469             caption = "Preparing to empty Trash" B_UTF8_ELLIPSIS;
     477            caption = B_TRANSLATE("Preparing to empty Trash" B_UTF8_ELLIPSIS);
    470478            id = R_TrashStatusBitmap;
    471479            break;
    472480
    473481        case kVolumeState:
    474             caption = "Searching for disks to mount" B_UTF8_ELLIPSIS;
     482            caption = B_TRANSLATE("Searching for disks to mount" B_UTF8_ELLIPSIS);
    475483            break;
    476484
    477485        case kDeleteState:
    478             caption = "Preparing to delete items" B_UTF8_ELLIPSIS;
     486            caption = B_TRANSLATE("Preparing to delete items" B_UTF8_ELLIPSIS);
    479487            id = R_TrashStatusBitmap;
    480488            break;
    481489
    482490        case kRestoreFromTrashState:
    483             caption = "Preparing to restore items" B_UTF8_ELLIPSIS;
     491            caption = B_TRANSLATE("Preparing to restore items" B_UTF8_ELLIPSIS);
    484492            break;
    485493
    486494        default:
     
    488496            break;
    489497    }
    490498
    491     if (caption != NULL) {
    492         fStatusBar = new BStatusBar(rect, "StatusBar", caption);
     499    if (caption.Length()) {
     500        fStatusBar = new BStatusBar(rect, "StatusBar", caption.String());
    493501        fStatusBar->SetBarHeight(12);
    494502        float width, height;
    495503        fStatusBar->GetPreferredSize(&width, &height);
     
    572580    }
    573581
    574582    BString buffer;
    575     if (totalItems > 0)
    576         buffer << "of " << totalItems;
     583    if (totalItems > 0) {
     584        char totalStr[16];
     585        buffer.SetTo(B_TRANSLATE("of %totalitems"));
     586        sprintf(totalStr, "%ld",  totalItems);
     587        buffer.ReplaceFirst("%totalitems", totalStr);
     588    }
    577589
    578590    switch (fType) {
    579591        case kCopyState:
    580             fStatusBar->Reset("Copying: ", buffer.String());
     592            fStatusBar->Reset(
     593                B_TRANSLATE("Copying: "),
     594                buffer.String());
    581595            break;
    582596
    583597        case kCreateLinkState:
    584             fStatusBar->Reset("Creating links: ", buffer.String());
     598            fStatusBar->Reset(
     599                B_TRANSLATE("Creating links: "),
     600                buffer.String());
    585601            break;
    586602
    587603        case kMoveState:
    588             fStatusBar->Reset("Moving: ", buffer.String());
     604            fStatusBar->Reset(
     605                B_TRANSLATE("Moving: "),
     606                buffer.String());
    589607            break;
    590608
    591609        case kTrashState:
    592             fStatusBar->Reset("Emptying Trash" B_UTF8_ELLIPSIS " ",
     610            fStatusBar->Reset(
     611                B_TRANSLATE("Emptying Trash" B_UTF8_ELLIPSIS " "),
    593612                buffer.String());
    594613            break;
    595614
    596615        case kDeleteState:
    597             fStatusBar->Reset("Deleting: ", buffer.String());
     616            fStatusBar->Reset(
     617                B_TRANSLATE("Deleting: "),
     618                buffer.String());
    598619            break;
    599620
    600621        case kRestoreFromTrashState:
    601             fStatusBar->Reset("Restoring: ", buffer.String());
     622            fStatusBar->Reset(
     623                B_TRANSLATE("Restoring: "),
     624                buffer.String());
    602625            break;
    603626
    604627        default:
     
    650673    tp.y += ceilf(fh.leading) + ceilf(fh.ascent);
    651674
    652675    if (IsPaused())
    653         DrawString("Paused: click to resume or stop", tp);
     676        DrawString(
     677            B_TRANSLATE("Paused: click to resume or stop"),
     678            tp);
    654679    else if (fDestDir.Length()) {
    655680        BString buffer;
    656681        buffer << "To: " << fDestDir;
     
    722747                    2, time->tm_hour, 2, time->tm_min);
    723748            }
    724749
    725             BString buffer1("Finish: ");
    726             buffer1 << timeText;
    727750            finishTime -= now;
    728751            time = gmtime(&finishTime);
     752            char finishStr[16];
    729753
    730             BString buffer2;
    731             if (finishTime > secondsPerDay)
    732                 buffer2 << "Over " << finishTime / secondsPerDay << " days";
    733             else if (finishTime > 60 * 60)
    734                 buffer2 << "Over " << finishTime / (60 * 60) << " hours";
    735             else if (finishTime > 60)
    736                 buffer2 << finishTime / 60 << " minutes";
    737             else
    738                 buffer2 << finishTime << " seconds";
     754            if (finishTime > secondsPerDay) {
     755                buffer.SetTo(B_TRANSLATE("(Finish: %time - Over %finishtime days left)"));
     756                sprintf(finishStr, "%ld", finishTime / secondsPerDay);
     757            } else if (finishTime > 60 * 60) {
     758                buffer.SetTo(B_TRANSLATE("(Finish: %time - Over %finishtime hours left)"));
     759                sprintf(finishStr, "%ld", finishTime / (60 * 60));
     760            } else if (finishTime > 60) {
     761                buffer.SetTo(B_TRANSLATE("(Finish: %time - %finishtime minutes left)"));
     762                sprintf(finishStr, "%ld", finishTime / 60);
     763            } else {
     764                buffer.SetTo(B_TRANSLATE("(Finish: %time - %finishtime seconds left)"));
     765                sprintf(finishStr, "%ld", finishTime);
     766            }
    739767
    740             buffer2 << " left";
     768        buffer.ReplaceFirst("%time", timeText);
     769        buffer.ReplaceFirst("%finishtime", finishStr);
    741770
    742             buffer = "(";
    743             buffer << buffer1 << " - " << buffer2 << ")";
    744771            tp.x = fStatusBar->Frame().right - StringWidth(buffer.String());
    745772            if (tp.x > rightDivider)
    746773                DrawString(buffer.String(), tp);
    747774            else {
    748775                // complete string too wide, try with shorter version
    749                 buffer = "(";
    750                 buffer << buffer1 << ")";
     776                buffer.SetTo(B_TRANSLATE("(Finish: %time)"));
     777                buffer.ReplaceFirst("%time", timeText);
    751778                tp.x = fStatusBar->Frame().right - StringWidth(buffer.String());
    752779                if (tp.x > rightDivider)
    753780                    DrawString(buffer.String(), tp);
  • SlowContextPopup.cpp

     
    3838#include <Debug.h>
    3939
    4040#include <Application.h>
     41#include <Catalog.h>
    4142#include <Directory.h>
     43#include <Locale.h>
    4244#include <Path.h>
    4345#include <Query.h>
    4446#include <StopWatch.h>
     
    6062#include "Tracker.h"
    6163
    6264
     65
     66#undef B_TRANSLATE_CONTEXT
     67#define B_TRANSLATE_CONTEXT "libTracker"
     68
    6369BSlowContextMenu::BSlowContextMenu(const char *title)
    6470    :   BPopUpMenu(title, false, false),
    6571        fMenuBuilt(false),
     
    490496    fItemList->MakeEmpty();
    491497
    492498    if (!count) {
    493         BMenuItem *item = new BMenuItem("Empty folder", 0);
     499        BMenuItem* item = new BMenuItem(
     500            B_TRANSLATE("Empty folder"),
     501            0);
    494502        item->SetEnabled(false);
    495503        AddItem(item);
    496504    }
  • DeskWindow.cpp

     
    3232All rights reserved.
    3333*/
    3434
     35#include <Catalog.h>
    3536#include <Debug.h>
    3637#include <FindDirectory.h>
     38#include <Locale.h>
    3739#include <NodeMonitor.h>
    3840#include <Path.h>
    3941#include <PopUpMenu.h>
     
    103105
    104106// #pragma mark -
    105107
     108#undef B_TRANSLATE_CONTEXT
     109#define B_TRANSLATE_CONTEXT "libTracker"
    106110
    107111BDeskWindow::BDeskWindow(LockingList<BWindow> *windowList)
    108112    :
     
    266270void
    267271BDeskWindow::AddWindowContextMenus(BMenu *menu)
    268272{
    269     TemplatesMenu *tempateMenu = new TemplatesMenu(PoseView());
     273    TemplatesMenu* tempateMenu = new TemplatesMenu(PoseView(),
     274        B_TRANSLATE("New"));
    270275
    271276    menu->AddItem(tempateMenu);
    272277    tempateMenu->SetTargetForItems(PoseView());
     
    274279
    275280    menu->AddSeparatorItem();
    276281
    277     BMenu* iconSizeMenu = new BMenu("Icon view");
     282    BMenu* iconSizeMenu = new BMenu(
     283        B_TRANSLATE("Icon view"));
    278284
    279285    BMessage* message = new BMessage(kIconMode);
    280286    message->AddInt32("size", 32);
    281     BMenuItem* item = new BMenuItem("32 x 32", message);
     287    BMenuItem* item = new BMenuItem(
     288        B_TRANSLATE("32 x 32"), message);
    282289    item->SetMarked(PoseView()->IconSizeInt() == 32);
    283290    item->SetTarget(PoseView());
    284291    iconSizeMenu->AddItem(item);
    285292
    286293    message = new BMessage(kIconMode);
    287294    message->AddInt32("size", 40);
    288     item = new BMenuItem("40 x 40", message);
     295    item = new BMenuItem(
     296        B_TRANSLATE("40 x 40"), message);
    289297    item->SetMarked(PoseView()->IconSizeInt() == 40);
    290298    item->SetTarget(PoseView());
    291299    iconSizeMenu->AddItem(item);
    292300
    293301    message = new BMessage(kIconMode);
    294302    message->AddInt32("size", 48);
    295     item = new BMenuItem("48 x 48", message);
     303    item = new BMenuItem(
     304        B_TRANSLATE("48 x 48"), message);
    296305    item->SetMarked(PoseView()->IconSizeInt() == 48);
    297306    item->SetTarget(PoseView());
    298307    iconSizeMenu->AddItem(item);
    299308
    300309    message = new BMessage(kIconMode);
    301310    message->AddInt32("size", 64);
    302     item = new BMenuItem("64 x 64", message);
     311    item = new BMenuItem(
     312        B_TRANSLATE("64 x 64"), message);
    303313    item->SetMarked(PoseView()->IconSizeInt() == 64);
    304314    item->SetTarget(PoseView());
    305315    iconSizeMenu->AddItem(item);
     
    308318
    309319    message = new BMessage(kIconMode);
    310320    message->AddInt32("scale", 0);
    311     item = new BMenuItem("Decrease size", message, '-');
     321    item = new BMenuItem(
     322        B_TRANSLATE("Decrease size"), message, '-');
    312323    item->SetTarget(PoseView());
    313324    iconSizeMenu->AddItem(item);
    314325
    315326    message = new BMessage(kIconMode);
    316327    message->AddInt32("scale", 1);
    317     item = new BMenuItem("Increase size", message, '+');
     328    item = new BMenuItem(
     329        B_TRANSLATE("Increase size"), message, '+');
    318330    item->SetTarget(PoseView());
    319331    iconSizeMenu->AddItem(item);
    320332
     
    325337    iconSizeMenu->Superitem()->SetTarget(PoseView());
    326338    iconSizeMenu->Superitem()->SetMarked(PoseView()->ViewMode() == kIconMode);
    327339
    328     item = new BMenuItem("Mini icon view", new BMessage(kMiniIconMode), '2');
     340    item = new BMenuItem(
     341        B_TRANSLATE("Mini icon view"),
     342        new BMessage(kMiniIconMode), '2');
    329343    item->SetMarked(PoseView()->ViewMode() == kMiniIconMode);
    330344    menu->AddItem(item);
    331345
    332346    menu->AddSeparatorItem();
    333347
    334348#ifdef CUT_COPY_PASTE_IN_CONTEXT_MENU
    335     BMenuItem *pasteItem;
    336     menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
     349    BMenuItem* pasteItem;
     350    menu->AddItem(pasteItem = new BMenuItem(
     351        B_TRANSLATE("Paste"),
     352        new BMessage(B_PASTE), 'V'));
    337353    menu->AddSeparatorItem();
    338354#endif
    339     menu->AddItem(new BMenuItem("Clean up", new BMessage(kCleanup), 'K'));
    340     menu->AddItem(new BMenuItem("Select"B_UTF8_ELLIPSIS,
     355    menu->AddItem(
     356        new BMenuItem(B_TRANSLATE("Clean up"),
     357        new BMessage(kCleanup), 'K'));
     358    menu->AddItem(new BMenuItem(
     359        B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
    341360        new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
    342     menu->AddItem(new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
     361    menu->AddItem(
     362        new BMenuItem(B_TRANSLATE("Select all"),
     363        new BMessage(B_SELECT_ALL), 'A'));
    343364
    344365    menu->AddSeparatorItem();
    345     menu->AddItem(new MountMenu("Mount"));
     366    menu->AddItem(
     367        new MountMenu(B_TRANSLATE("Mount")));
    346368
    347369    menu->AddSeparatorItem();
    348     menu->AddItem(new BMenu(kAddOnsMenuName));
     370    menu->AddItem(
     371        new BMenu(B_TRANSLATE("Add-ons")));
    349372
    350373    // target items as needed
    351374    menu->SetTargetForItems(PoseView());
  • Jamfile

     
    33SetSubDirSupportedPlatformsBeOSCompatible ;
    44AddSubDirSupportedPlatforms libbe_test ;
    55
    6 UsePrivateHeaders interface mount shared storage tracker ;
     6UsePrivateHeaders interface libbe mount shared storage tracker ;
    77
    88UseLibraryHeaders icon ;
    99
    10 AddResources libtracker.so : TrackerIcons.rdef ;
     10AddResources libtracker.so : TrackerIcons.rdef libTracker.rdef ;
    1111
    1212SubDirC++Flags
    1313    -D_BUILDING_tracker=1 -DOPEN_TRACKER=1
     
    9191    VolumeWindow.cpp
    9292    WidgetAttributeText.cpp
    9393
    94     : be translation $(vector_icon_libs) $(TARGET_LIBSTDC++) libshared.a
    95 
     94    : be translation $(vector_icon_libs) $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS) libshared.a
    9695    ;
    9796
     97DoCatalogs libtracker.so :
     98    x-vnd.Haiku-libTracker
     99    :
     100    Tracker.cpp
     101    AutoMounterSettings.cpp
     102    ContainerWindow.cpp
     103    CountView.cpp
     104    DeskWindow.cpp
     105    DirMenu.cpp
     106    FavoritesMenu.cpp
     107    FilePanelPriv.cpp
     108    FilePermissionsView.cpp
     109    FindPanel.cpp
     110    FSClipboard.cpp
     111    FSUtils.cpp
     112    InfoWindow.cpp
     113    Model.cpp
     114    MountMenu.cpp
     115    NavMenu.cpp
     116    OpenWithWindow.cpp
     117    PoseView.cpp
     118    QueryContainerWindow.cpp
     119    QueryPoseView.cpp
     120    SelectionWindow.cpp
     121    SettingsViews.cpp
     122    SlowContextPopup.cpp
     123    StatusWindow.cpp
     124    TemplatesMenu.cpp
     125    Tracker.cpp
     126    TrackerInitialState.cpp
     127    TrackerSettingsWindow.cpp
     128    VolumeWindow.cpp
     129    WidgetAttributeText.cpp
     130;
     131
     132
    98133if $(TARGET_PLATFORM) = libbe_test {
    99134    HaikuInstall install-test-apps : $(HAIKU_APP_TEST_LIB_DIR) : libtracker.so
    100135        : tests!apps ;
  • QueryPoseView.cpp

     
    3535
    3636#include <new>
    3737
     38#include <Catalog.h>
    3839#include <Debug.h>
     40#include <Locale.h>
    3941#include <NodeMonitor.h>
    4042#include <Query.h>
    4143#include <Volume.h>
     
    5456
    5557#include <fs_attr.h>
    5658
     59
     60
     61#undef B_TRANSLATE_CONTEXT
     62#define B_TRANSLATE_CONTEXT "libTracker"
     63
    5764using std::nothrow;
    5865
    5966// Currently filtering out Trash doesn't node monitor too well - if you
     
    113120    if (fColumnList->CountItems() != 0)
    114121        return;
    115122
    116     fColumnList->AddItem(new BColumn("Name", kColumnStart, 145, B_ALIGN_LEFT,
     123    fColumnList->AddItem(new BColumn(
     124        B_TRANSLATE("Name"),
     125        kColumnStart, 145, B_ALIGN_LEFT,
    117126        kAttrStatName, B_STRING_TYPE, true, true));
    118     fColumnList->AddItem(new BColumn("Location", 200, 225, B_ALIGN_LEFT,
     127    fColumnList->AddItem(
     128        new BColumn(B_TRANSLATE("Location"),
     129        200, 225, B_ALIGN_LEFT,
    119130        kAttrPath, B_STRING_TYPE, true, false));
    120     fColumnList->AddItem(new BColumn("Size", 440, 80, B_ALIGN_RIGHT,
     131    fColumnList->AddItem(new BColumn(
     132        B_TRANSLATE("Size"),
     133        440, 80, B_ALIGN_RIGHT,
    121134        kAttrStatSize, B_OFF_T_TYPE, true, false));
    122     fColumnList->AddItem(new BColumn("Modified", 535, 150, B_ALIGN_LEFT,
     135    fColumnList->AddItem(new BColumn(
     136        B_TRANSLATE("Modified"),
     137        535, 150, B_ALIGN_LEFT,
    123138        kAttrStatModified, B_TIME_TYPE, true, false));
    124139}
    125140
  • FSClipboard.cpp

     
    3535#include "FSClipboard.h"
    3636#include <Clipboard.h>
    3737#include <Alert.h>
     38#include <Catalog.h>
     39#include <Locale.h>
    3840#include <NodeMonitor.h>
    3941#include "Commands.h"
    4042#include "FSUtils.h"
    4143#include "Tracker.h"
    4244
     45
    4346// prototypes
    4447static void MakeNodeFromName(node_ref *node, char *name);
    4548static inline void MakeRefName(char *refName, const node_ref *node);
     
    4952
    5053
    5154//these are from PoseView.cpp
    52 extern const char *kNoCopyToTrashStr;
    53 extern const char *kNoCopyToRootStr;
    54 extern const char *kOkToMoveStr;
     55//extern const char* kNoCopyToTrashStr;
     56// extern const char *kOkToMoveStr;
    5557
    5658/*
    5759static bool
     
    111113//  #pragma mark -
    112114
    113115
     116#undef B_TRANSLATE_CONTEXT
     117#define B_TRANSLATE_CONTEXT "libTracker"
     118
    114119bool
    115120FSClipboardHasRefs()
    116121{
     
    468473
    469474    // can't copy/paste to root('/') directory
    470475    if (model->IsRoot()) {
    471         BAlert *alert = new BAlert("", kNoCopyToRootStr, "Cancel",
     476        BAlert* alert = new BAlert("",
     477            B_TRANSLATE("You must drop items on one of the disk icons "
     478    "in the \"Disks\" window."),
     479            B_TRANSLATE("Cancel"),
    472480            NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    473481        alert->SetShortcut(0, B_ESCAPE);
    474482        alert->Go();
     
    480488
    481489    // can't copy items into the trash
    482490    if (copyList->CountItems() > 0 && model->IsTrash()) {
    483         BAlert *alert = new BAlert("", kNoCopyToTrashStr, "Cancel",
     491        BAlert* alert = new BAlert("",
     492            B_TRANSLATE("Sorry, you can't copy items to the Trash."),
     493            B_TRANSLATE("Cancel"),
    484494            NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    485495        alert->SetShortcut(0, B_ESCAPE);
    486496        alert->Go();
  • PoseView.cpp

     
    4343
    4444#include <Alert.h>
    4545#include <Application.h>
     46#include <Catalog.h>
    4647#include <Clipboard.h>
    4748#include <Debug.h>
    4849#include <Dragger.h>
     
    5152#include <Screen.h>
    5253#include <Query.h>
    5354#include <List.h>
     55#include <Locale.h>
    5456#include <MenuItem.h>
    5557#include <NodeMonitor.h>
    5658#include <Path.h>
     
    9395#include "WidthBuffer.h"
    9496
    9597
     98#undef B_TRANSLATE_CONTEXT
     99#define B_TRANSLATE_CONTEXT "libTracker"
     100
    96101using std::min;
    97102using std::max;
    98103
     
    40834088        } else if (types)
    40844089            description = embedTypeAs;
    40854090
    4086         const char *labelText;
    4087         char text[1024];
     4091        BString labelText;
    40884092        if (actionText) {
    40894093            int32 length = 1024 - 1 - (int32)strlen(actionText);
    40904094            if (length > 0) {
    40914095                description.Truncate(length);
    4092                 sprintf(text, actionText, description.String());
    4093                 labelText = text;
     4096                labelText.SetTo(actionText);
     4097                labelText.ReplaceFirst("%s", description.String());
    40944098            } else
    4095                 labelText = "label too long";
     4099                labelText.SetTo(B_TRANSLATE("label too long"));
    40964100        } else
    4097             labelText = description.String();
     4101            labelText = description;
    40984102
    4099         menu->AddItem(new BMenuItem(labelText, 0));
     4103        menu->AddItem(new BMenuItem(labelText.String(), 0));
    41004104    }
    41014105
    41024106    menu->AddSeparatorItem();
    4103     menu->AddItem(new BMenuItem("Cancel", 0));
     4107    menu->AddItem(new BMenuItem(B_TRANSLATE("Cancel"), 0));
    41044108
    41054109    int32 result = -1;
    41064110    BMenuItem *resultingItem = menu->Go(where, false, true);
     
    42544258                        if (specificActionIndex == -1)
    42554259                            return false;
    42564260                    } else if (types.CountItems() > 0) {
    4257                         specificTypeIndex = RunMimeTypeDestinationMenu("Create %s clipping",
     4261                        specificTypeIndex = RunMimeTypeDestinationMenu(
     4262                            B_TRANSLATE("Create %s clipping"),
    42584263                            &types, &typeNames, view->ConvertToScreen(dropPt));
    42594264
    42604265                        if (specificTypeIndex == -1)
  • AutoMounterSettings.cpp

     
    3737#include <Alert.h>
    3838#include <Box.h>
    3939#include <Button.h>
     40#include <Catalog.h>
    4041#include <CheckBox.h>
    4142#include <Debug.h>
    4243#include <GridLayoutBuilder.h>
    4344#include <GroupLayoutBuilder.h>
     45#include <Locale.h>
    4446#include <SpaceLayoutItem.h>
    4547#include <SeparatorView.h>
    4648#include <Message.h>
     
    5456const uint32 kBootMountSettingsChanged = 'bchg';
    5557const uint32 kEjectWhenUnmountingChanged = 'ejct';
    5658
     59#undef B_TRANSLATE_CONTEXT
     60#define B_TRANSLATE_CONTEXT "libTracker"
    5761
    5862class AutomountSettingsPanel : public BBox {
    5963public:
     
    103107
    104108    BBox* autoMountBox = new BBox("autoMountBox", B_WILL_DRAW | B_FRAME_EVENTS
    105109        | B_PULSE_NEEDED | B_NAVIGABLE_JUMP);
    106     autoMountBox->SetLabel("Automatic disk mounting");
     110    autoMountBox->SetLabel(B_TRANSLATE("Automatic disk mounting"));
    107111    BGroupLayout* autoMountLayout = new BGroupLayout(B_VERTICAL, spacing);
    108112    autoMountBox->SetLayout(autoMountLayout);
    109113    autoMountLayout->SetInsets(spacing,
    110114        autoMountBox->InnerFrame().top + spacing, spacing, spacing);
    111115
    112     fScanningDisabledCheck = new BRadioButton("scanningOff", "Don't automount",
     116    fScanningDisabledCheck = new BRadioButton("scanningOff",
     117        B_TRANSLATE("Don't automount"),
    113118        new BMessage(kAutomountSettingsChanged));
    114119
    115     fAutoMountAllBFSCheck = new BRadioButton("autoBFS", "All BeOS disks",
     120    fAutoMountAllBFSCheck = new BRadioButton("autoBFS",
     121        B_TRANSLATE("All BeOS disks"),
    116122        new BMessage(kAutomountSettingsChanged));
    117123
    118     fAutoMountAllCheck = new BRadioButton("autoAll", "All disks",
     124    fAutoMountAllCheck = new BRadioButton("autoAll",
     125        B_TRANSLATE("All disks"),
    119126        new BMessage(kAutomountSettingsChanged));
    120127
    121128    // "Disk Mounting During Boot" group
    122129
    123130    BBox* bootMountBox = new BBox("", B_WILL_DRAW | B_FRAME_EVENTS
    124131        | B_PULSE_NEEDED | B_NAVIGABLE_JUMP);
    125     bootMountBox->SetLabel("Disk mounting during boot");
     132    bootMountBox->SetLabel(B_TRANSLATE("Disk mounting during boot"));
    126133    BGroupLayout* bootMountLayout = new BGroupLayout(B_VERTICAL, spacing);
    127134    bootMountBox->SetLayout(bootMountLayout);
    128135    bootMountLayout->SetInsets(spacing,
    129136        bootMountBox->InnerFrame().top + spacing, spacing, spacing);
    130137
    131138    fInitialDontMountCheck = new BRadioButton("initialNone",
    132         "Only the boot disk", new BMessage(kBootMountSettingsChanged));
     139        B_TRANSLATE("Only the boot disk"),
     140        new BMessage(kBootMountSettingsChanged));
    133141
    134142    fInitialMountRestoreCheck = new BRadioButton("initialRestore",
    135         "Previously mounted disks", new BMessage(kBootMountSettingsChanged));
     143        B_TRANSLATE("Previously mounted disks"),
     144        new BMessage(kBootMountSettingsChanged));
    136145
    137146    fInitialMountAllBFSCheck = new BRadioButton("initialBFS",
    138         "All BeOS disks", new BMessage(kBootMountSettingsChanged));
     147        B_TRANSLATE("All BeOS disks"),
     148        new BMessage(kBootMountSettingsChanged));
    139149
    140150    fInitialMountAllCheck = new BRadioButton("initialAll",
    141         "All disks", new BMessage(kBootMountSettingsChanged));
     151        B_TRANSLATE("All disks"),
     152        new BMessage(kBootMountSettingsChanged));
    142153
    143154    fEjectWhenUnmountingCheckBox = new BCheckBox("ejectWhenUnmounting",
    144         "Eject when unmounting", new BMessage(kEjectWhenUnmountingChanged));
     155        B_TRANSLATE("Eject when unmounting"),
     156        new BMessage(kEjectWhenUnmountingChanged));
    145157
    146158    // Buttons
    147159
    148     fDone = new BButton("Done", new BMessage(B_QUIT_REQUESTED));
     160    fDone = new BButton(B_TRANSLATE("Done"),
     161        new BMessage(B_QUIT_REQUESTED));
    149162
    150     fMountAllNow = new BButton("mountAll", "Mount all disks now",
     163    fMountAllNow = new BButton("mountAll",
     164        B_TRANSLATE("Mount all disks now"),
    151165        new BMessage(kMountAllNow));
    152166
    153167    fDone->MakeDefault(true);
     
    292306AutomountSettingsDialog::AutomountSettingsDialog(BMessage* settings,
    293307        const BMessenger& target)
    294308    :
    295     BWindow(BRect(100, 100, 320, 370), "Disk mount settings",
     309    BWindow(BRect(100, 100, 320, 370),
     310        B_TRANSLATE("Disk mount settings"),
    296311        B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
    297312            | B_AUTO_UPDATE_SIZE_LIMITS)
    298313{
     
    325340    BMessage reply;
    326341    status_t ret = target.SendMessage(&message, &reply, 2500000);
    327342    if (ret != B_OK) {
    328         (new BAlert("Mount server error", "The mount server could not be "
    329             "contacted.", "OK", NULL, NULL, B_WIDTH_AS_USUAL,
    330             B_STOP_ALERT))->Go();
     343        (new BAlert(B_TRANSLATE("Mount server error"),
     344            B_TRANSLATE("The mount server could not be  contacted."),
     345            B_TRANSLATE("OK"),
     346            NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
    331347        return;
    332348    }
    333349
  • ContainerWindow.cpp

     
    3939#include <Alert.h>
    4040#include <Application.h>
    4141#include <AppFileInfo.h>
     42#include <Catalog.h>
    4243#include <ControlLook.h>
    4344#include <Debug.h>
    4445#include <Directory.h>
    4546#include <Entry.h>
    4647#include <FindDirectory.h>
    4748#include <InterfaceDefs.h>
     49#include <Locale.h>
    4850#include <MenuItem.h>
    4951#include <MenuBar.h>
    5052#include <NodeMonitor.h>
     
    8991#include "TemplatesMenu.h"
    9092
    9193
     94#undef B_TRANSLATE_CONTEXT
     95#define B_TRANSLATE_CONTEXT "libTracker"
     96
    9297const uint32 kRedo = 'REDO';
    9398    // this is the same as B_REDO in Dano/Zeta/Haiku
    9499
     
    103108
    104109namespace BPrivate {
    105110
    106 const char *kAddOnsMenuName = "Add-ons";
    107 
    108111class DraggableContainerIcon : public BView {
    109112    public:
    110113        DraggableContainerIcon(BRect rect, const char *name, uint32 resizeMask);
     
    261264            result = addonImage;
    262265    }
    263266
    264     char buffer[1024];
    265     sprintf(buffer, "Error %s loading Add-On %s.", strerror(result), addonRef.name);
     267    BString buffer(B_TRANSLATE("Error %error loading Add-On %name."));
     268    buffer.ReplaceFirst("%error", strerror(result));
     269    buffer.ReplaceFirst("%name", addonRef.name);
    266270
    267     BAlert *alert = new BAlert("", buffer, "Cancel", 0, 0,
    268         B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     271    BAlert* alert = new BAlert("", buffer.String(),
     272        B_TRANSLATE("Cancel"),
     273        0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    269274    alert->SetShortcut(0, B_ESCAPE);
    270275    alert->Go();
    271276
     
    406411    float height = fontHeight.ascent + fontHeight.descent + fontHeight.leading + 2
    407412        + Bounds().Height() + 8;
    408413
    409     BRect rect(0, 0, max_c(Bounds().Width(), font.StringWidth(model->Name()) + 4), height);
    410     BBitmap *dragBitmap = new BBitmap(rect, B_RGBA32, true);
     414    BRect rect(0, 0, max_c(Bounds().Width(),
     415        font.StringWidth(model->Name()) + 4), height);
     416    BBitmap* dragBitmap = new BBitmap(rect, B_RGBA32, true);
    411417
    412418    dragBitmap->Lock();
    413419    BView *view = new BView(dragBitmap->Bounds(), "", B_FOLLOW_NONE, 0);
     
    853859
    854860    fMenuBar->RemoveItem(fFileMenu);
    855861    delete fFileMenu;
    856     fFileMenu = new BMenu("File");
     862    fFileMenu = new BMenu(B_TRANSLATE("File"));
    857863    AddFileMenu(fFileMenu);
    858864    fMenuBar->AddItem(fFileMenu);
    859865
    860866    fMenuBar->RemoveItem(fWindowMenu);
    861867    delete fWindowMenu;
    862     fWindowMenu = new BMenu("Window");
     868    fWindowMenu = new BMenu(B_TRANSLATE("Window"));
    863869    fMenuBar->AddItem(fWindowMenu);
    864870    AddWindowMenu(fWindowMenu);
    865871
    866872    // just create the attribute, decide to add it later
    867873    fMenuBar->RemoveItem(fAttrMenu);
    868874    delete fAttrMenu;
    869     fAttrMenu = new BMenu("Attributes");
     875    fAttrMenu = new BMenu(B_TRANSLATE("Attributes"));
    870876    NewAttributeMenu(fAttrMenu);
    871877    if (PoseView()->ViewMode() == kListMode)
    872878        ShowAttributeMenu();
     
    897903    if (ShouldAddScrollBars())
    898904        fPoseView->AddScrollBars();
    899905
    900     fMoveToItem = new BMenuItem(new BNavMenu("Move to", kMoveSelectionTo, this));
    901     fCopyToItem = new BMenuItem(new BNavMenu("Copy to", kCopySelectionTo, this));
    902     fCreateLinkItem = new BMenuItem(new BNavMenu("Create link", kCreateLink, this),
    903         new BMessage(kCreateLink));
     906    fMoveToItem = new BMenuItem(new BNavMenu(B_TRANSLATE("Move to"),
     907        kMoveSelectionTo, this));
     908    fCopyToItem = new BMenuItem(new BNavMenu(B_TRANSLATE("Copy to"),
     909        kCopySelectionTo, this));
     910    fCreateLinkItem = new BMenuItem(new BNavMenu(B_TRANSLATE("Create link"),
     911        kCreateLink, this), new BMessage(kCreateLink));
    904912
    905913    TrackerSettings settings;
    906914
     
    16351643
    16361644                            BMenuItem *item = fFileContextMenu->FindItem(kMoveToTrash);
    16371645                            if (item)
    1638                                 item->SetLabel(dontMoveToTrash ? "Delete" : "Move to Trash");
     1646                                item->SetLabel(dontMoveToTrash
     1647                                    ? B_TRANSLATE("Delete")
     1648                                    : B_TRANSLATE("Move to Trash"));
    16391649
    16401650                            // Deskbar doesn't have a menu bar, so check if there is fMenuBar
    16411651                            if (fMenuBar && fFileMenu) {
    16421652                                item = fFileMenu->FindItem(kMoveToTrash);
    16431653                                if (item)
    1644                                     item->SetLabel(dontMoveToTrash ? "Delete" : "Move to Trash");
     1654                                    item->SetLabel(dontMoveToTrash
     1655                                        ? B_TRANSLATE("Delete")
     1656                                        : B_TRANSLATE("Move to Trash"));
    16451657                            }
    16461658                            UpdateIfNeeded();
    16471659                        }
     
    16851697        || PoseView() != CurrentFocus());
    16861698
    16871699    if (modifiers() & B_SHIFT_KEY) {
    1688         item->SetLabel("Cut more");
     1700        item->SetLabel(B_TRANSLATE("Cut more"));
    16891701        item->SetShortcut('X', B_COMMAND_KEY | B_SHIFT_KEY);
    16901702        item->SetMessage(new BMessage(kCutMoreSelectionToClipboard));
    16911703    } else {
    1692         item->SetLabel("Cut");
     1704        item->SetLabel(B_TRANSLATE("Cut"));
    16931705        item->SetShortcut('X', B_COMMAND_KEY);
    16941706        item->SetMessage(new BMessage(B_CUT));
    16951707    }
     
    17081720        || PoseView() != CurrentFocus());
    17091721
    17101722    if (modifiers() & B_SHIFT_KEY) {
    1711         item->SetLabel("Copy more");
     1723        item->SetLabel(B_TRANSLATE("Copy more"));
    17121724        item->SetShortcut('C', B_COMMAND_KEY | B_SHIFT_KEY);
    17131725        item->SetMessage(new BMessage(kCopyMoreSelectionToClipboard));
    17141726    } else {
    1715         item->SetLabel("Copy");
     1727        item->SetLabel(B_TRANSLATE("Copy"));
    17161728        item->SetShortcut('C', B_COMMAND_KEY);
    17171729        item->SetMessage(new BMessage(B_COPY));
    17181730    }
     
    17301742    item->SetEnabled(FSClipboardHasRefs() || PoseView() != CurrentFocus());
    17311743
    17321744    if (modifiers() & B_SHIFT_KEY) {
    1733         item->SetLabel("Paste links");
     1745        item->SetLabel(B_TRANSLATE("Paste links"));
    17341746        item->SetShortcut('V', B_COMMAND_KEY | B_SHIFT_KEY);
    17351747        item->SetMessage(new BMessage(kPasteLinksFromClipboard));
    17361748    } else {
    1737         item->SetLabel("Paste");
     1749        item->SetLabel(B_TRANSLATE("Paste"));
    17381750        item->SetShortcut('V', B_COMMAND_KEY);
    17391751        item->SetMessage(new BMessage(B_PASTE));
    17401752    }
     
    17531765        && (PoseView()->ViewMode() != kListMode));
    17541766
    17551767    if (modifiers() & B_SHIFT_KEY) {
    1756         item->SetLabel("Clean up all");
     1768        item->SetLabel(B_TRANSLATE("Clean up all"));
    17571769        item->SetShortcut('K', B_COMMAND_KEY | B_SHIFT_KEY);
    17581770        item->SetMessage(new BMessage(kCleanupAll));
    17591771    } else {
    1760         item->SetLabel("Clean up");
     1772        item->SetLabel(B_TRANSLATE("Clean up"));
    17611773        item->SetShortcut('K', B_COMMAND_KEY);
    17621774        item->SetMessage(new BMessage(kCleanup));
    17631775    }
     
    17731785        return;
    17741786
    17751787    if (modifiers() & B_SHIFT_KEY) {
    1776         item->SetLabel("Close all");
     1788        item->SetLabel(B_TRANSLATE("Close all"));
    17771789        item->SetShortcut('W', B_COMMAND_KEY | B_SHIFT_KEY);
    17781790        item->SetTarget(be_app);
    17791791        item->SetMessage(new BMessage(kCloseAllWindows));
    17801792    } else {
    1781         item->SetLabel("Close");
     1793        item->SetLabel(B_TRANSLATE("Close"));
    17821794        item->SetShortcut('W', B_COMMAND_KEY);
    17831795        item->SetTarget(this);
    17841796        item->SetMessage(new BMessage(B_QUIT_REQUESTED));
     
    18031815void
    18041816BContainerWindow::AddMenus()
    18051817{
    1806     fFileMenu = new BMenu("File");
     1818    fFileMenu = new BMenu(B_TRANSLATE("File"));
    18071819    AddFileMenu(fFileMenu);
    18081820    fMenuBar->AddItem(fFileMenu);
    1809     fWindowMenu = new BMenu("Window");
     1821    fWindowMenu = new BMenu(B_TRANSLATE("Window"));
    18101822    fMenuBar->AddItem(fWindowMenu);
    18111823    AddWindowMenu(fWindowMenu);
    18121824    // just create the attribute, decide to add it later
    1813     fAttrMenu = new BMenu("Attributes");
     1825    fAttrMenu = new BMenu(B_TRANSLATE("Attributes"));
    18141826    NewAttributeMenu(fAttrMenu);
    18151827}
    18161828
     
    18191831BContainerWindow::AddFileMenu(BMenu *menu)
    18201832{
    18211833    if (!PoseView()->IsFilePanel())
    1822         menu->AddItem(new BMenuItem("Find"B_UTF8_ELLIPSIS,
     1834        menu->AddItem(new BMenuItem(
     1835            B_TRANSLATE("Find"B_UTF8_ELLIPSIS),
    18231836            new BMessage(kFindButton), 'F'));
    18241837
    18251838    if (!TargetModel()->IsQuery() && !IsTrash() && !IsPrintersDir()) {
    18261839        if (!PoseView()->IsFilePanel()) {
    1827             TemplatesMenu *templateMenu = new TemplatesMenu(PoseView());
     1840            TemplatesMenu* templateMenu = new TemplatesMenu(PoseView(),
     1841                B_TRANSLATE("New"));
    18281842            menu->AddItem(templateMenu);
    18291843            templateMenu->SetTargetForItems(PoseView());
    18301844        } else
    1831             menu->AddItem(new BMenuItem("New folder", new BMessage(kNewFolder), 'N'));
     1845            menu->AddItem(
     1846                new BMenuItem(B_TRANSLATE("New folder"),
     1847                new BMessage(kNewFolder), 'N'));
    18321848    }
    18331849    menu->AddSeparatorItem();
    18341850
    1835     menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
    1836     menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
    1837     menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
     1851    menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
     1852        new BMessage(kOpenSelection), 'O'));
     1853    menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
     1854        new BMessage(kGetInfo), 'I'));
     1855    menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
     1856        new BMessage(kEditItem), 'E'));
    18381857
    18391858    if (IsTrash() || InTrash()) {
    1840         menu->AddItem(new BMenuItem("Restore", new BMessage(kRestoreFromTrash)));
     1859        menu->AddItem(new BMenuItem(B_TRANSLATE("Restore"),
     1860            new BMessage(kRestoreFromTrash)));
    18411861        if (IsTrash()) {
    18421862            // add as first item in menu
    1843             menu->AddItem(new BMenuItem("Empty Trash", new BMessage(kEmptyTrash)), 0);
     1863            menu->AddItem(
     1864                new BMenuItem(B_TRANSLATE("Empty Trash"),
     1865                new BMessage(kEmptyTrash)), 0);
    18441866            menu->AddItem(new BSeparatorItem(), 1);
    18451867        }
    18461868    } else if (IsPrintersDir()) {
    1847         menu->AddItem(new BMenuItem("Add printer"B_UTF8_ELLIPSIS,
     1869        menu->AddItem(
     1870            new BMenuItem(B_TRANSLATE("Add printer"B_UTF8_ELLIPSIS),
    18481871            new BMessage(kAddPrinter), 'N'), 0);
    18491872        menu->AddItem(new BSeparatorItem(), 1);
    1850         menu->AddItem(new BMenuItem("Make active printer",
     1873        menu->AddItem(
     1874            new BMenuItem(B_TRANSLATE("Make active printer"),
    18511875            new BMessage(kMakeActivePrinter)));
    18521876    } else {
    1853         menu->AddItem(new BMenuItem("Duplicate",new BMessage(kDuplicateSelection), 'D'));
     1877        menu->AddItem(
     1878            new BMenuItem(B_TRANSLATE("Duplicate"),
     1879            new BMessage(kDuplicateSelection), 'D'));
    18541880
    1855         menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() ?
    1856                 "Delete" : "Move to Trash",
    1857                 new BMessage(kMoveToTrash), 'T'));
     1881        menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
     1882            ?B_TRANSLATE("Delete")
     1883            : B_TRANSLATE("Move to Trash"),
     1884            new BMessage(kMoveToTrash), 'T'));
    18581885
    18591886        menu->AddSeparatorItem();
    18601887
     
    18671894    if (!IsPrintersDir()) {
    18681895        menu->AddSeparatorItem();
    18691896
    1870         menu->AddItem(cutItem = new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
    1871         menu->AddItem(copyItem = new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
    1872         menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
     1897        menu->AddItem(
     1898            cutItem = new BMenuItem(B_TRANSLATE("Cut"),
     1899            new BMessage(B_CUT), 'X'));
     1900        menu->AddItem(
     1901            copyItem = new BMenuItem(B_TRANSLATE("Copy"),
     1902            new BMessage(B_COPY), 'C'));
     1903        menu->AddItem(
     1904            pasteItem = new BMenuItem(B_TRANSLATE("Paste"),
     1905            new BMessage(B_PASTE), 'V'));
    18731906
    18741907        menu->AddSeparatorItem();
    18751908
    1876         menu->AddItem(new BMenuItem("Identify", new BMessage(kIdentifyEntry)));
    1877         BMenu *addOnMenuItem = new BMenu(kAddOnsMenuName);
     1909        menu->AddItem(new BMenuItem(
     1910            B_TRANSLATE("Identify"),
     1911            new BMessage(kIdentifyEntry)));
     1912        BMenu* addOnMenuItem = new BMenu(
     1913            B_TRANSLATE("Add-ons"));
    18781914        addOnMenuItem->SetFont(be_plain_font);
    18791915        menu->AddItem(addOnMenuItem);
    18801916    }
     
    18941930{
    18951931    BMenuItem *item;
    18961932
    1897     BMenu* iconSizeMenu = new BMenu("Icon view");
     1933    BMenu* iconSizeMenu = new BMenu(
     1934        B_TRANSLATE("Icon view"));
    18981935
    18991936    BMessage* message = new BMessage(kIconMode);
    19001937    message->AddInt32("size", 32);
    1901     item = new BMenuItem("32 x 32", message);
     1938    item = new BMenuItem(
     1939        B_TRANSLATE("32 x 32"), message);
    19021940    item->SetTarget(PoseView());
    19031941    iconSizeMenu->AddItem(item);
    19041942
    19051943    message = new BMessage(kIconMode);
    19061944    message->AddInt32("size", 40);
    1907     item = new BMenuItem("40 x 40", message);
     1945    item = new BMenuItem(
     1946        B_TRANSLATE("40 x 40"), message);
    19081947    item->SetTarget(PoseView());
    19091948    iconSizeMenu->AddItem(item);
    19101949
    19111950    message = new BMessage(kIconMode);
    19121951    message->AddInt32("size", 48);
    1913     item = new BMenuItem("48 x 48", message);
     1952    item = new BMenuItem(
     1953        B_TRANSLATE("48 x 48"), message);
    19141954    item->SetTarget(PoseView());
    19151955    iconSizeMenu->AddItem(item);
    19161956
    19171957    message = new BMessage(kIconMode);
    19181958    message->AddInt32("size", 64);
    1919     item = new BMenuItem("64 x 64", message);
     1959    item = new BMenuItem(
     1960        B_TRANSLATE("64 x 64"), message);
    19201961    item->SetTarget(PoseView());
    19211962    iconSizeMenu->AddItem(item);
    19221963
     
    19241965
    19251966    message = new BMessage(kIconMode);
    19261967    message->AddInt32("scale", 0);
    1927     item = new BMenuItem("Decrease size", message, '-');
     1968    item = new BMenuItem(
     1969        B_TRANSLATE("Decrease size"), message, '-');
    19281970    item->SetTarget(PoseView());
    19291971    iconSizeMenu->AddItem(item);
    19301972
    19311973    message = new BMessage(kIconMode);
    19321974    message->AddInt32("scale", 1);
    1933     item = new BMenuItem("Increase size", message, '+');
     1975    item = new BMenuItem(
     1976        B_TRANSLATE("Increase size"), message, '+');
    19341977    item->SetTarget(PoseView());
    19351978    iconSizeMenu->AddItem(item);
    19361979
     
    19401983    iconSizeMenu->Superitem()->SetMessage(new BMessage(kIconMode));
    19411984    iconSizeMenu->Superitem()->SetTarget(PoseView());
    19421985
    1943     item = new BMenuItem("Mini icon view", new BMessage(kMiniIconMode), '2');
     1986    item = new BMenuItem(B_TRANSLATE("Mini icon view"),
     1987        new BMessage(kMiniIconMode), '2');
    19441988    item->SetTarget(PoseView());
    19451989    menu->AddItem(item);
    19461990
    1947     item = new BMenuItem("List view", new BMessage(kListMode), '3');
     1991    item = new BMenuItem(B_TRANSLATE("List view"),
     1992        new BMessage(kListMode), '3');
    19481993    item->SetTarget(PoseView());
    19491994    menu->AddItem(item);
    19501995
    19511996    menu->AddSeparatorItem();
    19521997
    1953     item = new BMenuItem("Resize to fit", new BMessage(kResizeToFit), 'Y');
     1998    item = new BMenuItem(B_TRANSLATE("Resize to fit"),
     1999        new BMessage(kResizeToFit), 'Y');
    19542000    item->SetTarget(this);
    19552001    menu->AddItem(item);
    19562002
    1957     item = new BMenuItem("Clean up", new BMessage(kCleanup), 'K');
     2003    item = new BMenuItem(B_TRANSLATE("Clean up"),
     2004        new BMessage(kCleanup), 'K');
    19582005    item->SetTarget(PoseView());
    19592006    menu->AddItem(item);
    19602007
    1961     item = new BMenuItem("Select"B_UTF8_ELLIPSIS,
     2008    item = new BMenuItem(
     2009        B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
    19622010        new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
    19632011    item->SetTarget(PoseView());
    19642012    menu->AddItem(item);
    19652013
    1966     item = new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A');
     2014    item = new BMenuItem(B_TRANSLATE("Select all"),
     2015        new BMessage(B_SELECT_ALL), 'A');
    19672016    item->SetTarget(PoseView());
    19682017    menu->AddItem(item);
    19692018
    1970     item = new BMenuItem("Invert selection", new BMessage(kInvertSelection),
     2019    item = new BMenuItem(B_TRANSLATE("Invert selection"),
     2020        new BMessage(kInvertSelection),
    19712021        'S');
    19722022    item->SetTarget(PoseView());
    19732023    menu->AddItem(item);
    19742024
    19752025    if (!IsTrash()) {
    1976         item = new BMenuItem("Open parent", new BMessage(kOpenParentDir),
     2026        item = new BMenuItem(B_TRANSLATE("Open parent"),
     2027            new BMessage(kOpenParentDir),
    19772028            B_UP_ARROW);
    19782029        item->SetTarget(PoseView());
    19792030        menu->AddItem(item);
    19802031    }
    19812032
    1982     item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W');
     2033    item = new BMenuItem(B_TRANSLATE("Close"),
     2034        new BMessage(B_QUIT_REQUESTED), 'W');
    19832035    item->SetTarget(this);
    19842036    menu->AddItem(item);
    19852037
    1986     item = new BMenuItem("Close all in workspace",
     2038    item = new BMenuItem(
     2039        B_TRANSLATE("Close all in workspace"),
    19872040        new BMessage(kCloseAllInWorkspace), 'Q');
    19882041    item->SetTarget(be_app);
    19892042    menu->AddItem(item);
    19902043
    19912044    menu->AddSeparatorItem();
    19922045
    1993     item = new BMenuItem("Preferences"B_UTF8_ELLIPSIS,
     2046    item = new BMenuItem(
     2047        B_TRANSLATE("Preferences"B_UTF8_ELLIPSIS),
    19942048        new BMessage(kShowSettingsWindow));
    19952049    item->SetTarget(be_app);
    19962050    menu->AddItem(item);
     
    20512105    AddMimeTypesToMenu(fAttrMenu);
    20522106
    20532107    if (IsPrintersDir())
    2054         EnableNamedMenuItem(fFileMenu, "Make active printer", selectCount == 1);
     2108        EnableNamedMenuItem(fFileMenu,
     2109            B_TRANSLATE("Make active printer"),
     2110            selectCount == 1);
    20552111}
    20562112
    20572113
     
    21632219    bool poseViewIsQuery = TargetModel()->IsQuery();
    21642220        // if the view is a query pose view, add edit query menu item
    21652221
    2166     BMenuItem *item = menu->FindItem("Edit query");
     2222    BMenuItem* item = menu->FindItem(
     2223        B_TRANSLATE("Edit query"));
    21672224    if (!poseViewIsQuery && !queryInSelection && item)
    21682225        item->Menu()->RemoveItem(item);
    21692226
     
    21732230        item = menu->FindItem(kOpenSelection);
    21742231        if (item) {
    21752232            int32 itemIndex = item->Menu()->IndexOf(item);
    2176             BMenuItem *query = new BMenuItem("Edit query", new BMessage(kEditQuery), 'G');
     2233            BMenuItem* query = new BMenuItem(B_TRANSLATE("Edit query"),
     2234                new BMessage(kEditQuery), 'G');
    21772235            item->Menu()->AddItem(query, itemIndex + 1);
    21782236            query->SetTarget(PoseView());
    21792237        }
     
    22252283
    22262284    int32 index = item->Menu()->IndexOf(item);
    22272285    fOpenWithItem = new BMenuItem(
    2228         new OpenWithMenu("Open with"B_UTF8_ELLIPSIS, &message, this, be_app),
    2229         new BMessage(kOpenSelectionWith));
     2286        new OpenWithMenu(
     2287            B_TRANSLATE("Open with"B_UTF8_ELLIPSIS),
     2288            &message, this, be_app), new BMessage(kOpenSelectionWith));
    22302289    fOpenWithItem->SetTarget(PoseView());
    22312290    fOpenWithItem->SetShortcut('O', B_COMMAND_KEY | B_CONTROL_KEY);
    22322291
     
    22602319    if (entry.SetTo(ref) == B_OK
    22612320        && entry.GetParent(&entry) == B_OK
    22622321        && model.SetTo(&entry) == B_OK) {
    2263         BNavMenu *menu = new BNavMenu("Current folder",what,this);
     2322        BNavMenu* menu = new BNavMenu(B_TRANSLATE("Current folder"),
     2323            what, this);
    22642324        menu->SetNavDir(model.EntryRef());
    22652325        menu->SetShowParent(true);
    22662326
     
    22762336        path.Append("Tracker");
    22772337        if (entry.SetTo(path.Path()) == B_OK
    22782338            && model.SetTo(&entry) == B_OK) {
    2279             BMenu *menu = new RecentsMenu("Recent folders",kRecentFolders,what,this);
     2339            BMenu* menu = new RecentsMenu(B_TRANSLATE("Recent folders"),
     2340                kRecentFolders, what, this);
    22802341
    22812342            BMenuItem *item = new SpecialModelMenuItem(&model,menu);
    22822343            item->SetMessage(new BMessage((uint32)what));
     
    23752436    // Set the "Create Link" item label here so it
    23762437    // appears correctly when menus are disabled, too.
    23772438    if (modifierKeys & B_SHIFT_KEY)
    2378         fCreateLinkItem->SetLabel("Create relative link");
     2439        fCreateLinkItem->SetLabel(
     2440            B_TRANSLATE("Create relative link"));
    23792441    else
    2380         fCreateLinkItem->SetLabel("Create link");
     2442        fCreateLinkItem->SetLabel(
     2443            B_TRANSLATE("Create link"));
    23812444
    23822445    // only enable once the menus are built
    23832446    fMoveToItem->SetEnabled(false);
     
    24252488    BMenuItem *identifyItem = parent->FindItem(kIdentifyEntry);
    24262489    if (identifyItem != NULL) {
    24272490        if (modifierKeys & B_SHIFT_KEY)
    2428             identifyItem->SetLabel("Force identify");
     2491            identifyItem->SetLabel(
     2492                B_TRANSLATE("Force identify"));
    24292493        else
    2430             identifyItem->SetLabel("Identify");
     2494            identifyItem->SetLabel(
     2495                B_TRANSLATE("Identify"));
    24312496    }
    24322497}
    24332498
     
    24462511    if (item == NULL)
    24472512        item = fDropContextMenu->FindItem(kCreateRelativeLink);
    24482513    if (item && (modifiers() & B_SHIFT_KEY)) {
    2449         item->SetLabel("Create relative link here");
     2514        item->SetLabel(
     2515            B_TRANSLATE("Create relative link here"));
    24502516        item->SetMessage(new BMessage(kCreateRelativeLink));
    24512517    } else if (item) {
    2452         item->SetLabel("Create link here");
     2518        item->SetLabel(
     2519            B_TRANSLATE("Create link here"));
    24532520        item->SetMessage(new BMessage(kCreateLink));
    24542521    }
    24552522
     
    25722639                        if (volume != boot)
    25732640                            ejectableVolumeSelected = true;
    25742641       
    2575                         EnableNamedMenuItem(fContextMenu, "Unmount", ejectableVolumeSelected);
     2642                        EnableNamedMenuItem(fContextMenu, B_TRANSLATE("Unmount"),
     2643                            ejectableVolumeSelected);
    25762644                    }
    25772645                }
    25782646       
     
    26072675void
    26082676BContainerWindow::AddFileContextMenus(BMenu *menu)
    26092677{
    2610     menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
    2611     menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
    2612     menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
     2678    menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
     2679        new BMessage(kOpenSelection), 'O'));
     2680    menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
     2681        new BMessage(kGetInfo), 'I'));
     2682    menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
     2683        new BMessage(kEditItem), 'E'));
    26132684
    26142685    if (!IsTrash() && !InTrash() && !IsPrintersDir())
    2615         menu->AddItem(new BMenuItem("Duplicate",
     2686        menu->AddItem(
     2687            new BMenuItem(B_TRANSLATE("Duplicate"),
    26162688            new BMessage(kDuplicateSelection), 'D'));
    26172689
    26182690    if (!IsTrash() && !InTrash()) {
    2619         menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() ?
    2620                 "Delete" : "Move to Trash",
    2621                 new BMessage(kMoveToTrash), 'T'));
     2691        menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
     2692            ?B_TRANSLATE("Delete")
     2693            : B_TRANSLATE("Move to Trash"),
     2694            new BMessage(kMoveToTrash), 'T'));
    26222695
    26232696        // add separator for copy to/move to items (navigation items)
    26242697        menu->AddSeparatorItem();
    26252698    } else {
    2626         menu->AddItem(new BMenuItem("Delete", new BMessage(kDelete), 0));
    2627         menu->AddItem(new BMenuItem("Restore", new BMessage(kRestoreFromTrash), 0));
     2699        menu->AddItem(new BMenuItem(B_TRANSLATE("Delete"),
     2700            new BMessage(kDelete), 0));
     2701        menu->AddItem(new BMenuItem(B_TRANSLATE("Restore"),
     2702            new BMessage(kRestoreFromTrash), 0));
    26282703    }
    26292704
    26302705#ifdef CUT_COPY_PASTE_IN_CONTEXT_MENU
    26312706    menu->AddSeparatorItem();
    26322707    BMenuItem *cutItem, *copyItem;
    2633     menu->AddItem(cutItem = new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
    2634     menu->AddItem(copyItem = new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
     2708    menu->AddItem(
     2709        cutItem = new BMenuItem(B_TRANSLATE("Cut"),
     2710        new BMessage(B_CUT), 'X'));
     2711    menu->AddItem(
     2712        copyItem = new BMenuItem(B_TRANSLATE("Copy"),
     2713        new BMessage(B_COPY), 'C'));
    26352714#endif
    26362715
    26372716    menu->AddSeparatorItem();
    2638     menu->AddItem(new BMenuItem("Identify", new BMessage(kIdentifyEntry)));
    2639     BMenu *addOnMenuItem = new BMenu(kAddOnsMenuName);
     2717    menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"),
     2718        new BMessage(kIdentifyEntry)));
     2719    BMenu* addOnMenuItem =
     2720        new BMenu(B_TRANSLATE("Add-ons"));
    26402721    addOnMenuItem->SetFont(be_plain_font);
    26412722    menu->AddItem(addOnMenuItem);
    26422723
     
    26522733void
    26532734BContainerWindow::AddVolumeContextMenus(BMenu *menu)
    26542735{
    2655     menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
    2656     menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
    2657     menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
     2736    menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
     2737        new BMessage(kOpenSelection), 'O'));
     2738    menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
     2739        new BMessage(kGetInfo), 'I'));
     2740    menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
     2741        new BMessage(kEditItem), 'E'));
    26582742
    26592743    menu->AddSeparatorItem();
    2660     menu->AddItem(new MountMenu("Mount"));
     2744    menu->AddItem(new MountMenu(B_TRANSLATE("Mount")));
    26612745
    2662     BMenuItem *item = new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U');
     2746    BMenuItem *item = new BMenuItem(
     2747        B_TRANSLATE("Unmount"),
     2748        new BMessage(kUnmountVolume), 'U');
    26632749    item->SetEnabled(false);
    26642750    menu->AddItem(item);
    26652751
    26662752    menu->AddSeparatorItem();
    2667     menu->AddItem(new BMenu(kAddOnsMenuName));
     2753    menu->AddItem(new BMenu(B_TRANSLATE("Add-ons")));
    26682754
    26692755    menu->SetTargetForItems(PoseView());
    26702756}
     
    26792765
    26802766    bool needSeparator = true;
    26812767    if (IsTrash())
    2682         menu->AddItem(new BMenuItem("Empty Trash", new BMessage(kEmptyTrash)));
     2768        menu->AddItem(
     2769            new BMenuItem(B_TRANSLATE("Empty Trash"),
     2770            new BMessage(kEmptyTrash)));
    26832771    else if (IsPrintersDir())
    2684         menu->AddItem(new BMenuItem("Add printer"B_UTF8_ELLIPSIS, new BMessage(kAddPrinter), 'N'));
     2772        menu->AddItem(
     2773            new BMenuItem(B_TRANSLATE("Add printer"B_UTF8_ELLIPSIS),
     2774            new BMessage(kAddPrinter), 'N'));
    26852775    else if (InTrash())
    26862776        needSeparator = false;
    26872777    else {
    2688         TemplatesMenu *templateMenu = new TemplatesMenu(PoseView());
     2778        TemplatesMenu* templateMenu = new TemplatesMenu(PoseView(),
     2779            B_TRANSLATE("New"));
    26892780        menu->AddItem(templateMenu);
    26902781        templateMenu->SetTargetForItems(PoseView());
    26912782        templateMenu->SetFont(be_plain_font);
     
    26992790    menu->AddItem(pasteItem);
    27002791    menu->AddSeparatorItem();
    27012792#endif
    2702     menu->AddItem(new BMenuItem("Clean up", new BMessage(kCleanup), 'K'));
    2703     menu->AddItem(new BMenuItem("Select"B_UTF8_ELLIPSIS,
     2793    menu->AddItem(
     2794        new BMenuItem(B_TRANSLATE("Clean up"),
     2795        new BMessage(kCleanup), 'K'));
     2796    menu->AddItem(
     2797        new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
    27042798        new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
    2705     menu->AddItem(new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
     2799    menu->AddItem(
     2800        new BMenuItem(B_TRANSLATE("Select all"),
     2801        new BMessage(B_SELECT_ALL), 'A'));
    27062802    if (!IsTrash())
    2707         menu->AddItem(new BMenuItem("Open parent", new BMessage(kOpenParentDir),
    2708             B_UP_ARROW));
     2803        menu->AddItem(
     2804            new BMenuItem(B_TRANSLATE("Open parent"),
     2805            new BMessage(kOpenParentDir), B_UP_ARROW));
    27092806
    27102807    menu->AddSeparatorItem();
    2711     BMenu *addOnMenuItem = new BMenu(kAddOnsMenuName);
     2808    BMenu* addOnMenuItem = new BMenu(
     2809        B_TRANSLATE("Add-ons"));
    27122810    addOnMenuItem->SetFont(be_plain_font);
    27132811    menu->AddItem(addOnMenuItem);
    27142812
     
    27292827void
    27302828BContainerWindow::AddDropContextMenus(BMenu *menu)
    27312829{
    2732     menu->AddItem(new BMenuItem("Create link here", new BMessage(kCreateLink)));
    2733     menu->AddItem(new BMenuItem("Move here", new BMessage(kMoveSelectionTo)));
    2734     menu->AddItem(new BMenuItem("Copy here", new BMessage(kCopySelectionTo)));
     2830    menu->AddItem(
     2831        new BMenuItem(B_TRANSLATE("Create link here"),
     2832        new BMessage(kCreateLink)));
     2833    menu->AddItem(new BMenuItem(B_TRANSLATE("Move here"),
     2834        new BMessage(kMoveSelectionTo)));
     2835    menu->AddItem(new BMenuItem(B_TRANSLATE("Copy here"),
     2836        new BMessage(kCopySelectionTo)));
    27352837    menu->AddSeparatorItem();
    2736     menu->AddItem(new BMenuItem("Cancel", new BMessage(kCancelButton)));
     2838    menu->AddItem(new BMenuItem(B_TRANSLATE("Cancel"),
     2839        new BMessage(kCancelButton)));
    27372840}
    27382841
    27392842
     
    27412844BContainerWindow::AddTrashContextMenus(BMenu *menu)
    27422845{
    27432846    // setup special trash context menu
    2744     menu->AddItem(new BMenuItem("Empty Trash",
     2847    menu->AddItem(
     2848        new BMenuItem(B_TRANSLATE("Empty Trash"),
    27452849        new BMessage(kEmptyTrash)));
    2746     menu->AddItem(new BMenuItem("Open",
     2850    menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
    27472851        new BMessage(kOpenSelection), 'O'));
    2748     menu->AddItem(new BMenuItem("Get info",
     2852    menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
    27492853        new BMessage(kGetInfo), 'I'));
    27502854    menu->SetTargetForItems(PoseView());
    27512855}
     
    28872991void
    28882992BContainerWindow::BuildAddOnMenu(BMenu *menu)
    28892993{
    2890     BMenuItem *item = menu->FindItem(kAddOnsMenuName);
     2994    BMenuItem* item = menu->FindItem(
     2995        B_TRANSLATE("Add-ons"));
    28912996    if (menu->IndexOf(item) == 0) {
    28922997        // the folder of the context menu seems to be named "Add-Ons"
    28932998        // so we just take the last menu item, which is correct if not
     
    29653070
    29663071    if (context == kMenuBarContext || context == kWindowPopUpContext) {
    29673072        BMenu* sizeMenu = NULL;
    2968         if (BMenuItem* item = menu->FindItem("Icon view")) {
     3073        if (BMenuItem* item = menu->FindItem(
     3074            B_TRANSLATE("Icon view"))) {
    29693075            sizeMenu = item->Submenu();
    29703076        }
    29713077
     
    30013107        EnableNamedMenuItem(menu, kEmptyTrash, count > 0);
    30023108        EnableNamedMenuItem(menu, B_SELECT_ALL, count > 0);
    30033109
    3004         BMenuItem *item = menu->FindItem(kTemplatesMenuName);
     3110        BMenuItem* item = menu->FindItem(
     3111            B_TRANSLATE("New"));
    30053112        if (item) {
    3006             TemplatesMenu *templateMenu = dynamic_cast<TemplatesMenu *>(
     3113            TemplatesMenu* templateMenu = dynamic_cast<TemplatesMenu *>(
    30073114                item->Submenu());
    30083115            if (templateMenu)
    30093116                templateMenu->UpdateMenuState();
     
    30223129    entry_ref addonRef;
    30233130    status_t result = message->FindRef("refs", &addonRef);
    30243131    if (result != B_OK) {
    3025         char buffer[1024];
    3026         sprintf(buffer, "Error %s loading add-On %s.", strerror(result), addonRef.name);
    3027         BAlert* alert = new BAlert("", buffer, "Cancel", 0, 0,
    3028             B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     3132        BString buffer(B_TRANSLATE("Error %error loading add-On %name."));
     3133    buffer.ReplaceFirst("%error", strerror(result));
     3134    buffer.ReplaceFirst("%name", addonRef.name);
     3135
     3136        BAlert* alert = new BAlert("",
     3137            buffer.String(),
     3138            B_TRANSLATE("Cancel"),
     3139            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    30293140        alert->SetShortcut(0, B_ESCAPE);
    30303141        alert->Go();
    30313142        return;
     
    30863197    ASSERT(PoseView());
    30873198
    30883199    BMenuItem *item;
    3089     menu->AddItem(item = new BMenuItem("Copy layout", new BMessage(kCopyAttributes)));
     3200    menu->AddItem(item = new BMenuItem(
     3201        B_TRANSLATE("Copy layout"),
     3202        new BMessage(kCopyAttributes)));
    30903203    item->SetTarget(PoseView());
    3091     menu->AddItem(item = new BMenuItem("Paste layout", new BMessage(kPasteAttributes)));
     3204    menu->AddItem(item = new BMenuItem(
     3205        B_TRANSLATE("Paste layout"),
     3206        new BMessage(kPasteAttributes)));
    30923207    item->SetTarget(PoseView());
    30933208    menu->AddSeparatorItem();
    30943209
    3095     menu->AddItem(NewAttributeMenuItem ("Name", kAttrStatName, B_STRING_TYPE,
    3096         145, B_ALIGN_LEFT, true, true));
     3210    menu->AddItem(NewAttributeMenuItem(
     3211        B_TRANSLATE("Name"),
     3212        kAttrStatName, B_STRING_TYPE, 145, B_ALIGN_LEFT, true, true));
    30973213
    3098     menu->AddItem(NewAttributeMenuItem ("Size", kAttrStatSize, B_OFF_T_TYPE,
     3214    menu->AddItem(NewAttributeMenuItem (B_TRANSLATE("Size"), kAttrStatSize, B_OFF_T_TYPE,
    30993215        80, B_ALIGN_RIGHT, false, true));
    31003216
    3101     menu->AddItem(NewAttributeMenuItem ("Modified", kAttrStatModified, B_TIME_TYPE,
    3102         150, B_ALIGN_LEFT, false, true));
     3217    menu->AddItem(NewAttributeMenuItem(
     3218        B_TRANSLATE("Modified"),
     3219        kAttrStatModified, B_TIME_TYPE, 150, B_ALIGN_LEFT, false, true));
    31033220
    3104     menu->AddItem(NewAttributeMenuItem ("Created", kAttrStatCreated, B_TIME_TYPE,
    3105         150, B_ALIGN_LEFT, false, true));
     3221    menu->AddItem(NewAttributeMenuItem(
     3222        B_TRANSLATE("Created"),
     3223        kAttrStatCreated, B_TIME_TYPE, 150, B_ALIGN_LEFT, false, true));
    31063224
    3107     menu->AddItem(NewAttributeMenuItem ("Kind", kAttrMIMEType, B_MIME_STRING_TYPE,
    3108         145, B_ALIGN_LEFT, false, false));
     3225    menu->AddItem(NewAttributeMenuItem(
     3226        B_TRANSLATE("Kind"),
     3227        kAttrMIMEType, B_MIME_STRING_TYPE, 145, B_ALIGN_LEFT, false, false));
    31093228
    31103229    if (IsTrash() || InTrash())
    3111         menu->AddItem(NewAttributeMenuItem ("Original name", kAttrOriginalPath, B_STRING_TYPE,
    3112             225, B_ALIGN_LEFT, false, false));
     3230        menu->AddItem(NewAttributeMenuItem(
     3231            B_TRANSLATE("Original name"),
     3232            kAttrOriginalPath, B_STRING_TYPE, 225, B_ALIGN_LEFT, false, false));
    31133233    else
    3114         menu->AddItem(NewAttributeMenuItem ("Location", kAttrPath, B_STRING_TYPE,
     3234        menu->AddItem(NewAttributeMenuItem(
     3235            B_TRANSLATE("Location"), kAttrPath, B_STRING_TYPE,
    31153236            225, B_ALIGN_LEFT, false, false));
    31163237
    31173238#ifdef OWNER_GROUP_ATTRIBUTES
    3118     menu->AddItem(NewAttributeMenuItem ("Owner", kAttrStatOwner, B_STRING_TYPE,
     3239    menu->AddItem(NewAttributeMenuItem(
     3240        B_TRANSLATE("Owner"), kAttrStatOwner, B_STRING_TYPE,
    31193241        60, B_ALIGN_LEFT, false, true));
    31203242
    3121     menu->AddItem(NewAttributeMenuItem ("Group", kAttrStatGroup, B_STRING_TYPE,
     3243    menu->AddItem(NewAttributeMenuItem(
     3244        B_TRANSLATE("Group"), kAttrStatGroup, B_STRING_TYPE,
    31223245        60, B_ALIGN_LEFT, false, true));
    31233246#endif
    31243247
    3125     menu->AddItem(NewAttributeMenuItem ("Permissions", kAttrStatMode, B_STRING_TYPE,
    3126         80, B_ALIGN_LEFT, false, true));
     3248    menu->AddItem(NewAttributeMenuItem(
     3249        B_TRANSLATE("Permissions"),
     3250        kAttrStatMode, B_STRING_TYPE, 80, B_ALIGN_LEFT, false, true));
    31273251}
    31283252
    31293253
  • WidgetAttributeText.cpp

     
    4040
    4141#include <Alert.h>
    4242#include <AppFileInfo.h>
     43#include <Catalog.h>
    4344#include <Debug.h>
     45#include <Locale.h>
    4446#include <NodeInfo.h>
    4547#include <Path.h>
    4648#include <TextView.h>
     
    6163#include "WidgetAttributeText.h"
    6264
    6365
     66
     67#undef B_TRANSLATE_CONTEXT
     68#define B_TRANSLATE_CONTEXT "libTracker"
     69
     70
    6471const int32 kGenericReadBufferSize = 1024;
    6572
    6673template <class View>
     
    215222        *result = "-";
    216223        return view->StringWidth("-");
    217224    } else if (value < kKBSize) {
    218         sprintf(buffer, "%Ld bytes", value);
     225        sprintf(buffer, B_TRANSLATE("%Ld bytes"), value);
    219226        if (view->StringWidth(buffer) > width)
    220             sprintf(buffer, "%Ld B", value);
     227            sprintf(buffer, B_TRANSLATE("%Ld B"), value);
    221228    } else {
    222229        const char *suffix;
    223230        float floatValue;
    224231        if (value >= kTBSize) {
    225             suffix = "TiB";
     232            suffix = B_TRANSLATE("TiB");
    226233            floatValue = (float)value / kTBSize;
    227234        } else if (value >= kGBSize) {
    228             suffix = "GiB";
     235            suffix = B_TRANSLATE("GiB");
    229236            floatValue = (float)value / kGBSize;
    230237        } else if (value >= kMBSize) {
    231             suffix = "MiB";
     238            suffix = B_TRANSLATE("MiB");
    232239            floatValue = (float)value / kMBSize;
    233240        } else {
    234241            ASSERT(value >= kKBSize);
    235             suffix = "KiB";
     242            suffix = B_TRANSLATE("KiB");
    236243            floatValue = (float)value / kKBSize;
    237244        }
    238245
     
    751758
    752759    // get the mime type
    753760    if (mime.SetType(fModel->MimeType()) != B_OK)
    754         *result = "Unknown";
     761        *result = B_TRANSLATE("Unknown");
    755762    // get the short mime type description
    756763    else if (mime.GetShortDescription(desc) == B_OK)
    757764        *result = desc;
     
    872879
    873880    bool removeExisting = false;
    874881    if (parent.Contains(text)) {
    875         BAlert *alert = new BAlert("", "That name is already taken. "
    876                 "Please type another one.", "Replace other file", "OK", NULL,
    877                 B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     882        BAlert* alert = new BAlert("",
     883            B_TRANSLATE("That name is already taken. "
     884            "Please type another one."),
     885            B_TRANSLATE("Replace other file"),
     886            B_TRANSLATE("OK"),
     887            NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    878888
    879889        alert->SetShortcut(0, 'r');
    880890
     
    15921602        && type != B_DOUBLE_TYPE
    15931603        && type != B_CHAR_TYPE
    15941604        && type != B_BOOL_TYPE) {
    1595         BAlert *alert = new BAlert("", "Sorry, you cannot edit that attribute.",
    1596             "Cancel", 0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
     1605        BAlert* alert = new BAlert("",
     1606            B_TRANSLATE("Sorry, you cannot edit that attribute."),
     1607            B_TRANSLATE("Cancel"),
     1608            0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
    15971609        alert->SetShortcut(0, B_ESCAPE);
    15981610        alert->Go();
    15991611        return false;
     
    16261638                sscanf(textView->Text(), "%c", &ch);
    16271639                //Check if we read the start of a multi-byte glyph:
    16281640                if (!isprint(ch)) {
    1629                     BAlert *alert = new BAlert("", "Sorry, the 'Character' "
    1630                         "attribute cannot store a multi-byte glyph.",
    1631                         "Cancel", 0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
     1641                    BAlert* alert = new BAlert("",
     1642                        B_TRANSLATE("Sorry, the 'Character' "
     1643                        "attribute cannot store a multi-byte glyph."),
     1644                        B_TRANSLATE("Cancel"),
     1645                        0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
    16321646                    alert->SetShortcut(0, B_ESCAPE);
    16331647                    alert->Go();
    16341648                    return false;
     
    17271741    }
    17281742
    17291743    if (size < 0) {
    1730         BAlert *alert = new BAlert("",
    1731             "There was an error writing the attribute.",
    1732             "Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     1744        BAlert* alert = new BAlert("",
     1745            B_TRANSLATE("There was an error writing the attribute."),
     1746            B_TRANSLATE("Cancel"),
     1747            0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    17331748        alert->SetShortcut(0, B_ESCAPE);
    17341749        alert->Go();
    17351750
  • Tracker.cpp

     
    4040
    4141#include <Alert.h>
    4242#include <Autolock.h>
     43#include <Catalog.h>
    4344#include <Debug.h>
    4445#include <FindDirectory.h>
    4546#include <fs_attr.h>
    4647#include <fs_info.h>
    4748#include <image.h>
     49#include <Locale.h>
    4850#include <MenuItem.h>
    4951#include <NodeInfo.h>
    5052#include <NodeMonitor.h>
     
    206208//  #pragma mark -
    207209
    208210
     211#undef B_TRANSLATE_CONTEXT
     212#define B_TRANSLATE_CONTEXT "libTracker"
     213
    209214TTracker::TTracker()
    210215    :   BApplication(kTrackerSignature),
    211216    fSettingsWindow(NULL)
     
    663668
    664669        if (!brokenLinkWithSpecificHandler) {
    665670            delete model;
    666             BAlert *alert = new BAlert("",
    667                 "There was an error resolving the link.",
    668                 "Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     671            BAlert* alert = new BAlert("",
     672                B_TRANSLATE(
     673                    "There was an error resolving the link."),
     674                B_TRANSLATE(
     675                    "Cancel"),
     676                0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    669677            alert->SetShortcut(0, B_ESCAPE);
    670678            alert->Go();
    671679            return result;
  • libTracker.rdef

     
     1resource app_signature "application/x-vnd.Haiku-libTracker";
  • MountMenu.cpp

     
    3434
    3535// MountMenu implements a context menu used for mounting/unmounting volumes
    3636
     37#include <Catalog.h>
    3738#include <Debug.h>
     39#include <Locale.h>
    3840#include <MenuItem.h>
    3941#include <Mime.h>
    4042#include <InterfaceDefs.h>
     
    154156//  #pragma mark -
    155157
    156158
     159#undef B_TRANSLATE_CONTEXT
     160#define B_TRANSLATE_CONTEXT "libTracker"
     161
    157162MountMenu::MountMenu(const char *name)
    158163    : BMenu(name)
    159164{
     
    214219
    215220    AddSeparatorItem();
    216221
    217     BMenuItem *mountAll = new BMenuItem("Mount all",
     222    BMenuItem* mountAll = new BMenuItem(
     223        B_TRANSLATE("Mount all"),
    218224        new BMessage(kMountAllNow));
    219225    AddItem(mountAll);
    220     BMenuItem *mountSettings = new BMenuItem("Settings" B_UTF8_ELLIPSIS,
     226    BMenuItem* mountSettings = new BMenuItem(
     227            B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
    221228        new BMessage(kRunAutomounterSettings));
    222229    AddItem(mountSettings);
    223230
  • QueryContainerWindow.cpp

     
    3232All rights reserved.
    3333*/
    3434
     35#include <Catalog.h>
     36#include <Locale.h>
    3537#include <Menu.h>
    3638#include <MenuItem.h>
    3739#include <Path.h>
     
    4547#include "QueryPoseView.h"
    4648
    4749
     50
     51#undef B_TRANSLATE_CONTEXT
     52#define B_TRANSLATE_CONTEXT "libTracker"
     53
    4854BQueryContainerWindow::BQueryContainerWindow(LockingList<BWindow> *windowList,
    4955    uint32 containerWindowFlags, window_look look,
    5056    window_feel feel, uint32 flags, uint32 workspace)
     
    8591{
    8692    BMenuItem *item;
    8793
    88     item = new BMenuItem("Resize to fit", new BMessage(kResizeToFit), 'Y');
     94    item = new BMenuItem(B_TRANSLATE("Resize to fit"),
     95        new BMessage(kResizeToFit), 'Y');
    8996    item->SetTarget(this);
    9097    menu->AddItem(item);
    9198
    92     item = new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
     99    item = new BMenuItem(
     100        B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
     101        new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
    93102    item->SetTarget(PoseView());
    94103    menu->AddItem(item);
    95104
    96     item = new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A');
     105    item = new BMenuItem(B_TRANSLATE("Select all"),
     106        new BMessage(B_SELECT_ALL), 'A');
    97107    item->SetTarget(PoseView());
    98108    menu->AddItem(item);
    99109
    100     item = new BMenuItem("Invert selection", new BMessage(kInvertSelection), 'S');
     110    item = new BMenuItem(B_TRANSLATE("Invert selection"),
     111        new BMessage(kInvertSelection), 'S');
    101112    item->SetTarget(PoseView());
    102113    menu->AddItem(item);
    103114
    104     item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W');
     115    item = new BMenuItem(B_TRANSLATE("Close"),
     116        new BMessage(B_QUIT_REQUESTED), 'W');
    105117    item->SetTarget(this);
    106118    menu->AddItem(item);
    107119}
     
    110122void
    111123BQueryContainerWindow::AddWindowContextMenus(BMenu *menu)
    112124{
    113     BMenuItem *resizeItem = new BMenuItem("Resize to Fit",
     125    BMenuItem* resizeItem = new BMenuItem(
     126        B_TRANSLATE("Resize to Fit"),
    114127        new BMessage(kResizeToFit), 'Y');
    115128    menu->AddItem(resizeItem);
    116     menu->AddItem(new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
    117     menu->AddItem(new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
    118     BMenuItem *closeItem = new BMenuItem("Close",
     129    menu->AddItem(new BMenuItem(
     130        B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
     131        new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
     132    menu->AddItem(new BMenuItem(
     133        B_TRANSLATE("Select all"),
     134        new BMessage(B_SELECT_ALL), 'A'));
     135    BMenuItem* closeItem = new BMenuItem(
     136        B_TRANSLATE("Close"),
    119137        new BMessage(B_QUIT_REQUESTED), 'W');
    120138    menu->AddItem(closeItem);
    121139    // target items as needed
  • Model.cpp

     
    4646
    4747#include <AppDefs.h>
    4848#include <Bitmap.h>
     49#include <Catalog.h>
    4950#include <Debug.h>
    5051#include <Directory.h>
    5152#include <Entry.h>
    5253#include <File.h>
     54#include <Locale.h>
    5355#include <NodeInfo.h>
    5456#include <NodeMonitor.h>
    5557#include <Path.h>
     
    8385}
    8486
    8587
     88#undef B_TRANSLATE_CONTEXT
     89#define B_TRANSLATE_CONTEXT "libTracker"
     90
    8691Model::Model()
    8792    :
    8893    fPreferredAppName(NULL),
     
    328333const char *
    329334Model::Name() const
    330335{
     336    static const char* kRootNodeName = B_TRANSLATE_MARK("Disks");
     337    static const char* kTrashNodeName = B_TRANSLATE_MARK("Trash");
     338    static const char* kDesktopNodeName = B_TRANSLATE_MARK("Desktop");
     339
    331340    switch (fBaseType) {
    332341        case kRootNode:
    333             return "Disks";
     342            return B_TRANSLATE(kRootNodeName);
    334343           
    335344        case kVolumeNode:
    336345            if (fVolumeName)
    337346                return fVolumeName;
    338347            break;
    339                
    340348        case kTrashNode:
    341             return "Trash";
     349            return B_TRANSLATE(kTrashNodeName);
    342350       
    343351        case kDesktopNode:
    344             return "Desktop";
     352            return B_TRANSLATE(kDesktopNodeName);
    345353           
    346354        default:
    347355            break;
  • DirMenu.cpp

     
    3535// ToDo:
    3636// get rid of fMenuBar, SetMenuBar and related mess
    3737
     38#include <Catalog.h>
    3839#include <Debug.h>
    3940#include <Directory.h>
     41#include <Locale.h>
    4042#include <MenuBar.h>
    4143#include <Path.h>
    4244#include <Volume.h>
     
    5254#include "Utilities.h"
    5355
    5456
     57
     58#undef B_TRANSLATE_CONTEXT
     59#define B_TRANSLATE_CONTEXT "libTracker"
     60
    5561BDirMenu::BDirMenu(BMenuBar *bar, uint32 command, const char *entryName)
    5662    :   BPopUpMenu("directories"),
    5763        fMenuBar(bar),
     
    8389        ThrowOnInitCheckError(&model);
    8490   
    8591        ModelMenuItem *menu = new ModelMenuItem(&model, this, true, true);
    86    
     92
    8793        if (fMenuBar)
    8894            fMenuBar->AddItem(menu);
    8995   
     
    143149                        AddDisksIconToMenu(reverse);
    144150                    entry = desktopEntry;
    145151                }
    146                
    147152                if (entry == desktopEntry)
    148153                    hitRoot = true;
    149154            }
    150                
    151155            if (result == kReadAttrFailed || !info.fInvisible
    152156                || (showDesktop && desktopEntry == entry))
    153157                AddItemToDirMenu(&entry, originatingWindow, reverse,
     
    165169        // select last item in menu
    166170        if (!select)
    167171            return;
    168            
    169172        ModelMenuItem *item = dynamic_cast<ModelMenuItem *>(ItemAt(CountItems() - 1));
    170173        if (item) {
    171174            item->SetMarked(true);
     
    249252    BMessage *message = new BMessage(fCommand);
    250253    message->AddRef(fEntryName.String(), model.EntryRef());
    251254
    252     ModelMenuItem *item = new ModelMenuItem(&model, "Disks", message);
     255    ModelMenuItem* item = new ModelMenuItem(&model,
     256        B_TRANSLATE("Disks"),
     257        message);
    253258    if (atEnd)
    254259        AddItem(item);
    255260    else
  • TrackerInitialState.cpp

     
    3737// important sniffer rules
    3838
    3939#include <Alert.h>
     40#include <Catalog.h>
    4041#include <Directory.h>
    4142#include <InterfaceDefs.h>
     43#include <Locale.h>
    4244#include <Message.h>
    4345#include <Node.h>
    4446#include <Path.h>
     
    330332// #pragma mark -
    331333
    332334
     335#undef B_TRANSLATE_CONTEXT
     336#define B_TRANSLATE_CONTEXT "libTracker"
     337
    333338bool
    334339TTracker::InstallMimeIfNeeded(const char *type, int32 bitsID,
    335340    const char *shortDescription, const char *longDescription,
     
    592597    BPath path;
    593598    status_t status = find_directory(B_SYSTEM_DATA_DIRECTORY, &path);
    594599    if (status < B_OK) {
    595         BString errorMessage;
    596         errorMessage << "At " << __PRETTY_FUNCTION__ << "\n";
    597         errorMessage << "find_directory() failed. \nReason: ";
    598         errorMessage << strerror(status);
    599         (new BAlert("AlertError", errorMessage.String(), "OK", NULL, NULL,
    600             B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
     600        BString errorMessage(B_TRANSLATE("At %func \nfind_directory() failed. \nReason: %error"));
     601        errorMessage.ReplaceFirst("%func", __PRETTY_FUNCTION__);
     602        errorMessage.ReplaceFirst("%error", strerror(status));
     603        (new BAlert("AlertError", errorMessage.String(),
     604            B_TRANSLATE("OK"),
     605            NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
    601606        return;
    602607    }
    603608    path.Append("artwork");
  • SelectionWindow.cpp

     
    3535#include <BeBuild.h>
    3636#include <Alert.h>
    3737#include <Box.h>
     38#include <Catalog.h>
     39#include <Locale.h>
    3840#include <MenuItem.h>
    3941
    4042#include "AutoLock.h"
     
    4749
    4850const uint32 kSelectButtonPressed = 'sbpr';
    4951
    50 SelectionWindow::SelectionWindow(BContainerWindow *window)
    51     : BWindow(BRect(0, 0, 270, 0), "Select", B_TITLED_WINDOW,
     52#undef B_TRANSLATE_CONTEXT
     53#define B_TRANSLATE_CONTEXT "libTracker"
     54
     55SelectionWindow::SelectionWindow(BContainerWindow* window)
     56    : BWindow(BRect(0, 0, 270, 0),
     57        B_TRANSLATE("Select"),
     58        B_TITLED_WINDOW,
    5259        B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_V_RESIZABLE
    5360        | B_NO_WORKSPACE_ACTIVATION | B_ASYNCHRONOUS_CONTROLS
    5461        | B_NOT_ANCHORED_ON_ACTIVATE),
     
    6774    AddChild(backgroundView);
    6875
    6976    BMenu *menu = new BPopUpMenu("");
    70     menu->AddItem(new BMenuItem("starts with", NULL));
    71     menu->AddItem(new BMenuItem("ends with", NULL));
    72     menu->AddItem(new BMenuItem("contains", NULL));
    73     menu->AddItem(new BMenuItem("matches wildcard expression", NULL));
    74     menu->AddItem(new BMenuItem("matches regular expression", NULL));
     77    menu->AddItem(new BMenuItem(
     78        B_TRANSLATE("starts with"),
     79        NULL));
     80    menu->AddItem(new BMenuItem(
     81        B_TRANSLATE("ends with"),
     82        NULL));
     83    menu->AddItem(new BMenuItem(
     84        B_TRANSLATE("contains"),
     85        NULL));
     86    menu->AddItem(new BMenuItem(
     87        B_TRANSLATE("matches wildcard expression"),
     88        NULL));
     89    menu->AddItem(new BMenuItem(
     90        B_TRANSLATE("matches regular expression"),
     91        NULL));
    7592
    7693    menu->SetLabelFromMarked(true);
    7794    menu->ItemAt(3)->SetMarked(true);
     
    7996
    8097    // Set up the menu field
    8198    fMatchingTypeMenuField = new BMenuField(BRect(7, 6, Bounds().right - 5, 0),
    82         NULL, "Name", menu);
     99        NULL, B_TRANSLATE("Name"), menu);
    83100    backgroundView->AddChild(fMatchingTypeMenuField);
    84     fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth("Name") + 8);
     101    fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth(
     102        B_TRANSLATE("Name")) + 8);
    85103    fMatchingTypeMenuField->ResizeToPreferred();
    86104
    87105    // Set up the expression text control
     
    93111    fExpressionTextControl->MakeFocus(true);
    94112
    95113    // Set up the Invert checkbox
    96     fInverseCheckBox = new BCheckBox(BRect(7, fExpressionTextControl->Frame().bottom
    97         + 6, 6, 6), NULL, "Invert", NULL);
     114    fInverseCheckBox = new BCheckBox(
     115        BRect(7, fExpressionTextControl->Frame().bottom + 6, 6, 6),
     116        NULL,
     117        B_TRANSLATE("Invert"),
     118        NULL);
    98119    backgroundView->AddChild(fInverseCheckBox);
    99120    fInverseCheckBox->ResizeToPreferred();
    100121
    101122    // Set up the Ignore Case checkbox
    102     fIgnoreCaseCheckBox = new BCheckBox(BRect(fInverseCheckBox->Frame().right + 10,
    103         fInverseCheckBox->Frame().top, 6, 6), NULL, "Ignore case", NULL);
     123    fIgnoreCaseCheckBox = new BCheckBox(
     124        BRect(fInverseCheckBox->Frame().right + 10,
     125        fInverseCheckBox->Frame().top,
     126        6, 6),
     127        NULL,
     128        B_TRANSLATE("Ignore case"),
     129        NULL);
    104130    fIgnoreCaseCheckBox->SetValue(1);
    105131    backgroundView->AddChild(fIgnoreCaseCheckBox);
    106132    fIgnoreCaseCheckBox->ResizeToPreferred();
    107133
    108134    // Set up the Select button
    109     fSelectButton = new BButton(BRect(0, 0, 5, 5), NULL, "Select",
     135    fSelectButton = new BButton(
     136        BRect(0, 0, 5, 5),
     137        NULL,
     138        B_TRANSLATE("Select"),
    110139        new BMessage(kSelectButtonPressed), B_FOLLOW_RIGHT);
    111140
    112141    backgroundView->AddChild(fSelectButton);
     
    125154    float topMiddleButton =
    126155        (fSelectButton->Bounds().Height() / 2 -
    127156        (fh.ascent + fh.descent + fh.leading + 4) / 2) + fSelectButton->Frame().top;
    128     fInverseCheckBox->MoveTo(fInverseCheckBox->Frame().left, topMiddleButton);
    129     fIgnoreCaseCheckBox->MoveTo(fIgnoreCaseCheckBox->Frame().left, topMiddleButton);
     157    fInverseCheckBox->MoveTo(fInverseCheckBox->Frame().left,
     158        topMiddleButton);
     159    fIgnoreCaseCheckBox->MoveTo(fIgnoreCaseCheckBox->Frame().left,
     160        topMiddleButton);
    130161
    131162    float bottomMinWidth = 32 + fSelectButton->Bounds().Width() +
    132163        fInverseCheckBox->Bounds().Width() + fIgnoreCaseCheckBox->Bounds().Width();
    133     float topMinWidth = be_plain_font->StringWidth("Name matches wildcard expression:###");
     164    float topMinWidth = be_plain_font->StringWidth(B_TRANSLATE("Name matches wildcard expression:###"));
    134165    float minWidth = bottomMinWidth > topMinWidth ? bottomMinWidth : topMinWidth;
    135166
    136167    Run();
  • FindPanel.cpp

     
    3535#include <Application.h>
    3636#include <Box.h>
    3737#include <Button.h>
     38#include <Catalog.h>
    3839#include <CheckBox.h>
    3940#include <Debug.h>
    4041#include <Directory.h>
    4142#include <FindDirectory.h>
    4243#include <File.h>
    4344#include <FilePanel.h>
     45#include <Locale.h>
    4446#include <MenuField.h>
    4547#include <MenuItem.h>
    4648#include <Mime.h>
     
    7375#include "Tracker.h"
    7476#include "Utilities.h"
    7577
     78
     79#undef B_TRANSLATE_CONTEXT
     80#define B_TRANSLATE_CONTEXT "libTracker"
     81
    7682const char *kAllMimeTypes = "mime/ALLTYPES";
    7783
    7884const BRect kInitialRect(100, 100, 530, 210);
     
    8591const uint32 kSwitchToQueryTemplate = 'swqt';
    8692const uint32 kRunSaveAsTemplatePanel = 'svtm';
    8793
    88 const char *kDragNDropTypes [] = { B_QUERY_MIMETYPE, B_QUERY_TEMPLATE_MIMETYPE };
    89 const char *kDragNDropActionSpecifiers [] = { "Create a Query", "Create a Query template" };
     94const char* kDragNDropTypes [] = {
     95    B_QUERY_MIMETYPE,
     96    B_QUERY_TEMPLATE_MIMETYPE };
     97static const char *kDragNDropActionSpecifiers [] = {
     98    B_TRANSLATE_MARK("Create a Query"),
     99    B_TRANSLATE_MARK("Create a Query template") };
    90100
    91101const uint32 kAttachFile = 'attf';
    92102
     
    125135
    126136
    127137void
    128 MoreOptionsStruct::EndianSwap(void *)
     138MoreOptionsStruct::EndianSwap(void*)
    129139{
    130140    // noop for now
    131141}
     
    162172//  #pragma mark -
    163173
    164174
    165 FindWindow::FindWindow(const entry_ref *newRef, bool editIfTemplateOnly)
    166     :   BWindow(kInitialRect, "Find", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
     175FindWindow::FindWindow(const entry_ref* newRef, bool editIfTemplateOnly)
     176    :   BWindow(kInitialRect,
     177        B_TRANSLATE("Find"),
     178        B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
    167179        fFile(TryOpening(newRef)),
    168180        fFromTemplate(false),
    169181        fEditTemplateOnly(false),
     
    176188            if (BNodeInfo(fFile).GetType(type) == B_OK
    177189                && strcasecmp(type, B_QUERY_TEMPLATE_MIMETYPE) == 0) {
    178190                fEditTemplateOnly = true;
    179                 SetTitle("Edit Query template");
     191                SetTitle(B_TRANSLATE("Edit Query template"));
    180192            }
    181193        }
    182194    } else {
     
    205217
    206218    fFromTemplate = IsQueryTemplate(fFile);
    207219
    208     fBackground = new FindPanel(Bounds(), fFile, this, fFromTemplate, fEditTemplateOnly);
     220    fBackground = new FindPanel(Bounds(),
     221        fFile, this, fFromTemplate, fEditTemplateOnly);
    209222    AddChild(fBackground);
    210223}
    211224
     
    362375
    363376    // save date/time info for recent query support and transient query killer
    364377    int32 currentTime = (int32)time(0);
    365     file->WriteAttr(kAttrQueryLastChange, B_INT32_TYPE, 0, &currentTime, sizeof(int32));
     378    file->WriteAttr(kAttrQueryLastChange,
     379        B_INT32_TYPE, 0, &currentTime, sizeof(int32));
    366380    int32 tmp = 1;
    367381    file->WriteAttr("_trk/recentQuery", B_INT32_TYPE, 0, &tmp, sizeof(int32));
    368382}
     
    380394        // and the file's location
    381395        FSSetPoseLocation(entry, *oldLocation);
    382396
    383     BNodeInfo(file).SetType(queryTemplate ? B_QUERY_TEMPLATE_MIMETYPE : B_QUERY_MIMETYPE);
     397    BNodeInfo(file).SetType(
     398        queryTemplate
     399        ? B_QUERY_TEMPLATE_MIMETYPE
     400        : B_QUERY_MIMETYPE);
    384401
    385402    BString predicate;
    386403    bool dynamicDate;
     
    434451        // write out all the dialog items as attributes so that the query can
    435452        // be reopened and edited later
    436453
    437     BView *focusedItem = CurrentFocus();
     454    BView* focusedItem = CurrentFocus();
    438455    if (focusedItem) {
    439456        // text controls never get the focus, their internal text views do
    440         BView *parent = focusedItem->Parent();
     457        BView* parent = focusedItem->Parent();
    441458        if (dynamic_cast<BTextControl *>(parent))
    442459            focusedItem = parent;
    443460
    444461        // write out the current focus and, if text control, selection
    445462        BString name(focusedItem->Name());
    446463        file->WriteAttrString("_trk/focusedView", &name);
    447         BTextControl *textControl = dynamic_cast<BTextControl *>(focusedItem);
     464        BTextControl* textControl = dynamic_cast<BTextControl *>(focusedItem);
    448465        if (textControl) {
    449466            int32 selStart, selEnd;
    450467            textControl->TextView()->GetSelection(&selStart, &selEnd);
     
    474491    if (!FindSaveCommon(true)) {
    475492        // have to wait for the node monitor to force old query to close
    476493        // to avoid a race condition
    477         TTracker *tracker = dynamic_cast<TTracker *>(be_app);
     494        TTracker* tracker = dynamic_cast<TTracker *>(be_app);
    478495        ASSERT(tracker);
    479496        for (int32 timeOut = 0; ; timeOut++) {
    480497            if (!tracker->EntryHasWindowOpen(&fRef))
     
    494511    }
    495512
    496513    int32 currentTime = (int32)time(0);
    497     fFile->WriteAttr(kAttrQueryLastChange, B_INT32_TYPE, 0, &currentTime, sizeof(int32));
     514    fFile->WriteAttr(kAttrQueryLastChange,
     515        B_INT32_TYPE, 0, &currentTime, sizeof(int32));
    498516
    499517    // tell the tracker about it
    500518    BMessage message(B_REFS_RECEIVED);
     
    625643            else {
    626644                BMessenger panel(BackgroundView());
    627645                fSaveAsTemplatePanel = new BFilePanel(B_SAVE_PANEL, &panel);
    628                 fSaveAsTemplatePanel->SetSaveText("Query template");
    629                 fSaveAsTemplatePanel->Window()->SetTitle("Save as Query template:");
     646                fSaveAsTemplatePanel->SetSaveText(
     647                    B_TRANSLATE("Query template"));
     648                fSaveAsTemplatePanel->Window()->SetTitle(
     649                    B_TRANSLATE("Save as Query template:"));
    630650                fSaveAsTemplatePanel->Show();
    631651            }
    632652            break;
     
    666686
    667687    BMessenger self(this);
    668688    fRecentQueries = new BPopUpMenu("RecentQueries");
    669     FindPanel::AddRecentQueries(fRecentQueries, true, &self, kSwitchToQueryTemplate);
     689    FindPanel::AddRecentQueries(fRecentQueries,
     690        true, &self, kSwitchToQueryTemplate);
    670691
    671692    AddChild(new MiniMenuField(rect, "RecentQueries", fRecentQueries));
    672693
     
    680701    rect.right = rect.left + 150;
    681702    fMimeTypeField = new BMenuField(rect, "MimeTypeMenu", "", fMimeTypeMenu);
    682703    fMimeTypeField->SetDivider(0.0f);
    683     fMimeTypeField->MenuItem()->SetLabel("All files and folders");
     704    fMimeTypeField->MenuItem()->SetLabel(
     705        B_TRANSLATE("All files and folders"));
    684706    AddChild(fMimeTypeField);
    685707
    686708    // add popup for search criteria
    687709    fSearchModeMenu = new BPopUpMenu("searchMode");
    688     fSearchModeMenu->AddItem(new BMenuItem("by name", new BMessage(kByNameItem)));
    689     fSearchModeMenu->AddItem(new BMenuItem("by attribute", new BMessage(kByAttributeItem)));
    690     fSearchModeMenu->AddItem(new BMenuItem("by formula", new BMessage(kByFormulaItem)));
     710    fSearchModeMenu->AddItem(
     711        new BMenuItem(B_TRANSLATE("by name"),
     712        new BMessage(kByNameItem)));
     713    fSearchModeMenu->AddItem(
     714        new BMenuItem(B_TRANSLATE("by attribute"),
     715        new BMessage(kByAttributeItem)));
     716    fSearchModeMenu->AddItem(
     717        new BMenuItem(B_TRANSLATE("by formula"),
     718        new BMessage(kByFormulaItem)));
    691719
    692720    fSearchModeMenu->ItemAt(initialMode == kByNameItem ? 0 :
    693721        (initialMode == kByAttributeItem ? 1 : 2))->SetMarked(true);
     
    695723    rect.left = rect.right + 10;
    696724    rect.right = rect.left + 100;
    697725    rect.bottom = rect.top + 15;
    698     BMenuField *menuField = new BMenuField(rect, "", "", fSearchModeMenu);
     726    BMenuField* menuField = new BMenuField(rect, "", "", fSearchModeMenu);
    699727    menuField->SetDivider(0.0f);
    700728    AddChild(menuField);
    701729
     
    703731    rect.right = bounds.right - 15;
    704732    rect.left = rect.right - 100;
    705733    fVolMenu = new BPopUpMenu("", false, false);    // don't radioMode
    706     menuField = new BMenuField(rect, "", "On", fVolMenu);
     734    menuField = new BMenuField(rect, "",
     735        B_TRANSLATE("On"),
     736        fVolMenu);
    707737    menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 8);
    708738    AddChild(menuField);
    709739    AddVolumes(fVolMenu);
     
    715745        dragNDropMessage.AddString("be:types", B_FILE_MIME_TYPE);
    716746        dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[0]);
    717747        dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[1]);
    718         dragNDropMessage.AddString("be:actionspecifier", kDragNDropActionSpecifiers[0]);
    719         dragNDropMessage.AddString("be:actionspecifier", kDragNDropActionSpecifiers[1]);
     748        dragNDropMessage.AddString("be:actionspecifier",
     749            B_TRANSLATE(kDragNDropActionSpecifiers[0]));
     750        dragNDropMessage.AddString("be:actionspecifier",
     751            B_TRANSLATE(kDragNDropActionSpecifiers[1]));
    720752
    721753        BMessenger self(this);
    722         fDraggableIcon = new DraggableQueryIcon(DraggableIcon::PreferredRect(draggableIconOrigin,
     754        fDraggableIcon = new DraggableQueryIcon(
     755            DraggableIcon::PreferredRect(draggableIconOrigin,
    723756            B_LARGE_ICON), "saveHere", &dragNDropMessage,
    724757            self, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
    725758        AddChild(fDraggableIcon);
     
    747780    rect = expandedBounds;
    748781    rect.right = rect.left + 200;
    749782    rect.bottom = rect.top + 20;;
    750     fQueryName = new BTextControl(rect, "queryName", "Query name:", "", 0);
     783    fQueryName = new BTextControl(rect, "queryName",
     784        B_TRANSLATE("Query name:"),
     785        "", 0);
    751786    fQueryName->SetDivider(fQueryName->StringWidth(fQueryName->Label()) + 5);
    752787    fMoreOptionsPane->AddItem(fQueryName, 1);
    753788    FillCurrentQueryName(fQueryName, parent);
     
    755790    rect.top = rect.bottom + 6;
    756791    rect.bottom = rect.top + 16;
    757792    rect.right = rect.left + 100;
    758     fSearchTrashCheck = new BCheckBox(rect, "searchTrash", "Include trash", 0);
     793    fSearchTrashCheck = new BCheckBox(rect, "searchTrash",
     794        B_TRANSLATE("Include trash"),
     795        0);
    759796    fSearchTrashCheck->ResizeToPreferred();
    760797    fMoreOptionsPane->AddItem(fSearchTrashCheck, 1);
    761798
    762799    rect.OffsetBy(fSearchTrashCheck->Bounds().Width() + 8, 0);
    763     fTemporaryCheck = new BCheckBox(rect, "temporary", "Temporary", 0);
     800    fTemporaryCheck = new BCheckBox(rect, "temporary",
     801        B_TRANSLATE("Temporary"),
     802        0);
    764803    fMoreOptionsPane->AddItem(fTemporaryCheck, 1);
    765804    fTemporaryCheck->SetValue(1);
    766805
     
    787826    rect.top = rect.bottom - 30;
    788827    rect.right = rect.left + 60;
    789828    rect.bottom = rect.top + 20;
    790     BButton *button;
     829    BButton* button;
    791830    if (editTemplateOnly)
    792         button = new BButton(rect, "save", "Save",
     831        button = new BButton(rect, "save",
     832            B_TRANSLATE("Save"),
    793833            new BMessage(kSaveButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
    794834    else
    795         button = new BButton(rect, "find", "Search",
     835        button = new BButton(rect, "find",
     836            B_TRANSLATE("Search"),
    796837            new BMessage(kFindButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
    797838
    798839    AddChild(button);
     
    831872            textControl->MakeFocus();
    832873    }
    833874
    834     BButton *button = dynamic_cast<BButton *>(FindView("remove"));
     875    BButton* button = dynamic_cast<BButton *>(FindView("remove"));
    835876    if (button)
    836877        button->SetTarget(this);
    837878
     
    956997    } else if (countSelected > 1)
    957998        // if more than two disks selected, don't use the disk name
    958999        // as a label
    959         PopUpMenuSetTitle(fVolMenu, "multiple disks");
     1000        PopUpMenuSetTitle(fVolMenu,
     1001            B_TRANSLATE("multiple disks"));
    9601002    else {
    9611003        ASSERT(tmpItem);
    9621004        PopUpMenuSetTitle(fVolMenu, tmpItem->Label());
     
    10531095                Window()->ResizeTo(Window()->Frame().Width(),
    10541096                    ViewHeightForMode(kByAttributeItem, fLatch->Value() != 0));
    10551097
    1056                 BBox *box = dynamic_cast<BBox *>(FindView("Box"));
     1098                BBox* box = dynamic_cast<BBox *>(FindView("Box"));
    10571099                ASSERT(box);
    10581100                box->ResizeTo(box->Bounds().Width(),
    10591101                    BoxHeightForMode(kByAttributeItem, fLatch->Value() != 0));
     
    11091151                    bool queryTemplate = false;
    11101152
    11111153                    if (actionSpecifier
    1112                         && strcasecmp(actionSpecifier, kDragNDropActionSpecifiers[0]) == 0)
     1154                        && strcasecmp(actionSpecifier,
     1155                            B_TRANSLATE(kDragNDropActionSpecifiers[0])) == 0)
    11131156                        query = true;
    11141157                    else if (actionSpecifier
    1115                         && strcasecmp(actionSpecifier, kDragNDropActionSpecifiers[1]) == 0)
     1158                        && strcasecmp(actionSpecifier,
     1159                            B_TRANSLATE(kDragNDropActionSpecifiers[1])) == 0)
    11161160                        queryTemplate = true;
    11171161                    else if (mimeType && strcasecmp(mimeType, kDragNDropTypes[0]) == 0)
    11181162                        query = true;
     
    11371181{
    11381182    BDirectory directory(dir);
    11391183    BFile file(&directory, name, O_RDWR | O_CREAT | O_TRUNC);
    1140     BNodeInfo(&file).SetType(queryTemplate ? B_QUERY_TEMPLATE_MIMETYPE : B_QUERY_MIMETYPE);
     1184    BNodeInfo(&file).SetType(queryTemplate
     1185        ? B_QUERY_TEMPLATE_MIMETYPE
     1186        : B_QUERY_MIMETYPE);
    11411187
    11421188    BMessage attach(kAttachFile);
    11431189    attach.AddRef("directory", dir);
     
    13201366    BTextControl *textControl = dynamic_cast<BTextControl *>(FindView("TextControl"));
    13211367    switch (Mode()) {
    13221368        case kByNameItem:
    1323             result << "Name = " << textControl->TextView()->Text();
    1324             break;
     1369            result.SetTo(B_TRANSLATE_COMMENT("Name = %name", "FindResultTitle"));
     1370            result.ReplaceFirst("%name", textControl->TextView()->Text());
     1371                        break;
    13251372
    13261373        case kByFormulaItem:
    1327             result << "Formula " << textControl->TextView()->Text();
     1374            result.SetTo(B_TRANSLATE_COMMENT("Formula %formula", "FindResultTitle"));
     1375            result.ReplaceFirst("%formula", textControl->TextView()->Text());
    13281376            break;
    13291377
    13301378        case kByAttributeItem:
     
    15931641{
    15941642    BMessage *itemMessage = new BMessage(kMIMETypeItem);
    15951643    itemMessage->AddString("mimetype", kAllMimeTypes);
    1596     MimeTypeMenu()->AddItem(new BMenuItem("All files and folders", itemMessage));
     1644    MimeTypeMenu()->AddItem(
     1645        new BMenuItem(B_TRANSLATE("All files and folders"),
     1646        itemMessage));
    15971647    MimeTypeMenu()->AddSeparatorItem();
    15981648    MimeTypeMenu()->ItemAt(0)->SetMarked(true);
    15991649
     
    16731723
    16741724    BMessage *message = new BMessage(kVolumeItem);
    16751725    message->AddInt32("device", -1);
    1676     menu->AddItem(new BMenuItem("All disks", message));
     1726    menu->AddItem(
     1727        new BMenuItem(B_TRANSLATE("All disks"),
     1728        message));
    16771729    menu->AddSeparatorItem();
    1678     PopUpMenuSetTitle(menu, "All disks");
     1730    PopUpMenuSetTitle(menu, B_TRANSLATE("All disks"));
    16791731
    16801732    BVolumeRoster roster;
    16811733    BVolume volume;
     
    18131865            menu->AddSeparatorItem();
    18141866
    18151867        BMessage *message = new BMessage(kRunSaveAsTemplatePanel);
    1816         BMenuItem *item = new BMenuItem("Save Query as template"B_UTF8_ELLIPSIS, message);
     1868        BMenuItem* item =
     1869            new BMenuItem(
     1870            B_TRANSLATE("Save Query as template"B_UTF8_ELLIPSIS),
     1871            message);
    18171872        menu->AddItem(item);
    18181873    }
    18191874}
     
    18401895        BRect rect = box->Bounds();
    18411896        rect.InsetBy(5, 10);
    18421897        rect.top = rect.bottom - 20;
    1843         rect.right = rect.left + 22 + be_plain_font->StringWidth("Add");
     1898        rect.right = rect.left + 22
     1899            + be_plain_font->StringWidth(B_TRANSLATE("Add"));
    18441900
    1845         button = new BButton(rect, "add", "Add", new BMessage(kAddItem),
     1901        button = new BButton(rect, "add",
     1902            B_TRANSLATE("Add"),
     1903            new BMessage(kAddItem),
    18461904            B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
    18471905        button->SetTarget(this);
    18481906        box->AddChild(button);
    18491907
    18501908        rect.OffsetBy(rect.Width() + 6, 0);
    1851         rect.right = rect.left + 22 + be_plain_font->StringWidth("Remove");
    1852         button = new BButton(rect, "remove", "Remove", new BMessage(kRemoveItem),
     1909        rect.right = rect.left + 22
     1910            + be_plain_font->StringWidth(B_TRANSLATE("Remove"));
     1911        button = new BButton(rect, "remove",
     1912            B_TRANSLATE("Remove"),
     1913            new BMessage(kRemoveItem),
    18531914            B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
    18541915
    18551916        button->SetEnabled(false);
     
    23332394    BPopUpMenu *menu = new BPopUpMenu("PopUp");
    23342395
    23352396    // add NAME attribute to popup
    2336     BMenu *submenu = new BMenu("Name");
     2397    BMenu* submenu = new BMenu(B_TRANSLATE("Name"));
    23372398    submenu->SetRadioMode(true);
    23382399    submenu->SetFont(be_plain_font);
    23392400    BMessage *message = new BMessage(kAttributeItemMain);
     
    23422403    BMenuItem *item = new BMenuItem(submenu, message);
    23432404    menu->AddItem(item);
    23442405
    2345     const int32 operators[] = {B_CONTAINS, B_EQ, B_NE, B_BEGINS_WITH, B_ENDS_WITH};
    2346     const char *operatorLabels[] = {"contains", "is", "is not", "starts with", "ends with"};
     2406    const int32 operators[] = {
     2407        B_CONTAINS,
     2408        B_EQ,
     2409        B_NE,
     2410        B_BEGINS_WITH,
     2411        B_ENDS_WITH};
     2412    static const char *operatorLabels[] = {
     2413        B_TRANSLATE_MARK("contains"),
     2414        B_TRANSLATE_MARK("is"),
     2415        B_TRANSLATE_MARK("is not"),
     2416        B_TRANSLATE_MARK("starts with"),
     2417        B_TRANSLATE_MARK("ends with")};
    23472418
    2348     for (int32 i = 0;i < 5;i++) {
     2419    for (int32 i = 0; i < 5; i++) {
    23492420        message = new BMessage(kAttributeItem);
    23502421        message->AddInt32("operator", operators[i]);
    2351         submenu->AddItem(new BMenuItem(operatorLabels[i], message));
     2422        submenu->AddItem(new BMenuItem(
     2423            B_TRANSLATE(operatorLabels[i]),
     2424            message));
    23522425    }
    23532426
    23542427    // mark first item
     
    23562429    submenu->ItemAt(0)->SetMarked(true);
    23572430
    23582431    // add SIZE attribute
    2359     submenu = new BMenu("Size");
     2432    submenu = new BMenu(B_TRANSLATE("Size"));
    23602433    submenu->SetRadioMode(true);
    23612434    submenu->SetFont(be_plain_font);
    23622435    message = new BMessage(kAttributeItemMain);
     
    23672440
    23682441    message = new BMessage(kAttributeItem);
    23692442    message->AddInt32("operator", B_GE);
    2370     submenu->AddItem(new BMenuItem("greater than", message));
     2443    submenu->AddItem(new BMenuItem(
     2444        B_TRANSLATE("greater than"), message));
    23712445
    23722446    message = new BMessage(kAttributeItem);
    23732447    message->AddInt32("operator", B_LE);
    2374     submenu->AddItem(new BMenuItem("less than", message));
     2448    submenu->AddItem(new BMenuItem(
     2449        B_TRANSLATE("less than"), message));
    23752450
    23762451    message = new BMessage(kAttributeItem);
    23772452    message->AddInt32("operator", B_EQ);
    2378     submenu->AddItem(new BMenuItem("is", message));
     2453    submenu->AddItem(new BMenuItem(
     2454        B_TRANSLATE("is"), message));
    23792455
    23802456    // add "modified" field
    2381     submenu = new BMenu("Modified");
     2457    submenu = new BMenu(
     2458        B_TRANSLATE("Modified"));
    23822459    submenu->SetRadioMode(true);
    23832460    submenu->SetFont(be_plain_font);
    23842461    message = new BMessage(kAttributeItemMain);
     
    23892466
    23902467    message = new BMessage(kAttributeItem);
    23912468    message->AddInt32("operator", B_LE);
    2392     submenu->AddItem(new BMenuItem("before", message));
     2469    submenu->AddItem(new BMenuItem(
     2470        B_TRANSLATE("before"), message));
    23932471
    23942472    message = new BMessage(kAttributeItem);
    23952473    message->AddInt32("operator", B_GE);
    2396     submenu->AddItem(new BMenuItem("after", message));
     2474    submenu->AddItem(new BMenuItem(
     2475        B_TRANSLATE("after"), message));
    23972476
    23982477    BRect bounds(Bounds());
    23992478    bounds.right = bounds.left + 100;
     
    25182597    BPopUpMenu *menu = new BPopUpMenu("");
    25192598    BMessage *message = new BMessage();
    25202599    message->AddInt32("combine", B_AND);
    2521     BMenuItem *item = new BMenuItem("And", message);
     2600    BMenuItem* item = new BMenuItem(
     2601        B_TRANSLATE("And"), message);
    25222602    menu->AddItem(item);
    25232603    if (selectAnd)
    25242604        item->SetMarked(true);
    25252605
    25262606    message = new BMessage();
    25272607    message->AddInt32("combine", B_OR);
    2528     item = new BMenuItem("Or", message);
     2608    item = new BMenuItem(
     2609        B_TRANSLATE("Or"), message);
    25292610    menu->AddItem(item);
    25302611    if (!selectAnd)
    25312612        item->SetMarked(true);
     
    26542735            case B_STRING_TYPE:
    26552736                message = new BMessage(kAttributeItem);
    26562737                message->AddInt32("operator", B_CONTAINS);
    2657                 submenu->AddItem(new BMenuItem("contains", message));
     2738                submenu->AddItem(new BMenuItem(
     2739                    B_TRANSLATE("contains"),
     2740                    message));
    26582741
    26592742                message = new BMessage(kAttributeItem);
    26602743                message->AddInt32("operator", B_EQ);
    2661                 submenu->AddItem(new BMenuItem("is", message));
     2744                submenu->AddItem(
     2745                    new BMenuItem(B_TRANSLATE("is"),
     2746                    message));
    26622747
    26632748                message = new BMessage(kAttributeItem);
    26642749                message->AddInt32("operator", B_NE);
    2665                 submenu->AddItem(new BMenuItem("is not", message));
     2750                submenu->AddItem(
     2751                    new BMenuItem(B_TRANSLATE("is not"),
     2752                    message));
    26662753                submenu->SetTargetForItems(this);
    26672754
    26682755                message = new BMessage(kAttributeItem);
    26692756                message->AddInt32("operator", B_BEGINS_WITH);
    2670                 submenu->AddItem(new BMenuItem("starts with", message));
     2757                submenu->AddItem(
     2758                    new BMenuItem(B_TRANSLATE("starts with"),
     2759                    message));
    26712760                submenu->SetTargetForItems(this);
    26722761
    26732762                message = new BMessage(kAttributeItem);
    26742763                message->AddInt32("operator", B_ENDS_WITH);
    2675                 submenu->AddItem(new BMenuItem("ends with", message));
     2764                submenu->AddItem(
     2765                    new BMenuItem(B_TRANSLATE("ends with"),
     2766                    message));
    26762767                break;
    26772768
    26782769            case B_BOOL_TYPE:
     
    26892780            case B_DOUBLE_TYPE:
    26902781                message = new BMessage(kAttributeItem);
    26912782                message->AddInt32("operator", B_EQ);
    2692                 submenu->AddItem(new BMenuItem("is", message));
     2783                submenu->AddItem(
     2784                    new BMenuItem(B_TRANSLATE("is"),
     2785                    message));
    26932786
    26942787                message = new BMessage(kAttributeItem);
    26952788                message->AddInt32("operator", B_GE);
    2696                 submenu->AddItem(new BMenuItem("greater than", message));
     2789                submenu->AddItem(
     2790                    new BMenuItem(B_TRANSLATE("greater than"),
     2791                    message));
    26972792
    26982793                message = new BMessage(kAttributeItem);
    26992794                message->AddInt32("operator", B_LE);
    2700                 submenu->AddItem(new BMenuItem("less than", message));
     2795                submenu->AddItem(
     2796                    new BMenuItem(B_TRANSLATE("less than"),
     2797                    message));
    27012798                break;
    27022799
    27032800            case B_TIME_TYPE:
    27042801                message = new BMessage(kAttributeItem);
    27052802                message->AddInt32("operator", B_LE);
    2706                 submenu->AddItem(new BMenuItem("before", message));
     2803                submenu->AddItem(
     2804                    new BMenuItem(B_TRANSLATE("before"),
     2805                    message));
    27072806
    27082807                message = new BMessage(kAttributeItem);
    27092808                message->AddInt32("operator", B_GE);
    2710                 submenu->AddItem(new BMenuItem("after", message));
     2809                submenu->AddItem(
     2810                    new BMenuItem(B_TRANSLATE("after"),
     2811                    message));
    27112812                break;
    27122813        }
    27132814        submenu->SetTargetForItems(this);
     
    29903091    ASSERT(window);
    29913092    dragMessage->AddString("be:clip_name",
    29923093        window->BackgroundView()->UserSpecifiedName() ?
    2993             window->BackgroundView()->UserSpecifiedName() : "New Query");
     3094            window->BackgroundView()->UserSpecifiedName()
     3095            : B_TRANSLATE("New Query"));
    29943096
    29953097    return true;
    29963098}
  • FilePermissionsView.cpp

     
    3838#include <stdlib.h>
    3939
    4040#include <Beep.h>
     41#include <Catalog.h>
     42#include <Locale.h>
    4143
    4244
    4345const uint32 kPermissionsChanged = 'prch';
     
    4547const uint32 kNewGroupEntered = 'nwgr';
    4648
    4749
     50#undef B_TRANSLATE_CONTEXT
     51#define B_TRANSLATE_CONTEXT "libTracker"
     52
    4853FilePermissionsView::FilePermissionsView(BRect rect, Model *model)
    4954    :   BView(rect, "FilePermissionsView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW),
    5055        fModel(model)
     
    6368    strView->SetFontSize(kAttribFontHeight);
    6469
    6570    strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
    66         + kColumnLabelSpacing, kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2
    67         + kColumnLabelSpacing, kColumnLabelBottom), "", "Group");
     71        + kColumnLabelSpacing,
     72        kColumnLabelTop,
     73        kColumnLabelMiddle + kColumnLabelWidth / 2
     74        + kColumnLabelSpacing,
     75        kColumnLabelBottom),
     76        "", B_TRANSLATE("Group"));
    6877    AddChild(strView);
    6978    strView->SetAlignment(B_ALIGN_CENTER);
    7079    strView->SetFontSize(kAttribFontHeight);
    7180
    7281    strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
    73         + 2 * kColumnLabelSpacing, kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2
    74         + 2 * kColumnLabelSpacing, kColumnLabelBottom), "", "Other");
     82        + 2 * kColumnLabelSpacing,
     83        kColumnLabelTop,
     84        kColumnLabelMiddle + kColumnLabelWidth / 2
     85        + 2 * kColumnLabelSpacing,
     86        kColumnLabelBottom),
     87        "", B_TRANSLATE("Other"));
    7588    AddChild(strView);
    7689    strView->SetAlignment(B_ALIGN_CENTER);
    7790    strView->SetFontSize(kAttribFontHeight);
     
    8295        - kColumnLabelWidth / 2 - 5, kRowLabelHeight = 14;
    8396
    8497    strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop, kRowLabelRight,
    85         kRowLabelTop + kRowLabelHeight), "", "Read");
     98        kRowLabelTop + kRowLabelHeight),
     99        "", B_TRANSLATE("Read"));
    86100    AddChild(strView);
    87101    strView->SetAlignment(B_ALIGN_RIGHT);
    88102    strView->SetFontSize(kAttribFontHeight);
    89103
    90104    strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop
    91105        + kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop
    92         + kRowLabelVerticalSpacing + kRowLabelHeight), "", "Write");
     106        + kRowLabelVerticalSpacing + kRowLabelHeight),
     107        "", B_TRANSLATE("Write"));
    93108    AddChild(strView);
    94109    strView->SetAlignment(B_ALIGN_RIGHT);
    95110    strView->SetFontSize(kAttribFontHeight);
    96111
    97112    strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop
    98113        + 2 * kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop
    99         + 2 * kRowLabelVerticalSpacing + kRowLabelHeight), "", "Execute");
     114        + 2 * kRowLabelVerticalSpacing + kRowLabelHeight),
     115        "", B_TRANSLATE("Execute"));
    100116    AddChild(strView);
    101117    strView->SetAlignment(B_ALIGN_RIGHT);
    102118    strView->SetFontSize(kAttribFontHeight);
     
    126142    const float kTextControlLeft = 170, kTextControlRight = 270,
    127143        kTextControlTop = kColumnLabelTop, kTextControlHeight = 14, kTextControlSpacing = 16;
    128144
    129     strView = new BStringView(BRect(kTextControlLeft, kTextControlTop, kTextControlRight,
    130         kTextControlTop + kTextControlHeight), "", "Owner");
     145    strView = new BStringView(BRect(kTextControlLeft,
     146        kTextControlTop, kTextControlRight,
     147        kTextControlTop + kTextControlHeight),
     148        "", B_TRANSLATE("Owner"));
    131149    strView->SetAlignment(B_ALIGN_CENTER);
    132150    strView->SetFontSize(kAttribFontHeight);
    133151    AddChild(strView);
     
    138156    fOwnerTextControl->SetDivider(0);
    139157    AddChild(fOwnerTextControl);
    140158
    141     strView = new BStringView(BRect(kTextControlLeft, kTextControlTop + 5
    142         + 2 * kTextControlSpacing, kTextControlRight, kTextControlTop + 2
    143         + 2 * kTextControlSpacing + kTextControlHeight), "", "Group");
     159    strView = new BStringView(BRect(kTextControlLeft,
     160        kTextControlTop + 5 + 2 * kTextControlSpacing,
     161        kTextControlRight,
     162        kTextControlTop + 2 + 2 * kTextControlSpacing + kTextControlHeight),
     163        "", B_TRANSLATE("Group"));
    144164    strView->SetAlignment(B_ALIGN_CENTER);
    145165    strView->SetFontSize(kAttribFontHeight);
    146166    AddChild(strView);
  • CountView.cpp

     
    3737#include "CountView.h"
    3838
    3939#include <Application.h>
     40#include <Catalog.h>
    4041#include <ControlLook.h>
     42#include <Locale.h>
    4143
    4244#include "AutoLock.h"
    4345#include "Bitmaps.h"
    4446#include "ContainerWindow.h"
    4547#include "DirMenu.h"
    4648#include "PoseView.h"
     49#include "Utilities.h"
    4750
    4851
    4952const bigtime_t kBarberPoleDelay = 500000;
    5053
    5154
     55#undef B_TRANSLATE_CONTEXT
     56#define B_TRANSLATE_CONTEXT "libTracker"
     57
    5258BCountView::BCountView(BRect bounds, BPoseView* view)
    5359    : BView(bounds, "CountVw", B_FOLLOW_LEFT + B_FOLLOW_BOTTOM,
    5460            B_PULSE_NEEDED | B_WILL_DRAW),
     
    217223        itemString << fLastCount << " " << Filter();
    218224    } else {
    219225        if (fLastCount == 0)
    220             itemString << "no items";
     226            itemString << B_TRANSLATE("no items");
    221227        else if (fLastCount == 1)
    222             itemString << "1 item";
    223         else
    224             itemString << fLastCount << " items";
     228            itemString << B_TRANSLATE("1 item");
     229        else {
     230            itemString.SetTo(B_TRANSLATE("%num items"));
     231            char numString[256];
     232            sprintf(numString, "%ld", fLastCount);
     233            itemString.ReplaceFirst("%num", numString);
     234        }
    225235    }
    226236
    227     BString string(itemString);
    228237    BRect textRect(TextInvalRect());
    229238
    230     TruncateString(&string, IsTypingAhead() ? B_TRUNCATE_BEGINNING
     239    TruncateString(&itemString, IsTypingAhead() ? B_TRUNCATE_BEGINNING
    231240            : IsFiltering() ? B_TRUNCATE_MIDDLE : B_TRUNCATE_END,
    232241        textRect.Width());
    233242
     
    238247        SetHighColor(0, 0, 0);
    239248
    240249    MovePenTo(textRect.LeftBottom());
    241     DrawString(string.String());
     250    DrawString(itemString.String());
    242251
    243252    bounds.top++;
    244253
  • FavoritesMenu.cpp

     
    3737#include <compat/sys/stat.h>
    3838
    3939#include <Application.h>
     40#include <Catalog.h>
    4041#include <FindDirectory.h>
    4142#include <FilePanel.h>
     43#include <Locale.h>
    4244#include <Message.h>
    4345#include <Path.h>
    4446#include <Query.h>
     
    5658#include "Utilities.h"
    5759
    5860
     61
     62#undef B_TRANSLATE_CONTEXT
     63#define B_TRANSLATE_CONTEXT "libTracker"
     64
    5965FavoritesMenu::FavoritesMenu(const char *title, BMessage *openFolderMessage,
    6066    BMessage *openFileMessage, const BMessenger &target,
    6167    bool isSavePanel, BRefFilter *filter)
     
    166172
    167173            if (!fAddedSeparatorForSection) {
    168174                fAddedSeparatorForSection = true;
    169                 AddItem(new TitledSeparatorItem("Favorites"));
     175                AddItem(new TitledSeparatorItem(
     176                    B_TRANSLATE("Favorites")));
    170177            }
    171178            fUniqueRefCheck.push_back(*model.EntryRef());
    172179            AddItem(item);
     
    211218                if (item) {
    212219                    if (!fAddedSeparatorForSection) {
    213220                        fAddedSeparatorForSection = true;
    214                         AddItem(new TitledSeparatorItem("Recent documents"));
     221                        AddItem(new TitledSeparatorItem(
     222                            B_TRANSLATE("Recent documents")));
    215223                    }
    216224                    AddItem(item);
    217225                    fSectionItemCount++;
     
    253261
    254262            if (!ShouldShowModel(&model))
    255263                return true;
    256            
    257264            BMenuItem *item = BNavMenu::NewModelItem(&model, fOpenFolderMessage,
    258265                fTarget, true);
    259266            if (item) {
    260267                if (!fAddedSeparatorForSection) {
    261268                    fAddedSeparatorForSection = true;
    262                     AddItem(new TitledSeparatorItem("Recent folders"));
     269                    AddItem(new TitledSeparatorItem(
     270                        B_TRANSLATE("Recent folders")));
    263271                }
    264272                AddItem(item);
    265273                item->SetEnabled(true);
     
    436444    //
    437445
    438446    if (CountItems() <= 0) {
    439         BMenuItem *item = new BMenuItem("<No recent items>", 0);
     447        BMenuItem* item = new BMenuItem(
     448            B_TRANSLATE("<No recent items>"), 0);
    440449        item->SetEnabled(false);
    441450        AddItem(item);
    442451    } else