Ticket #5573: Deskbar.2.patch

File Deskbar.2.patch, 17.6 KB (added by mt, 14 years ago)

patch 2 (TR_MARKing the strings outside of the #if block)

  • BarApp.h

     
    3636
    3737
    3838#include <Application.h>
     39#include <Catalog.h>
    3940#include <List.h>
    4041#include "BarWindow.h"
    4142#include "PreferencesWindow.h"
     
    178179        static BLocker sSubscriberLock;
    179180        static BList sBarTeamInfoList;
    180181        static BList sSubscribers;
     182
     183        BCatalog fCatalog;
    181184};
    182185
    183186#endif  // BAR_APP_H
  • BeMenu.cpp

     
    3434
    3535#include <Debug.h>
    3636#include <Bitmap.h>
     37#include <Catalog.h>
    3738#include <Dragger.h>
     39#include <Locale.h>
    3840#include <Menu.h>
    3941#include <MenuItem.h>
    4042#include <Roster.h>
     
    5052#include "StatusView.h"
    5153#include "tracker_private.h"
    5254
     55#undef TR_CONTEXT
     56#define TR_CONTEXT "BeMenu"
     57
    5358#define ROSTER_SIG "application/x-vnd.Be-ROST"
    5459
    5560#ifdef MOUNT_MENU_IN_DESKBAR
     
    6772namespace BPrivate {
    6873    BMenu* TrackerBuildRecentFindItemsMenu(const char*);
    6974}
     75
     76
    7077using namespace BPrivate;
    7178
    7279
     
    134141TBeMenu::DoneBuildingItemList()
    135142{
    136143    if (fItemList->CountItems() <= 0) {
    137         BMenuItem* item = new BMenuItem("<Be folder is empty>", 0);
     144        BMenuItem* item = new BMenuItem(TR("<Be folder is empty>"), 0);
    138145        item->SetEnabled(false);
    139146        AddItem(item);
    140147    } else
     
    150157
    151158    TrackingHookData* data = fBarView->GetTrackingHookData();
    152159    if (fAddState == kAddingRecents) {
    153         const char* recentTitle[] = {"Recent documents", "Recent folders",
    154             "Recent applications"};
     160        static const char* recentTitle[] = {TR_MARK("Recent documents"),
     161            TR_MARK("Recent folders"), TR_MARK("Recent applications")};
    155162        const int recentType[] = {kRecentDocuments, kRecentFolders,
    156163            kRecentApplications};
    157164        const int recentTypes = 3;
     
    160167        bool enabled = false;
    161168
    162169        for (int i = 0; i < recentTypes; i++) {
    163             recentItem[i] = new TRecentsMenu(recentTitle[i], fBarView,
     170            recentItem[i] = new TRecentsMenu(TR(recentTitle[i]), fBarView,
    164171                recentType[i]);
    165172
    166173            if (recentItem[i])
     
    226233    BMenuItem* item;
    227234    BRoster roster;
    228235    if (!roster.IsRunning(kTrackerSignature)) {
    229         item = new BMenuItem("Restart Tracker", new BMessage(kRestartTracker));
     236        item = new BMenuItem(TR("Restart Tracker"), new BMessage(kRestartTracker));
    230237        AddItem(item);
    231238        AddSeparatorItem();
    232239    }
    233240
     241    static const char* kAboutHaikuMenuItemStr = TR_MARK(
     242        "About Haiku" B_UTF8_ELLIPSIS);
     243    static const char* kAboutThisSystemMenuItemStr = TR_MARK(
     244        "About this system" B_UTF8_ELLIPSIS);
     245
    234246    item = new BMenuItem(
    235247#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
    236     "About Haiku"
     248    TR(kAboutHaikuMenuItemStr)
    237249#else
    238     "About this system"
     250    TR(kAboutThisSystemMenuItemStr)
    239251#endif
    240         B_UTF8_ELLIPSIS, new BMessage(kShowSplash));
     252        , new BMessage(kShowSplash));
    241253    item->SetEnabled(!dragging);
    242254    AddItem(item);
    243255
     256    static const char* kFindMenuItemStr = TR_MARK("Find" B_UTF8_ELLIPSIS);
     257
    244258#ifdef SHOW_RECENT_FIND_ITEMS
    245     item = new BMenuItem(TrackerBuildRecentFindItemsMenu("Find"B_UTF8_ELLIPSIS),
     259    item = new BMenuItem(
     260        TrackerBuildRecentFindItemsMenu(kFindMenuItemStr),
    246261        new BMessage(kFindButton));
    247262#else
    248     item = new BMenuItem("Find"B_UTF8_ELLIPSIS, new BMessage(kFindButton));
     263    item = new BMenuItem(TR(kFindMenuItemStr), new BMessage(kFindButton));
    249264#endif
    250265    item->SetEnabled(!dragging);
    251266    AddItem(item);
    252267
    253     item = new BMenuItem("Show replicants", new BMessage(kToggleDraggers));
     268    item = new BMenuItem(TR("Show replicants"), new BMessage(kToggleDraggers));
    254269    item->SetEnabled(!dragging);
    255270    item->SetMarked(BDragger::AreDraggersDrawn());
    256271    AddItem(item);
    257272
     273    static const char* kMountMenuStr = TR_MARK("Mount");
     274
    258275#ifdef MOUNT_MENU_IN_DESKBAR
    259     DeskbarMountMenu* mountMenu = new DeskbarMountMenu("Mount");
     276    DeskbarMountMenu* mountMenu = new DeskbarMountMenu(TR(kMountMenuStr));
    260277    mountMenu->SetEnabled(!dragging);
    261278    AddItem(mountMenu);
    262279#endif
    263280
    264     item = new BMenuItem("Deskbar preferences" B_UTF8_ELLIPSIS,
     281    item = new BMenuItem(TR("Deskbar preferences" B_UTF8_ELLIPSIS),
    265282        new BMessage(kConfigShow));
    266283    item->SetTarget(be_app);
    267284    AddItem(item);
    268285
    269286    AddSeparatorItem();
    270287
    271     BMenu* shutdownMenu = new BMenu("Shutdown" B_UTF8_ELLIPSIS);
     288    BMenu* shutdownMenu = new BMenu(TR("Shutdown" B_UTF8_ELLIPSIS));
    272289
    273     item = new BMenuItem("Restart system", new BMessage(kRebootSystem));
     290    item = new BMenuItem(TR("Restart system"), new BMessage(kRebootSystem));
    274291    item->SetEnabled(!dragging);
    275292    shutdownMenu->AddItem(item);
    276293
     294    static const char* kSuspendMenuItemStr = TR_MARK("Suspend");
     295
    277296#ifdef APM_SUPPORT
    278297    if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
    279         item = new BMenuItem("Suspend", new BMessage(kSuspendSystem));
     298        item = new BMenuItem(kSuspendMenuItemStr), new BMessage(kSuspendSystem));
    280299        item->SetEnabled(!dragging);
    281300        shutdownMenu->AddItem(item);
    282301    }
    283302#endif
    284303
    285     item = new BMenuItem("Power off", new BMessage(kShutdownSystem));
     304    item = new BMenuItem(TR("Power off"), new BMessage(kShutdownSystem));
    286305    item->SetEnabled(!dragging);
    287306    shutdownMenu->AddItem(item);
    288307    shutdownMenu->SetFont(be_plain_font);
     
    367386
    368387    if (expando && vertical && fBarView->Left()) {
    369388        PRINT(("Left\n"));
    370         point = rect.RightTop() + BPoint(0,3);
     389        point = rect.RightTop() + BPoint(0, 3);
    371390    } else if (expando && vertical && !fBarView->Left()) {
    372391        PRINT(("Right\n"));
    373         point = rect.LeftTop() - BPoint(Bounds().Width(), 0) + BPoint(0,3);
     392        point = rect.LeftTop() - BPoint(Bounds().Width(), 0) + BPoint(0, 3);
    374393    } else
    375394        point = BMenu::ScreenLocation();
    376395
     
    633652    return false;
    634653}
    635654
     655
    636656#endif
    637657
  • StatusView.cpp

     
    4747#include <Application.h>
    4848#include <Beep.h>
    4949#include <Bitmap.h>
     50#include <Catalog.h>
    5051#include <ControlLook.h>
    5152#include <Directory.h>
    5253#include <FindDirectory.h>
     54#include <Locale.h>
    5355#include <MenuItem.h>
    5456#include <NodeInfo.h>
    5557#include <NodeMonitor.h>
     
    118120#endif  /* DB_ADDONS */
    119121
    120122
     123#undef TR_CONTEXT
     124#define TR_CONTEXT "Tray"
     125
    121126// don't change the name of this view to anything other than "Status"!
    122127
    123128TReplicantTray::TReplicantTray(TBarView* parent, bool vertical)
     
    163168    Window()->SetPulseRate(1000000);
    164169    DealWithClock(fBarView->ShowingClock());
    165170
     171
    166172#ifdef DB_ADDONS
    167173    // load addons and rehydrate archives
    168174#if !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST)
     
    412418    if (fBarView->ShowingClock())
    413419        fClock->ShowClockOptions(ConvertToScreen(point));
    414420    else {
    415         BMenuItem* item = new BMenuItem("Show Time", new BMessage('time'));
     421        BMenuItem* item = new BMenuItem(TR("Show Time"), new BMessage('time'));
    416422        menu->AddItem(item);
    417423        menu->SetTargetForItems(this);
    418424        BPoint where = ConvertToScreen(point);
     
    562568
    563569
    564570bool
    565 TReplicantTray::IsAddOn(entry_ref &ref)
     571TReplicantTray::IsAddOn(entry_ref& ref)
    566572{
    567573    BFile file(&ref, B_READ_ONLY);
    568574
     
    574580
    575581
    576582DeskbarItemInfo*
    577 TReplicantTray::DeskbarItemFor(node_ref &nodeRef)
     583TReplicantTray::DeskbarItemFor(node_ref& nodeRef)
    578584{
    579585    for (int32 i = fItemList->CountItems(); i-- > 0 ;) {
    580586        DeskbarItemInfo* item = (DeskbarItemInfo*)fItemList->ItemAt(i);
     
    606612
    607613
    608614bool
    609 TReplicantTray::NodeExists(node_ref &nodeRef)
     615TReplicantTray::NodeExists(node_ref& nodeRef)
    610616{
    611617    return DeskbarItemFor(nodeRef) != NULL;
    612618}
     
    837843
    838844
    839845status_t
    840 TReplicantTray::AddItem(int32 id, node_ref nodeRef, BEntry &entry, bool isAddOn)
     846TReplicantTray::AddItem(int32 id, node_ref nodeRef, BEntry& entry, bool isAddOn)
    841847{
    842848    DeskbarItemInfo* item = new DeskbarItemInfo;
    843849    if (item == NULL)
     
    12001206    *index = -1;
    12011207   
    12021208    BView* view;
    1203     if (byIndex){
     1209    if (byIndex) {
    12041210        if (fShelf->ReplicantAt(target, &view, (uint32*)id)) {
    12051211            if (view) {
    12061212                *index = target;
     
    13861392        fRightBottomReplicant.Set(0, 0, 0, 0);
    13871393
    13881394    BView* view = NULL;
    1389     for (int32 i = startIndex ; i < count ; i++){
     1395    for (int32 i = startIndex ; i < count ; i++) {
    13901396        fShelf->ReplicantAt(i, &view);
    13911397        if (view != NULL) {
    13921398            BPoint loc = LocationForReplicant(i, view->Frame().Width());
     
    14591465{
    14601466    if (fBarView->Left() && fBarView->Vertical() && fDragLocation
    14611467        != kNoDragRegion)
    1462         fChild->MoveTo(5,2);
     1468        fChild->MoveTo(5, 2);
    14631469    else
    1464         fChild->MoveTo(2,2);
     1470        fChild->MoveTo(2, 2);
    14651471}
    14661472
    14671473
     
    15721578    dragRegion.top += kTopBottomInset;
    15731579    dragRegion.bottom -= kTopBottomInset;
    15741580
    1575     bool placeOnLeft=false;
     1581    bool placeOnLeft = false;
    15761582    if (fDragLocation == kAutoPlaceDragRegion) {
    15771583        if (fBarView->Vertical() && fBarView->Left())
    15781584            placeOnLeft = true;
     
    16081614    if (!dragRegion.Contains(thePoint))
    16091615        return;
    16101616
    1611     while(true) {
     1617    while (true) {
    16121618        GetMouse(&where, &buttons);
    16131619        if (!buttons)
    16141620            break;
  • Jamfile

     
    3939    ResourceSet.cpp
    4040    Switcher.cpp
    4141    $(targetSource)
    42     : be tracker $(targetLib) $(TARGET_LIBSUPC++)
     42    : be tracker liblocale.so $(targetLib) $(TARGET_LIBSUPC++)
    4343    ;
    4444
     45DoCatalogs Deskbar :
     46    application/x-vnd.Be-TSKB
     47    :
     48    BeMenu.cpp
     49    PreferencesWindow.cpp
     50    StatusView.cpp
     51    TimeView.cpp
     52    WindowMenu.cpp
     53    ;
  • TimeView.cpp

     
    3737
    3838#include <string.h>
    3939
     40#include <Catalog.h>
    4041#include <Debug.h>
     42#include <Locale.h>
    4143#include <MenuItem.h>
    4244#include <MessageRunner.h>
    4345#include <PopUpMenu.h>
     
    6668};
    6769
    6870
     71#undef TR_CONTEXT
     72#define TR_CONTEXT "TimeView"
     73
    6974TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
    7075    bool milTime, bool fullDate, bool euroDate, bool)
    7176    :
     
    171176    // overlap the bevels in the parent view.
    172177    if (ShowingDate())
    173178        *width = fOrientation ?
    174              min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fDateStr))
    175              : kHMargin + StringWidth(fDateStr);
     179            min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fDateStr))
     180            : kHMargin + StringWidth(fDateStr);
    176181    else {
    177182        *width = fOrientation ?
    178              min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr))
    179              : kHMargin + StringWidth(fTimeStr);
     183            min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr))
     184            : kHMargin + StringWidth(fTimeStr);
    180185    }
    181186}
    182187
     
    295300        // use the doubleClickSpeed as a threshold
    296301
    297302    fLongClickMessageRunner = new BMessageRunner(BMessenger(this),
    298          &longClickMessage, longClickThreshold, 1);
     303        &longClickMessage, longClickThreshold, 1);
    299304}
    300305
    301306
     
    323328    }
    324329
    325330    //  remove leading 0 from time when hour is less than 10
    326     const char *str = tmp;
     331    const char* str = tmp;
    327332    if (str[0] == '0')
    328333        str++;
    329334
     
    544549    BRect rectArray[1];
    545550    escapement_delta delta = { 0.0, 0.0 };
    546551    font.GetBoundingBoxesForStrings(stringArray, 1, B_SCREEN_METRIC, &delta,
    547          rectArray);
     552        rectArray);
    548553
    549554    fTimeLocation.y = fDateLocation.y = ceilf((bounds.Height() -
    550555        rectArray[0].Height() + 1.0) / 2.0 - rectArray[0].top);
     
    558563    menu->SetFont(be_plain_font);
    559564    BMenuItem* item;
    560565
    561     item = new BMenuItem("Change time" B_UTF8_ELLIPSIS,
     566    item = new BMenuItem(TR("Change time" B_UTF8_ELLIPSIS),
    562567        new BMessage(kChangeClock));
    563568    menu->AddItem(item);
    564569
    565     item = new BMenuItem("Hide time", new BMessage('time'));
     570    item = new BMenuItem(TR("Hide time"), new BMessage('time'));
    566571    menu->AddItem(item);
    567572
    568     item = new BMenuItem("Show calendar" B_UTF8_ELLIPSIS,
     573    item = new BMenuItem(TR("Show calendar" B_UTF8_ELLIPSIS),
    569574        new BMessage(kShowCalendar));
    570575    menu->AddItem(item);
    571576
  • WindowMenu.cpp

     
    3535#include <malloc.h>
    3636#include <stdio.h>
    3737#include <string.h>
     38#include <Catalog.h>
     39#include <Locale.h>
    3840#include <Window.h>
    3941
    4042#include "BarApp.h"
     
    5860const int32 kSystemFloater = 6;
    5961
    6062
     63#undef TR_CONTEXT
     64#define TR_CONTEXT "WindowMenu"
     65
    6166bool
    6267TWindowMenu::WindowShouldBeListed(uint32 behavior)
    6368{
     
    173178    int32 itemCount = CountItems() + parentMenuItems;
    174179    if (itemCount < 1) {
    175180        TWindowMenuItem* noWindowsItem =
    176             new TWindowMenuItem("No windows", -1, false, false);
     181            new TWindowMenuItem(TR("No windows"), -1, false, false);
    177182
    178183        noWindowsItem->SetEnabled(false);
    179184
     
    183188        // it. (but we only add this option if the application is not Tracker.)
    184189        if (fApplicationSignature.ICompare(kTrackerSignature) != 0) {
    185190            AddSeparatorItem();
    186             AddItem(new TShowHideMenuItem("Quit application", fTeam,
     191            AddItem(new TShowHideMenuItem(TR("Quit application"), fTeam,
    187192                B_QUIT_REQUESTED));
    188193        }
    189194    } else {
     
    191196        //  to the menu
    192197        if (!dragging) {
    193198            TShowHideMenuItem* hide =
    194                 new TShowHideMenuItem("Hide all", fTeam, B_MINIMIZE_WINDOW);
     199                new TShowHideMenuItem(TR("Hide all"), fTeam, B_MINIMIZE_WINDOW);
    195200            TShowHideMenuItem* show =
    196                 new TShowHideMenuItem("Show all", fTeam, B_BRING_TO_FRONT);
     201                new TShowHideMenuItem(TR("Show all"), fTeam, B_BRING_TO_FRONT);
    197202            TShowHideMenuItem* close =
    198                 new TShowHideMenuItem("Close all", fTeam, B_QUIT_REQUESTED);
     203                new TShowHideMenuItem(TR("Close all"), fTeam, B_QUIT_REQUESTED);
    199204
    200205            if (miniCount == itemCount)
    201206                hide->SetEnabled(false);
  • BarApp.cpp

     
    3939#include <AppFileInfo.h>
    4040#include <Autolock.h>
    4141#include <Bitmap.h>
     42#include <Catalog.h>
    4243#include <Directory.h>
    4344#include <Dragger.h>
    4445#include <File.h>
    4546#include <FindDirectory.h>
     47#include <Locale.h>
    4648#include <Mime.h>
    4749#include <Path.h>
    4850#include <Roster.h>
     
    9395    InitSettings();
    9496    InitIconPreloader();
    9597
     98    be_locale->GetAppCatalog(&fCatalog);
    9699    be_roster->StartWatching(this);
    97100
    98101    sBarTeamInfoList.MakeEmpty();
  • PreferencesWindow.cpp

     
    99
    1010#include "PreferencesWindow.h"
    1111
     12#include <Catalog.h>
    1213#include <CheckBox.h>
    1314#include <GroupLayout.h>
     15#include <Locale.h>
    1416#include <LayoutBuilder.h>
    1517#include <OpenWithTracker.h>
    1618#include <RadioButton.h>
     
    2224#include "StatusView.h"
    2325
    2426
     27#undef TR_CONTEXT
     28#define TR_CONTEXT "PreferencesWindow"
     29
    2530PreferencesWindow::PreferencesWindow(BRect frame)
    2631    :
    27     BWindow(frame, "Deskbar preferences", B_TITLED_WINDOW,
     32    BWindow(frame, TR("Deskbar preferences"), B_TITLED_WINDOW,
    2833        B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE)
    2934{
    3035    // Controls
    31     fMenuRecentDocuments = new BCheckBox("Recent documents:",
     36    fMenuRecentDocuments = new BCheckBox(TR("Recent documents:"),
    3237        new BMessage(kUpdateRecentCounts));
    33     fMenuRecentApplications = new BCheckBox("Recent applications:",
     38    fMenuRecentApplications = new BCheckBox(TR("Recent applications:"),
    3439        new BMessage(kUpdateRecentCounts));
    35     fMenuRecentFolders = new BCheckBox("Recent folders:",
     40    fMenuRecentFolders = new BCheckBox(TR("Recent folders:"),
    3641        new BMessage(kUpdateRecentCounts));
    3742
    3843    fMenuRecentDocumentCount = new BTextControl(NULL, NULL,
     
    4247    fMenuRecentFolderCount = new BTextControl(NULL, NULL,
    4348        new BMessage(kUpdateRecentCounts));
    4449
    45     fAppsSort = new BCheckBox("Sort running applications",
     50    fAppsSort = new BCheckBox(TR("Sort running applications"),
    4651        new BMessage(kSortRunningApps));
    47     fAppsSortTrackerFirst = new BCheckBox("Tracker always first",
     52    fAppsSortTrackerFirst = new BCheckBox(TR("Tracker always first"),
    4853        new BMessage(kTrackerFirst));
    49     fAppsShowExpanders = new BCheckBox("Show application expander",
     54    fAppsShowExpanders = new BCheckBox(TR("Show application expander"),
    5055        new BMessage(kSuperExpando));
    51     fAppsExpandNew = new BCheckBox("Expand new applications",
     56    fAppsExpandNew = new BCheckBox(TR("Expand new applications"),
    5257        new BMessage(kExpandNewTeams));
    5358
    54     fClock24Hours = new BCheckBox("24 hour clock", new BMessage(kMilTime));
    55     fClockSeconds = new BCheckBox("Show seconds",
     59    fClock24Hours = new BCheckBox(TR("24 hour clock"), new BMessage(kMilTime));
     60    fClockSeconds = new BCheckBox(TR("Show seconds"),
    5661        new BMessage(kShowSeconds));
    57     fClockEuropeanDate = new BCheckBox("European date",
     62    fClockEuropeanDate = new BCheckBox(TR("European date"),
    5863        new BMessage(kEuroDate));
    59     fClockFullDate = new BCheckBox("Full date", new BMessage(kFullDate));
     64    fClockFullDate = new BCheckBox(TR("Full date"), new BMessage(kFullDate));
    6065
    61     fWindowAlwaysOnTop = new BCheckBox("Always on top",
     66    fWindowAlwaysOnTop = new BCheckBox(TR("Always on top"),
    6267        new BMessage(kAlwaysTop));
    63     fWindowAutoRaise = new BCheckBox("Auto-raise", new BMessage(kAutoRaise));
     68    fWindowAutoRaise = new BCheckBox(TR("Auto-raise"), new BMessage(kAutoRaise));
    6469
    6570    BTextView* docTextView = fMenuRecentDocumentCount->TextView();
    6671    BTextView* appTextView = fMenuRecentApplicationCount->TextView();
     
    149154    fClockBox = new BBox("fClockBox");
    150155    fWindowBox = new BBox("fWindowBox");
    151156
    152     fMenuBox->SetLabel("Menu");
    153     fAppsBox->SetLabel("Applications");
    154     fClockBox->SetLabel("Clock");
    155     fWindowBox->SetLabel("Window");
     157    fMenuBox->SetLabel(TR("Menu"));
     158    fAppsBox->SetLabel(TR("Applications"));
     159    fClockBox->SetLabel(TR("Clock"));
     160    fWindowBox->SetLabel(TR("Window"));
    156161
    157162    BView* view;
    158163    view = BLayoutBuilder::Group<>()
     
    169174                    .Add(fMenuRecentApplicationCount)
    170175                    .End()
    171176                .End()
    172             .Add(new BButton("Edit menu" B_UTF8_ELLIPSIS,
     177            .Add(new BButton(TR("Edit menu" B_UTF8_ELLIPSIS),
    173178                new BMessage(kEditMenuInTracker)))
    174179            .SetInsets(10, 10, 10, 10)
    175180            .End()