Ticket #5889: tracker.patch
File tracker.patch, 181.9 KB (added by , 14 years ago) |
---|
-
VolumeWindow.cpp
32 32 All rights reserved. 33 33 */ 34 34 35 #include <Catalog.h> 35 36 #include <Debug.h> 37 #include <Locale.h> 36 38 #include <Menu.h> 37 39 #include <MenuBar.h> 38 40 #include <MenuItem.h> … … 47 49 #include "MountMenu.h" 48 50 49 51 52 53 #undef B_TRANSLATE_CONTEXT 54 #define B_TRANSLATE_CONTEXT "libTracker" 55 50 56 BVolumeWindow::BVolumeWindow(LockingList<BWindow> *windowList, uint32 openFlags) 51 57 : BContainerWindow(windowList, openFlags) 52 58 { … … 79 85 } 80 86 } 81 87 82 BMenuItem *item = fMenuBar->FindItem("Unmount"); 88 BMenuItem* item = fMenuBar->FindItem( 89 B_TRANSLATE("Unmount")); 83 90 if (item) 84 91 item->SetEnabled(ejectableVolumeSelected); 85 92 } … … 88 95 void 89 96 BVolumeWindow::AddFileMenu(BMenu *menu) 90 97 { 91 menu->AddItem(new BMenuItem("Find"B_UTF8_ELLIPSIS, 98 menu->AddItem(new BMenuItem( 99 B_TRANSLATE("Find"B_UTF8_ELLIPSIS), 92 100 new BMessage(kFindButton), 'F')); 93 101 menu->AddSeparatorItem(); 94 102 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')); 98 112 99 BMenuItem *item = new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U'); 113 BMenuItem* item = new BMenuItem( 114 B_TRANSLATE("Unmount"), 115 new BMessage(kUnmountVolume), 'U'); 100 116 item->SetEnabled(false); 101 117 menu->AddItem(item); 102 118 103 menu->AddItem(new BMenuItem("Mount settings" B_UTF8_ELLIPSIS, 119 menu->AddItem(new BMenuItem( 120 B_TRANSLATE("Mount settings" B_UTF8_ELLIPSIS), 104 121 new BMessage(kRunAutomounterSettings))); 105 122 106 123 menu->AddSeparatorItem(); 107 menu->AddItem(new BMenu(kAddOnsMenuName)); 124 menu->AddItem(new BMenu( 125 B_TRANSLATE("Add-ons"))); 108 126 menu->SetTargetForItems(PoseView()); 109 127 } 110 128 … … 118 136 return; 119 137 } 120 138 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))); 124 148 menu->AddSeparatorItem(); 125 149 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'); 127 153 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')); 132 166 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'); 134 170 menu->AddItem(closeItem); 135 171 menu->AddSeparatorItem(); 136 172 137 menu->AddItem(new MountMenu("Mount")); 173 menu->AddItem(new MountMenu( 174 B_TRANSLATE("Mount"))); 138 175 menu->AddSeparatorItem(); 139 176 140 menu->AddItem(new BMenu(kAddOnsMenuName)); 177 menu->AddItem(new BMenu( 178 B_TRANSLATE("Add-ons"))); 141 179 142 180 // target items as needed 143 181 menu->SetTargetForItems(PoseView()); -
SettingsViews.cpp
43 43 44 44 #include <Box.h> 45 45 #include <Button.h> 46 #include <Catalog.h> 47 #include <Locale.h> 46 48 #include <MenuField.h> 47 49 #include <ColorControl.h> 48 50 #include <NodeMonitor.h> … … 78 80 // #pragma mark - 79 81 80 82 83 #undef B_TRANSLATE_CONTEXT 84 #define B_TRANSLATE_CONTEXT "libTracker" 85 81 86 SettingsView::SettingsView(BRect rect, const char *name) 82 87 : BView(rect, name, B_FOLLOW_ALL, 0) 83 88 { … … 164 169 : SettingsView(rect, "DesktopSettingsView") 165 170 { 166 171 rect.OffsetTo(B_ORIGIN); 167 fShowDisksIconRadioButton = new BRadioButton(rect, "", "Show Disks icon", 172 fShowDisksIconRadioButton = new BRadioButton(rect, "", 173 B_TRANSLATE("Show Disks icon"), 168 174 new BMessage(kShowDisksIconChanged)); 169 175 fShowDisksIconRadioButton->ResizeToPreferred(); 170 176 AddChild(fShowDisksIconRadioButton); … … 173 179 rect.OffsetBy(0, itemSpacing); 174 180 175 181 fMountVolumesOntoDesktopRadioButton = new BRadioButton(rect, "", 176 "Show volumes on Desktop", new BMessage(kVolumesOnDesktopChanged)); 182 B_TRANSLATE("Show volumes on Desktop"), 183 new BMessage(kVolumesOnDesktopChanged)); 177 184 AddChild(fMountVolumesOntoDesktopRadioButton); 178 185 fMountVolumesOntoDesktopRadioButton->ResizeToPreferred(); 179 186 180 187 rect.OffsetBy(20, itemSpacing); 181 188 182 189 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)); 184 192 AddChild(fMountSharedVolumesOntoDesktopCheckBox); 185 193 fMountSharedVolumesOntoDesktopCheckBox->ResizeToPreferred(); 186 194 … … 188 196 189 197 rect = Bounds(); 190 198 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), 192 201 new BMessage(kRunAutomounterSettings), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); 193 202 fMountButton->ResizeToPreferred(); 194 203 fMountButton->MoveBy(0, -fMountButton->Bounds().Height()); … … 409 418 : SettingsView(rect, "WindowsSettingsView") 410 419 { 411 420 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"), 413 423 new BMessage(kWindowsShowFullPathChanged)); 414 424 fShowFullPathInTitleBarCheckBox->ResizeToPreferred(); 415 425 AddChild(fShowFullPathInTitleBarCheckBox); … … 417 427 const float itemSpacing = fShowFullPathInTitleBarCheckBox->Bounds().Height() + kItemExtraSpacing; 418 428 rect.OffsetBy(0, itemSpacing); 419 429 420 fSingleWindowBrowseCheckBox = new BCheckBox(rect, "", "Single window navigation", 430 fSingleWindowBrowseCheckBox = new BCheckBox(rect, "", 431 B_TRANSLATE("Single window navigation"), 421 432 new BMessage(kSingleWindowBrowseChanged)); 422 433 fSingleWindowBrowseCheckBox->ResizeToPreferred(); 423 434 AddChild(fSingleWindowBrowseCheckBox); 424 435 425 436 rect.OffsetBy(20, itemSpacing); 426 437 427 fShowNavigatorCheckBox = new BCheckBox(rect, "", "Show navigator", 438 fShowNavigatorCheckBox = new BCheckBox(rect, "", 439 B_TRANSLATE("Show navigator"), 428 440 new BMessage(kShowNavigatorChanged)); 429 441 fShowNavigatorCheckBox->ResizeToPreferred(); 430 442 AddChild(fShowNavigatorCheckBox); 431 443 432 444 rect.OffsetBy(-20, itemSpacing); 433 445 434 fOutlineSelectionCheckBox = new BCheckBox(rect, "", "Outline selection rectangle only", 446 fOutlineSelectionCheckBox = new BCheckBox(rect, "", 447 B_TRANSLATE("Outline selection rectangle only"), 435 448 new BMessage(kTransparentSelectionChanged)); 436 449 fOutlineSelectionCheckBox->ResizeToPreferred(); 437 450 AddChild(fOutlineSelectionCheckBox); 438 451 439 452 rect.OffsetBy(0, itemSpacing); 440 453 441 fSortFolderNamesFirstCheckBox = new BCheckBox(rect, "", "List folders first", 454 fSortFolderNamesFirstCheckBox = new BCheckBox(rect, "", 455 B_TRANSLATE("List folders first"), 442 456 new BMessage(kSortFolderNamesFirstChanged)); 443 457 fSortFolderNamesFirstCheckBox->ResizeToPreferred(); 444 458 AddChild(fSortFolderNamesFirstCheckBox); 445 459 446 460 rect.OffsetBy(0, itemSpacing); 447 461 448 fTypeAheadFilteringCheckBox = new BCheckBox(rect, "", "Enable type-ahead filtering", 462 fTypeAheadFilteringCheckBox = new BCheckBox(rect, "", 463 B_TRANSLATE("Enable type-ahead filtering"), 449 464 new BMessage(kTypeAheadFilteringChanged)); 450 465 fTypeAheadFilteringCheckBox->ResizeToPreferred(); 451 466 AddChild(fTypeAheadFilteringCheckBox); … … 714 729 715 730 rect.bottom = ceilf(fontHeight.ascent + fontHeight.descent) + 10; 716 731 BBox *clockBox = new BBox(rect, "Clock"); 717 clockBox->SetLabel( "Clock");732 clockBox->SetLabel(B_TRANSLATE("Clock")); 718 733 AddChild(clockBox); 719 734 720 735 rect.left = 8; 721 736 rect.top = rect.bottom - 8; 722 f24HrRadioButton = new BRadioButton(rect, "", "24 hour", 737 f24HrRadioButton = new BRadioButton(rect, "", 738 B_TRANSLATE("24 hour"), 723 739 new BMessage(kSettingsContentsModified)); 724 740 f24HrRadioButton->ResizeToPreferred(); 725 741 clockBox->AddChild(f24HrRadioButton); … … 727 743 const float itemSpacing = f24HrRadioButton->Bounds().Height() + kItemExtraSpacing; 728 744 rect.OffsetBy(0, itemSpacing); 729 745 730 f12HrRadioButton = new BRadioButton(rect, "", "12 hour", 746 f12HrRadioButton = new BRadioButton(rect, "", 747 B_TRANSLATE("12 hour"), 731 748 new BMessage(kSettingsContentsModified)); 732 749 f12HrRadioButton->ResizeToPreferred(); 733 750 clockBox->AddChild(f12HrRadioButton); … … 739 756 rect = clockBox->Frame(); 740 757 rect.OffsetBy(rect.Width() + 8, 0); 741 758 BBox *dateFormatBox = new BBox(rect, "Date order"); 742 dateFormatBox->SetLabel( "Date order");759 dateFormatBox->SetLabel(B_TRANSLATE("Date order")); 743 760 AddChild(dateFormatBox); 744 761 745 762 rect = f24HrRadioButton->Frame(); 746 fYMDRadioButton = new BRadioButton(rect, "", "Year-month-day", 763 fYMDRadioButton = new BRadioButton(rect, "", 764 B_TRANSLATE("Year-month-day"), 747 765 new BMessage(kSettingsContentsModified)); 748 766 fYMDRadioButton->ResizeToPreferred(); 749 767 dateFormatBox->AddChild(fYMDRadioButton); 750 768 751 769 rect.OffsetBy(0, itemSpacing); 752 770 753 fDMYRadioButton = new BRadioButton(rect, "", "Day-month-year", 771 fDMYRadioButton = new BRadioButton(rect, "", 772 B_TRANSLATE("Day-month-year"), 754 773 new BMessage(kSettingsContentsModified)); 755 774 fDMYRadioButton->ResizeToPreferred(); 756 775 dateFormatBox->AddChild(fDMYRadioButton); 757 776 758 777 rect.OffsetBy(0, itemSpacing); 759 778 760 fMDYRadioButton = new BRadioButton(rect, "", "Month-day-year", 779 fMDYRadioButton = new BRadioButton(rect, "", 780 B_TRANSLATE("Month-day-year"), 761 781 new BMessage(kSettingsContentsModified)); 762 782 fMDYRadioButton->ResizeToPreferred(); 763 783 dateFormatBox->AddChild(fMDYRadioButton); … … 766 786 dateFormatBox->Bounds().Height()); 767 787 768 788 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))); 771 793 menu->AddItem(new BMenuItem("-", new BMessage(kSettingsContentsModified))); 772 794 menu->AddItem(new BMenuItem("/", new BMessage(kSettingsContentsModified))); 773 795 menu->AddItem(new BMenuItem("\\", new BMessage(kSettingsContentsModified))); … … 785 807 786 808 rect.OffsetBy(0, itemSpacing + 10); 787 809 788 BStringView *exampleView = new BStringView(rect, "", "Examples:");810 BStringView* exampleView = new BStringView(rect, "", B_TRANSLATE("Examples:")); 789 811 exampleView->ResizeToPreferred(); 790 812 AddChild(exampleView); 791 813 … … 1052 1074 : SettingsView(rect, "SpaceBarSettingsView") 1053 1075 { 1054 1076 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"), 1056 1079 new BMessage(kUpdateVolumeSpaceBar)); 1057 1080 fSpaceBarShowCheckBox->ResizeToPreferred(); 1058 1081 AddChild(fSpaceBarShowCheckBox); … … 1064 1087 menu->SetFont(be_plain_font); 1065 1088 1066 1089 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))); 1068 1093 item->SetMarked(true); 1069 1094 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))); 1072 1101 1073 1102 BBox *box = new BBox(rect); 1074 1103 box->SetLabel(fColorPicker = new BMenuField(rect, NULL, NULL, menu)); … … 1302 1331 : SettingsView(rect, "TrashSettingsView") 1303 1332 { 1304 1333 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"), 1306 1336 new BMessage(kDontMoveFilesToTrashChanged)); 1307 1337 fDontMoveFilesToTrashCheckBox->ResizeToPreferred(); 1308 1338 AddChild(fDontMoveFilesToTrashCheckBox); … … 1310 1340 rect = fDontMoveFilesToTrashCheckBox->Frame(); 1311 1341 rect.OffsetBy(0, fDontMoveFilesToTrashCheckBox->Bounds().Height() + kItemExtraSpacing); 1312 1342 1313 fAskBeforeDeleteFileCheckBox = new BCheckBox(rect, "", "Ask before delete", 1343 fAskBeforeDeleteFileCheckBox = new BCheckBox(rect, "", 1344 B_TRANSLATE("Ask before delete"), 1314 1345 new BMessage(kAskBeforeDeleteFileChanged)); 1315 1346 fAskBeforeDeleteFileCheckBox->ResizeToPreferred(); 1316 1347 AddChild(fAskBeforeDeleteFileCheckBox); -
InfoWindow.cpp
40 40 #include <stdlib.h> 41 41 42 42 #include <Alert.h> 43 #include <Catalog.h> 43 44 #include <Debug.h> 44 45 #include <Directory.h> 45 46 #include <File.h> 46 47 #include <Font.h> 48 #include <Locale.h> 47 49 #include <MenuField.h> 48 50 #include <Mime.h> 49 51 #include <NodeInfo.h> … … 73 75 #include "WidgetAttributeText.h" 74 76 75 77 78 #undef B_TRANSLATE_CONTEXT 79 #define B_TRANSLATE_CONTEXT "libTracker" 80 81 76 82 namespace BPrivate { 77 83 78 84 // States for tracking the mouse … … 214 220 const uint32 kPaneSwitchOpen = 2; 215 221 216 222 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 227 223 static void 228 224 OpenParentAndSelectOriginal(const entry_ref *ref) 229 225 { … … 389 385 if (!TargetModel()->IsVolume() && !TargetModel()->IsRoot()) { 390 386 if (TargetModel()->IsDirectory()) { 391 387 // 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)); 393 390 fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize", 394 391 B_NORMAL_PRIORITY, this); 395 392 resume_thread(fCalcThreadID); … … 402 399 } 403 400 } 404 401 405 BString buffer ;406 buffer << TargetModel()->Name() << " info";402 BString buffer(B_TRANSLATE_COMMENT("%name info", "InfoWindow Title")); 403 buffer.ReplaceFirst("%name", TargetModel()->Name()); 407 404 SetTitle(buffer.String()); 408 405 409 406 lock.Unlock(); … … 461 458 462 459 // Start recalculating.. 463 460 fStopCalc = false; 464 SetSizeStr("calculating" B_UTF8_ELLIPSIS); 461 SetSizeStr( 462 B_TRANSLATE("calculating" B_UTF8_ELLIPSIS)); 465 463 fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize", 466 464 B_NORMAL_PRIORITY, this); 467 465 resume_thread(fCalcThreadID); … … 652 650 void 653 651 BInfoWindow::GetSizeString(BString &result, off_t size, int32 fileCount) 654 652 { 655 char numStr[256]; 656 sprintf(numStr, "%Ld", size); 657 BString bytes; 653 char sizeString[256]; 658 654 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 } 664 671 665 uint32 numberIndex = 0; 672 char numString[16]; 673 sprintf(numString, "%ld", fileCount); 674 result.ReplaceFirst("%num", numString); 666 675 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")); 673 691 } 674 } else 675 bytes = numStr; 692 } 676 693 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); 696 697 } 697 698 698 699 … … 711 712 if (!lock) 712 713 return B_ERROR; 713 714 714 window->SetSizeStr("Error calculating folder size."); 715 window->SetSizeStr( 716 B_TRANSLATE("Error calculating folder size.")); 715 717 return B_ERROR; 716 718 } 717 719 … … 799 801 false, &message); 800 802 801 803 if (fFilePanel != NULL) { 802 fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON,"Select"); 804 fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, 805 B_TRANSLATE("Select")); 803 806 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()); 806 809 fFilePanel->Window()->SetTitle(title.String()); 807 810 fFilePanel->Show(); 808 811 fFilePanelOpen = true; … … 880 883 // Find offset for attributes, might be overiden below if there 881 884 // is a prefered handle menu displayed 882 885 currentFont.SetSize(kAttribFontHeight); 883 fDivider = currentFont.StringWidth("Modified:") + kBorderMargin + kBorderWidth + 1; 886 fDivider = currentFont.StringWidth( 887 B_TRANSLATE("Modified:")) 888 + kBorderMargin + kBorderWidth + 1; 884 889 // Add a preferred handler pop-up menu if this item 885 890 // is a file...This goes in place of the Link To: 886 891 // string... … … 897 902 fTitleRect.bottom + (lineHeight * 7), 898 903 Bounds().Width() - 5, fTitleRect.bottom + (lineHeight * 8)); 899 904 fPreferredAppMenu = new BMenuField(preferredAppRect, "", "", new BPopUpMenu("")); 900 fDivider = currentFont.StringWidth("Opens with:") + 5; 905 fDivider = currentFont.StringWidth( 906 B_TRANSLATE("Opens with:")) + 5; 901 907 fPreferredAppMenu->SetDivider(fDivider); 902 908 fDivider += (preferredAppRect.left - 2); 903 909 fPreferredAppMenu->SetFont(¤tFont); 904 910 fPreferredAppMenu->SetHighColor(kAttrTitleColor); 905 fPreferredAppMenu->SetLabel("Opens with:"); 911 fPreferredAppMenu->SetLabel( 912 B_TRANSLATE("Opens with:")); 906 913 907 914 char prefSignature[B_MIME_TYPE_LENGTH]; 908 915 nodeInfo.GetPreferredApp(prefSignature); … … 912 919 913 920 // Add the default menu item and set it to marked 914 921 BMenuItem *result; 915 result = new BMenuItem("Default application", new BMessage(kSetPreferredApp)); 922 result = new BMenuItem( 923 B_TRANSLATE("Default application"), 924 new BMessage(kSetPreferredApp)); 916 925 result->SetTarget(this); 917 926 fPreferredAppMenu->Menu()->AddItem(result); 918 927 result->SetMarked(true); … … 952 961 953 962 fPermissionsSwitch = new PaneSwitch(BRect(), "Permissions"); 954 963 fPermissionsSwitch->SetMessage(new BMessage(kPermissionsSelected)); 955 fPermissionsSwitch->SetLabels(NULL, "Permissions"); 964 fPermissionsSwitch->SetLabels(NULL, 965 B_TRANSLATE("Permissions")); 956 966 AddChild(fPermissionsSwitch); 957 967 fPermissionsSwitch->ResizeToPreferred(); 958 968 fPermissionsSwitch->MoveTo(kBorderWidth + 3, … … 1547 1557 return; 1548 1558 1549 1559 fFreeBytes = freeBytes; 1550 char buffer[500];1551 if (capacity >= kGBSize)1552 sprintf(buffer, "%.1f G", (float)capacity / kGBSize);1553 else1554 sprintf(buffer, "%.1f M", (float)capacity / kMBSize);1555 1560 1556 sprintf(buffer + strlen(buffer), "B (%.1f MB used -- %.1f MB free)",1557 (float)(capacity - fFreeBytes) / kMBSize,1558 1561 char capacityStr[16], usedStr[16], freeStr[16]; 1562 sprintf(usedStr, "%.1f", (float)(capacity - fFreeBytes) / kMBSize); 1563 sprintf(freeStr, "%.1f", (float)fFreeBytes / kMBSize); 1559 1564 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 1561 1576 } else if (fModel->IsFile()) { 1562 1577 // poll for size changes because they do not get node monitored 1563 1578 // until a file gets closed (with the old BFS) … … 1687 1702 // Capacity/size 1688 1703 SetHighColor(kAttrTitleColor); 1689 1704 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:")); 1692 1708 } else { 1693 MovePenTo(BPoint(fDivider - (StringWidth("Size:")), lineBase)); 1709 MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Size:"))), 1710 lineBase)); 1694 1711 fSizeRect.left = fDivider + 2; 1695 1712 fSizeRect.top = lineBase - fontMetrics.ascent; 1696 1713 fSizeRect.bottom = lineBase + fontMetrics.descent; 1697 DrawString( "Size:");1714 DrawString(B_TRANSLATE("Size:")); 1698 1715 } 1699 1716 1700 1717 MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); … … 1714 1731 1715 1732 // Created 1716 1733 SetHighColor(kAttrTitleColor); 1717 MovePenTo(BPoint(fDivider - (StringWidth("Created:")), lineBase)); 1734 MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Created:"))), 1735 lineBase)); 1718 1736 SetHighColor(kAttrTitleColor); 1719 DrawString( "Created:");1737 DrawString(B_TRANSLATE("Created:")); 1720 1738 MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); 1721 1739 SetHighColor(kAttrValueColor); 1722 1740 DrawString(fCreatedStr.String()); 1723 1741 lineBase += lineHeight; 1724 1742 1725 1743 // Modified 1726 MovePenTo(BPoint(fDivider - (StringWidth("Modified:")), lineBase)); 1744 MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Modified:"))), 1745 lineBase)); 1727 1746 SetHighColor(kAttrTitleColor); 1728 DrawString( "Modified:");1747 DrawString(B_TRANSLATE("Modified:")); 1729 1748 MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); 1730 1749 SetHighColor(kAttrValueColor); 1731 1750 DrawString(fModifiedStr.String()); 1732 1751 lineBase += lineHeight; 1733 1752 1734 1753 // Kind 1735 MovePenTo(BPoint(fDivider - (StringWidth( "Kind:")), lineBase));1754 MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Kind:"))), lineBase)); 1736 1755 SetHighColor(kAttrTitleColor); 1737 DrawString( "Kind:");1756 DrawString(B_TRANSLATE("Kind:")); 1738 1757 MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); 1739 1758 SetHighColor(kAttrValueColor); 1740 1759 DrawString(fKindStr.String()); … … 1744 1763 GetFont(&normalFont); 1745 1764 1746 1765 // Path 1747 MovePenTo(BPoint(fDivider - (StringWidth("Location:")), lineBase)); 1766 MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Location:"))), 1767 lineBase)); 1748 1768 SetHighColor(kAttrTitleColor); 1749 DrawString( "Location:");1769 DrawString(B_TRANSLATE("Location:")); 1750 1770 1751 1771 MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); 1752 1772 SetHighColor(kLinkColor); … … 1770 1790 1771 1791 // Link to/version 1772 1792 if (fModel->IsSymLink()) { 1773 MovePenTo(BPoint(fDivider - (StringWidth("Link to:")), lineBase)); 1793 MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Link to:"))), 1794 lineBase)); 1774 1795 SetHighColor(kAttrTitleColor); 1775 DrawString( "Link To:");1796 DrawString(B_TRANSLATE("Link To:")); 1776 1797 MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); 1777 1798 SetHighColor(kLinkColor); 1778 1799 … … 1795 1816 fDescRect = BRect(-1, -1, -1, -1); 1796 1817 } else if (fModel->IsExecutable()) { 1797 1818 //Version 1798 MovePenTo(BPoint(fDivider - (StringWidth("Version:")), lineBase)); 1819 MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Version:"))), 1820 lineBase)); 1799 1821 SetHighColor(kAttrTitleColor); 1800 DrawString( "Version:");1822 DrawString(B_TRANSLATE("Version:")); 1801 1823 MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); 1802 1824 SetHighColor(kAttrValueColor); 1803 1825 BString nameString; … … 1808 1830 lineBase += lineHeight; 1809 1831 1810 1832 // Description 1811 MovePenTo(BPoint(fDivider - (StringWidth("Description:")), lineBase)); 1833 MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Description:"))), 1834 lineBase)); 1812 1835 SetHighColor(kAttrTitleColor); 1813 DrawString( "Description:");1836 DrawString(B_TRANSLATE("Description:")); 1814 1837 MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); 1815 1838 SetHighColor(kAttrValueColor); 1816 1839 // Check for truncation … … 1893 1916 if (entry.InitCheck() == B_OK 1894 1917 && entry.GetParent(&parent) == B_OK) { 1895 1918 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(); 1899 1924 reopen = true; 1900 1925 } else { 1901 1926 if (fModel->IsVolume()) { … … 1914 1939 } 1915 1940 } 1916 1941 } 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(); 1920 1947 reopen = true; 1921 1948 } 1922 1949 … … 2020 2047 navigationItem->SetTarget(be_app); 2021 2048 } 2022 2049 2023 parent->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O')); 2050 parent->AddItem(new BMenuItem(B_TRANSLATE("Open"), 2051 new BMessage(kOpenSelection), 'O')); 2024 2052 2025 2053 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')); 2027 2057 parent->AddSeparatorItem(); 2028 2058 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')); 2031 2063 // volume model, enable/disable the Unmount item 2032 2064 BVolume boot; 2033 2065 BVolumeRoster().GetBootVolume(&boot); … … 2036 2068 if (volume == boot) 2037 2069 item->SetEnabled(false); 2038 2070 } else 2039 parent->AddItem(new BMenuItem("Identify", new BMessage(kIdentifyEntry))); 2071 parent->AddItem( 2072 new BMenuItem(B_TRANSLATE("Identify"), 2073 new BMessage(kIdentifyEntry))); 2040 2074 } 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))); 2042 2078 2043 2079 BMenuItem *sizeItem = NULL; 2044 2080 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"), 2046 2082 new BMessage(kRecalculateSize))); 2047 2083 } 2048 2084 2049 2085 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"), 2051 2087 new BMessage(kSetLinkTarget))); 2052 2088 } 2053 2089 2054 2090 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')); 2056 2093 2057 2094 parent->SetFont(be_plain_font); 2058 2095 parent->SetTargetForItems(this); -
TemplatesMenu.h
46 46 class TemplatesMenu : public BMenu { 47 47 public: 48 48 TemplatesMenu(const BMessenger &target, 49 const char *label = kTemplatesMenuName);49 const char *label); 50 50 virtual ~TemplatesMenu(); 51 51 52 52 -
FilePanelPriv.cpp
53 53 #include <Alert.h> 54 54 #include <Application.h> 55 55 #include <Button.h> 56 #include <Catalog.h> 56 57 #include <Debug.h> 57 58 #include <Directory.h> 58 59 #include <FindDirectory.h> 60 #include <Locale.h> 59 61 #include <MenuBar.h> 60 62 #include <MenuField.h> 61 63 #include <MenuItem.h> … … 76 78 #include <string.h> 77 79 78 80 81 79 82 const char *kDefaultFilePanelTemplate = "FilePanelSettings"; 80 83 81 82 84 static uint32 83 85 GetLinkFlavor(const Model *model, bool resolve = true) 84 86 { … … 133 135 // #pragma mark - 134 136 135 137 138 #undef B_TRANSLATE_CONTEXT 139 #define B_TRANSLATE_CONTEXT "libTracker" 140 136 141 TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target, 137 142 const BEntry *startDir, uint32 nodeFlavors, bool multipleSelection, 138 143 BMessage *message, BRefFilter *filter, uint32 containerWindowFlags, … … 441 446 fPoseView->SetRefFilter(filter); 442 447 fPoseView->CommitActivePose(); 443 448 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()); 446 452 if (menu) 447 453 menu->SetRefFilter(filter); 448 454 } … … 498 504 499 505 BTextControl *textControl = dynamic_cast<BTextControl *>(FindView("text view")); 500 506 BObjectList<BPose> *selectionList = fPoseView->SelectionList(); 501 const char *buttonText = fButtonText.String();507 BString buttonText = fButtonText; 502 508 bool enabled = false; 503 509 504 510 if (fIsSavePanel && textControl) { … … 509 515 Model *model = selectionList->FirstItem()->TargetModel(); 510 516 if (model->ResolveIfLink()->IsDirectory()) { 511 517 enabled = true; 512 buttonText = "Open";518 buttonText = B_TRANSLATE("Open"); 513 519 } else { 514 520 // insert the name of the selected model into the text field 515 521 textControl->SetText(model->Name()); … … 546 552 } 547 553 } 548 554 549 button->SetLabel(buttonText );555 button->SetLabel(buttonText.String()); 550 556 button->SetEnabled(enabled); 551 557 } 552 558 … … 597 603 AddMenus(); 598 604 AddContextMenus(); 599 605 600 FavoritesMenu *favorites = new FavoritesMenu("Favorites", 606 FavoritesMenu* favorites = new FavoritesMenu( 607 B_TRANSLATE("Favorites"), 601 608 new BMessage(kSwitchDirectory), new BMessage(B_REFS_RECEIVED), 602 609 BMessenger(this), IsSavePanel(), fPoseView->RefFilter()); 603 favorites->AddItem(new BMenuItem("Add current folder", 610 favorites->AddItem(new BMenuItem( 611 B_TRANSLATE("Add current folder"), 604 612 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), 606 615 new BMessage(kEditFavorites))); 607 616 608 617 fMenuBar->AddItem(favorites); 609 618 610 619 // configure menus 611 BMenuItem *item = fMenuBar->FindItem("Window"); 620 BMenuItem* item = fMenuBar->FindItem( 621 B_TRANSLATE("Window")); 612 622 if (item) { 613 623 fMenuBar->RemoveItem(item); 614 624 delete item; 615 625 } 616 626 617 item = fMenuBar->FindItem( "File");627 item = fMenuBar->FindItem(B_TRANSLATE("File")); 618 628 if (item) { 619 629 BMenu *menu = item->Submenu(); 620 630 if (menu) { … … 627 637 delete item; 628 638 629 639 // remove add-ons menu, identifier menu, separator 630 item = menu->FindItem( kAddOnsMenuName);640 item = menu->FindItem(B_TRANSLATE("Add-ons")); 631 641 if (item) { 632 642 int32 index = menu->IndexOf(item); 633 643 delete menu->RemoveItem(index); … … 683 693 rect.right = rect.left + 170; 684 694 rect.bottom = rect.top + 13; 685 695 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); 688 699 DisallowMetaKeys(fTextControl->TextView()); 689 700 DisallowFilenameKeys(fTextControl->TextView()); 690 701 fBackView->AddChild(fTextControl); 691 702 fTextControl->SetDivider(0.0f); 692 703 fTextControl->TextView()->SetMaxBytes(B_FILE_NAME_LENGTH - 1); 693 704 694 fButtonText = "Save";705 fButtonText.SetTo(B_TRANSLATE("Save")); 695 706 } else 696 fButtonText = "Open";707 fButtonText.SetTo(B_TRANSLATE("Open")); 697 708 698 709 rect = windRect; 699 710 rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10); … … 741 752 fBackView->AddChild(default_button); 742 753 743 754 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; 745 757 rect.left = (cancel_width > 75) ? (rect.right - cancel_width) : (rect.right - 75); 746 758 747 BButton *cancel_button = new BButton(rect, "cancel button", "Cancel", 759 BButton* cancel_button = new BButton(rect, "cancel button", 760 B_TRANSLATE("Cancel"), 748 761 new BMessage(kCancelButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); 749 762 fBackView->AddChild(cancel_button); 750 763 … … 847 860 void 848 861 TFilePanel::AddFileContextMenus(BMenu *menu) 849 862 { 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')); 855 871 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')); 858 876 // menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V')); 859 877 860 878 menu->SetTargetForItems(PoseView()); … … 864 882 void 865 883 TFilePanel::AddVolumeContextMenus(BMenu *menu) 866 884 { 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')); 870 891 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')); 873 896 // menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V')); 874 897 875 898 menu->SetTargetForItems(PoseView()); … … 879 902 void 880 903 TFilePanel::AddWindowContextMenus(BMenu *menu) 881 904 { 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'); 883 908 item->SetTarget(PoseView()); 884 909 menu->AddItem(item); 885 910 menu->AddSeparatorItem(); 886 911 887 item = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'); 912 item = new BMenuItem( 913 B_TRANSLATE("Paste"), 914 new BMessage(B_PASTE), 'V'); 888 915 item->SetTarget(PoseView()); 889 916 menu->AddItem(item); 890 917 menu->AddSeparatorItem(); 891 918 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); 894 922 item->SetTarget(PoseView()); 895 923 menu->AddItem(item); 896 924 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'); 898 928 item->SetTarget(PoseView()); 899 929 menu->AddItem(item); 900 930 901 item = new BMenuItem("Invert selection", new BMessage(kInvertSelection), 'S'); 931 item = new BMenuItem( 932 B_TRANSLATE("Invert selection"), 933 new BMessage(kInvertSelection), 'S'); 902 934 item->SetTarget(PoseView()); 903 935 menu->AddItem(item); 904 936 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); 906 940 item->SetTarget(this); 907 941 menu->AddItem(item); 908 942 } … … 1051 1085 1052 1086 // Don't allow saves of multiple files 1053 1087 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")); 1056 1091 } else { 1057 1092 // if we are a savepanel, set up the filepanel correctly 1058 1093 // then pass control so we follow the same path as if the user … … 1341 1376 BDirectory dir; 1342 1377 1343 1378 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")); 1346 1383 return; 1347 1384 } 1348 1385 1349 1386 // check for some illegal file names 1350 1387 if (strcmp(fTextControl->Text(), ".") == 0 1351 1388 || 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")); 1354 1393 fTextControl->TextView()->SelectAll(); 1355 1394 return; 1356 1395 } 1357 1396 1358 1397 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")); 1361 1402 return; 1362 1403 } 1363 1404 1364 1405 if (dir.Contains(fTextControl->Text())) { 1365 1406 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")); 1368 1411 fTextControl->TextView()->SelectAll(); 1369 1412 return; 1370 1413 } else { 1371 1414 // if this was invoked by a dbl click, it is an explicit replacement 1372 1415 // 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()); 1376 1418 1377 if (ShowCenteredAlert(str.String(), "Cancel", "Replace") == 0) { 1419 if (ShowCenteredAlert(str.String(), 1420 B_TRANSLATE("Cancel"), 1421 B_TRANSLATE("Replace")) 1422 == 0) { 1378 1423 // user canceled 1379 1424 fTextControl->TextView()->SelectAll(); 1380 1425 return; -
TrackerSettingsWindow.cpp
32 32 All rights reserved. 33 33 */ 34 34 35 #include <Catalog.h> 36 #include <Locale.h> 35 37 36 38 #include "SettingsViews.h" 37 39 #include "TrackerSettings.h" … … 63 65 const uint32 kRevertButtonPressed = 'Rebp'; 64 66 65 67 68 #undef B_TRANSLATE_CONTEXT 69 #define B_TRANSLATE_CONTEXT "libTracker" 70 66 71 TrackerSettingsWindow::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, 68 75 B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_NO_WORKSPACE_ACTIVATION 69 76 | B_NOT_ANCHORED_ON_ACTIVATE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE) 70 77 { … … 74 81 AddChild(topView); 75 82 76 83 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")) 78 86 + (float)B_V_SCROLL_BAR_WIDTH + 40.0f; 79 87 fSettingsTypeListView = new BListView(rect, "List View", B_SINGLE_SELECTION_LIST, 80 88 B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM); … … 85 93 rect = scrollView->Frame(); 86 94 rect.left = rect.right + 10; 87 95 rect.top = rect.bottom; 88 fDefaultsButton = new BButton(rect, "Defaults", "Defaults", 96 fDefaultsButton = new BButton(rect, "Defaults", 97 B_TRANSLATE("Defaults"), 89 98 new BMessage(kDefaultsButtonPressed), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); 90 99 fDefaultsButton->ResizeToPreferred(); 91 100 fDefaultsButton->SetEnabled(false); … … 93 102 94 103 rect = fDefaultsButton->Frame(); 95 104 rect.left = rect.right + 10; 96 fRevertButton = new BButton(rect, "Revert", "Revert", 105 fRevertButton = new BButton(rect, "Revert", 106 B_TRANSLATE("Revert"), 97 107 new BMessage(kRevertButtonPressed), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); 98 108 fRevertButton->SetEnabled(false); 99 109 fRevertButton->ResizeToPreferred(); … … 109 119 110 120 rect = _SettingsFrame(); 111 121 112 fSettingsTypeListView->AddItem(new SettingsItem("Desktop", 122 fSettingsTypeListView->AddItem(new SettingsItem( 123 B_TRANSLATE("Desktop"), 113 124 new DesktopSettingsView(rect))); 114 fSettingsTypeListView->AddItem(new SettingsItem("Windows", 125 fSettingsTypeListView->AddItem(new SettingsItem( 126 B_TRANSLATE("Windows"), 115 127 new WindowsSettingsView(rect))); 116 fSettingsTypeListView->AddItem(new SettingsItem("Date & Time", 128 fSettingsTypeListView->AddItem(new SettingsItem( 129 B_TRANSLATE("Date & Time"), 117 130 new TimeFormatSettingsView(rect))); 118 fSettingsTypeListView->AddItem(new SettingsItem("Trash", 131 fSettingsTypeListView->AddItem(new SettingsItem( 132 B_TRANSLATE("Trash"), 119 133 new TrashSettingsView(rect))); 120 fSettingsTypeListView->AddItem(new SettingsItem("Volume icons", 134 fSettingsTypeListView->AddItem(new SettingsItem( 135 B_TRANSLATE("Volume icons"), 121 136 new SpaceBarSettingsView(rect))); 122 137 123 138 // compute preferred view size -
NavMenu.cpp
42 42 43 43 #include <StopWatch.h> 44 44 #include <Application.h> 45 #include <Catalog.h> 45 46 #include <Directory.h> 47 #include <Locale.h> 46 48 #include <Query.h> 47 49 #include <Path.h> 48 50 #include <Screen.h> … … 79 81 { 80 82 if (!dragmessage || !incoming) 81 83 return false; 82 83 84 bool retvalue=false; 84 85 for (int32 inIndex=0; incoming->HasRef("refs", inIndex); inIndex++) { 85 86 entry_ref inRef; … … 137 138 ModelMenuItem *item = dynamic_cast<ModelMenuItem *>(menu->ItemAt(index)); 138 139 if (!item) 139 140 continue; 140 141 141 const Model *model = item->TargetModel(); 142 142 if (!model) 143 143 continue; … … 183 183 return; 184 184 185 185 nodeinfo.SetTo(&node); 186 187 186 char mimestr[B_MIME_TYPE_LENGTH]; 188 187 // add it to the list 189 188 if (nodeinfo.GetType(mimestr) == B_OK && strlen(mimestr) > 0) { … … 207 206 break; 208 207 } 209 208 } 210 211 209 if (unique) 212 210 typeslist->AddItem(new BString(mimestr)); 213 211 } … … 244 242 // #pragma mark - 245 243 246 244 245 #undef B_TRANSLATE_CONTEXT 246 #define B_TRANSLATE_CONTEXT "libTracker" 247 247 248 BNavMenu::BNavMenu(const char *title, uint32 message, const BHandler *target, 248 249 BWindow *parentWindow, const BObjectList<BString> *list) 249 250 : BSlowMenu(title), … … 574 575 575 576 PoseInfo poseInfo; 576 577 ssize_t size = -1; 577 578 578 if (result->Node()) 579 579 size = result->Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0, 580 580 &poseInfo, sizeof(poseInfo)); … … 722 722 fItemList->MakeEmpty(); 723 723 724 724 if (!count) { 725 BMenuItem *item = new BMenuItem("Empty folder", 0); 725 BMenuItem *item = new BMenuItem( 726 B_TRANSLATE("Empty folder"), 727 0); 726 728 item->SetEnabled(false); 727 729 AddItem(item); 728 730 } -
TemplatesMenu.cpp
33 33 */ 34 34 35 35 #include <Application.h> 36 #include <Catalog.h> 36 37 #include <FindDirectory.h> 37 38 #include <Directory.h> 38 39 #include <NodeInfo.h> 40 #include <Locale.h> 39 41 #include <Mime.h> 40 42 #include <Message.h> 41 43 #include <Path.h> … … 50 52 #include "IconMenuItem.h" 51 53 #include "MimeTypes.h" 52 54 55 56 #undef B_TRANSLATE_CONTEXT 57 #define B_TRANSLATE_CONTEXT "libTracker" 58 59 53 60 namespace BPrivate { 54 61 55 62 const char *kTemplatesDirectory = "Tracker/Tracker New Templates"; 56 const char *kTemplatesMenuName = "New";57 63 58 static const char *kOpenTemplatesMenuName = "Edit templates"B_UTF8_ELLIPSIS;59 64 60 65 } 61 66 … … 112 117 delete RemoveItem(0L); 113 118 114 119 // 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); 117 124 AddItem(menuItem); 118 125 menuItem->SetShortcut('N', 0); 119 126 … … 172 179 message->AddRef("refs", &dirRef); 173 180 174 181 // 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); 176 186 AddItem(fOpenItem); 177 187 if (dirRef == entry_ref()) 178 188 fOpenItem->SetEnabled(false); -
OpenWithWindow.cpp
44 44 45 45 #include <Alert.h> 46 46 #include <Button.h> 47 #include <Catalog.h> 48 #include <Locale.h> 47 49 #include <Mime.h> 48 50 #include <NodeInfo.h> 49 51 #include <Path.h> … … 55 57 #include <stdio.h> 56 58 #include <string.h> 57 59 60 58 61 const char *kDefaultOpenWithTemplate = "OpenWithSettings"; 59 60 62 // ToDo: 61 63 // filter out trash 62 64 // allow column configuring … … 70 72 const rgb_color kOpenWithDefaultColor = { 0xFF, 0xFF, 0xCC, 255}; 71 73 72 74 75 #undef B_TRANSLATE_CONTEXT 76 #define B_TRANSLATE_CONTEXT "libTracker" 77 73 78 OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen, 74 79 LockingList<BWindow> *windowList, window_look look, window_feel feel, 75 80 uint32 flags, uint32 workspace) … … 92 97 93 98 // add buttons 94 99 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); 97 104 fLaunchButton->ResizeToPreferred(); 98 105 fLaunchButton->MoveTo(rect.right - 10 - kDocumentKnobWidth 99 106 - fLaunchButton->Bounds().Width(), … … 102 109 103 110 BRect buttonRect = fLaunchButton->Frame(); 104 111 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), 106 114 B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); 107 115 // wide button, have to resize to fit text 108 116 fLaunchAndMakeDefaultButton->ResizeToPreferred(); … … 112 120 fLaunchAndMakeDefaultButton->SetEnabled(false); 113 121 114 122 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); 117 127 button->ResizeToPreferred(); 118 128 button->MoveBy(- 10 - button->Bounds().Width(), 0); 119 129 backgroundView->AddChild(button); … … 147 157 SetTitle(buffer.String()); 148 158 } else 149 159 // use generic title 150 SetTitle( "Open selection with:");160 SetTitle(B_TRANSLATE("Open selection with:")); 151 161 152 162 AddCommonFilter(new BMessageFilter(B_KEY_DOWN, &OpenWithContainerWindow::KeyDownFilter)); 153 163 } … … 377 387 message->AddInt32("attr_align", B_ALIGN_LEFT); 378 388 message->AddBool("attr_editable", false); 379 389 message->AddBool("attr_statfield", false); 380 BMenuItem *item = new BMenuItem("Relation", message); 390 BMenuItem *item = new BMenuItem( 391 B_TRANSLATE("Relation"), 392 message); 381 393 menu->AddItem(item); 382 394 message = new BMessage(kAttributeItem); 383 395 message->AddString("attr_name", kAttrAppVersion); … … 387 399 message->AddInt32("attr_align", B_ALIGN_LEFT); 388 400 message->AddBool("attr_editable", false); 389 401 message->AddBool("attr_statfield", false); 390 item = new BMenuItem("Version", message); 402 item = new BMenuItem( 403 B_TRANSLATE("Version"), 404 message); 391 405 menu->AddItem(item); 392 406 } 393 407 … … 662 676 errorString << "Could not find application \"" 663 677 << pose->TargetModel()->Name() << "\""; 664 678 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(); 667 682 return; 668 683 } 669 684 … … 677 692 "publisher of the application and ask them to update their application " 678 693 "to list the type of your document as supported."; 679 694 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); 682 699 alert->SetShortcut(0, B_ESCAPE); 683 700 if (alert->Go() == 0) 684 701 return; … … 756 773 if (fColumnList->CountItems() != 0) 757 774 return; 758 775 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, 760 779 kAttrStatName, B_STRING_TYPE, true, true); 761 780 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, 763 784 kAttrOpenWithRelation, B_STRING_TYPE, false, false); 764 785 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, 766 789 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, 768 793 kAttrAppVersion, B_STRING_TYPE, false, false)); 769 794 770 795 // sort by relation and by name … … 1152 1177 SetTargetForItems(fMessenger); 1153 1178 1154 1179 if (!CountItems()) { 1155 BMenuItem *item = new BMenuItem("no supporting apps", 0); 1180 BMenuItem* item = new BMenuItem( 1181 B_TRANSLATE("no supporting apps"), 1182 0); 1156 1183 item->SetEnabled(false); 1157 1184 AddItem(item); 1158 1185 } -
FSUtils.cpp
51 51 52 52 #include <Alert.h> 53 53 #include <Application.h> 54 #include <Catalog.h> 54 55 #include <Debug.h> 55 56 #include <Directory.h> 56 57 #include <Entry.h> 57 58 #include <FindDirectory.h> 59 #include <Locale.h> 58 60 #include <NodeInfo.h> 59 61 #include <Path.h> 60 62 #include <Roster.h> … … 99 101 100 102 namespace BPrivate { 101 103 104 #undef B_TRANSLATE_CONTEXT 105 #define B_TRANSLATE_CONTEXT "libTracker" 106 102 107 static status_t FSDeleteFolder(BEntry *, CopyLoopControl *, bool updateStatus, 103 108 bool deleteTopDir = true, bool upateFileNameInStatus = false); 104 109 static status_t MoveEntryToTrash(BEntry *, BPoint *, Undo &undo); … … 137 142 #endif 138 143 139 144 140 const char *kDeleteConfirmationStr = "Are you sure you want to delete the " 141 "selected item(s)? This operation cannot be reverted."; 145 static const char* kDeleteConfirmationStr = 146 B_TRANSLATE_MARK("Are you sure you want to delete the " 147 "selected item(s)? This operation cannot be reverted."); 142 148 143 const char *kReplaceStr = "You are trying to replace the item:\n" 144 "\t%s%s\n" 149 static const char* kReplaceStr = 150 B_TRANSLATE_MARK("You are trying to replace the item:\n" 151 "\t%name%dest\n" 145 152 "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?"); 148 155 149 const char *kDirectoryReplaceStr = "An item named \"%s\" already exists in " 156 static const char* kDirectoryReplaceStr = 157 B_TRANSLATE_MARK("An item named \"%name\" already exists in " 150 158 "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?"); 152 160 153 const char *kSymLinkReplaceStr = "An item named \"%s\" already exists in this " 161 static const char* kSymLinkReplaceStr = 162 B_TRANSLATE_MARK("An item named \"%name\" already exists in this " 154 163 "folder. Would you like to replace it with the symbolic link you are " 155 "creating?" ;164 "creating?"); 156 165 157 const char *kNoFreeSpace = "Sorry, there is not enough free space on the " 158 "destination volume to copy the selection."; 166 static const char* kNoFreeSpace = 167 B_TRANSLATE_MARK("Sorry, there is not enough free space on the " 168 "destination volume to copy the selection."); 159 169 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?"; 170 static const char* kFileErrorString = 171 B_TRANSLATE_MARK("Error copying file \"%name\":\n\t%error\n\nWould " 172 "you like to continue?"); 169 173 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?"; 174 static const char* kFolderErrorString = 175 B_TRANSLATE_MARK("Error copying folder \"%name\":\n\t%error\n\nWould you like to continue?"); 174 176 177 static const char* kFileDeleteErrorString = 178 B_TRANSLATE_MARK("There was an error deleting \"%name\"" 179 ":\n\t%error"); 180 181 static 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 186 static const char* kFindAlternativeStr = 187 B_TRANSLATE_MARK("Would you like to find some other suitable application?"); 188 189 static const char *kFindApplicationStr = B_TRANSLATE_MARK("Would you like to find a suitable " 190 "application to open the file?"); 191 175 192 // Skip these attributes when copying in Tracker 176 193 const char *kSkipAttributes[] = { 177 194 kAttrPoseInfo, … … 326 343 TrackerCopyLoopControl::FileError(const char *message, const char *name, 327 344 status_t error, bool allowContinue) 328 345 { 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)); 331 349 332 350 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); 335 355 alert->SetShortcut(0, B_ESCAPE); 336 356 return alert->Go() != 0; 337 357 } 338 358 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); 341 362 alert->SetShortcut(0, B_ESCAPE); 342 363 alert->Go(); 343 364 return false; … … 608 629 // quick way out 609 630 return true; 610 631 611 const char *warning = NULL;632 BString warning; 612 633 bool requireOverride = true; 613 634 614 635 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 " 616 638 "won't be able to boot " OS_NAME "! Are you sure you want to do " 617 "this? To % sthe 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\".")); 619 641 } 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 " 621 644 "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\".")); 623 646 requireOverride = false; 624 647 } else if (DirectoryMatchesOrContains(entry, B_USER_CONFIG_DIRECTORY) 625 648 || DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) { … … 628 651 B_USER_SETTINGS_DIRECTORY) 629 652 || DirectoryMatchesOrContains(entry, "beos_mime", 630 653 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 " 632 656 "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\".")); 634 658 requireOverride = false; 635 659 } 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 " 637 662 "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\".")); 639 664 requireOverride = false; 640 665 } else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY) 641 666 || 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 " 643 669 "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\".")); 645 671 requireOverride = false; 646 672 } 647 673 } 648 674 649 if (!warning )675 if (!warning.Length()) 650 676 return true; 651 677 652 678 if (dontAsk) … … 657 683 // we already warned about moving home this time around 658 684 return true; 659 685 660 char buffer[256]; 661 sprintf(buffer, warning, action, action); 686 warning.ReplaceAll("%action", action); 662 687 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; 670 697 } 671 698 672 699 if (confirmedAlready) { … … 687 714 int32 *collisionCount, ConflictCheckResult *preflightResult) 688 715 { 689 716 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); 693 721 alert->SetShortcut(0, B_ESCAPE); 694 722 alert->Go(); 695 723 return B_ERROR; … … 702 730 // the copy loops, except it takes forever to call CalcItemsAndSize 703 731 BEntry entry((entry_ref *)srcList->ItemAt(index)); 704 732 if (IsDisksWindowIcon(&entry)) { 705 const char *errorStr;733 BString errorStr; 706 734 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.")); 708 737 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.")); 710 740 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); 713 745 alert->SetShortcut(0, B_ESCAPE); 714 746 alert->Go(); 715 747 return B_ERROR; 716 748 } 717 749 if (moveMode == kMoveSelectionTo 718 && !ConfirmChangeIfWellKnownDirectory(&entry, "move", false, 719 &askOnceOnly)) { 750 && !ConfirmChangeIfWellKnownDirectory(&entry, 751 B_TRANSLATE("move"), 752 false, &askOnceOnly)) { 720 753 return B_ERROR; 721 754 } 722 755 } … … 753 786 754 787 // check for free space before starting copy 755 788 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"), 757 792 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); 758 793 alert->SetShortcut(0, B_ESCAPE); 759 794 alert->Go(); … … 923 958 924 959 BEntry sourceEntry(srcRef); 925 960 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); 930 966 alert->SetShortcut(0, B_ESCAPE); 931 967 alert->Go(); 932 968 break; … … 939 975 940 976 result = MoveEntryToTrash(&sourceEntry, loc, undo); 941 977 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"), 946 983 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); 947 984 alert->SetShortcut(0, B_ESCAPE); 948 985 alert->Go(); … … 1054 1091 1055 1092 // check for free space first 1056 1093 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); 1058 1096 throw (status_t)B_DEVICE_FULL; 1059 1097 } 1060 1098 … … 1066 1104 loopControl->UpdateStatus(destName, ref, 1024, true); 1067 1105 1068 1106 if (makeOriginalName) { 1069 FSMakeOriginalName(destName, destDir, " copy"); 1107 BString suffix(" "); 1108 suffix << B_TRANSLATE_COMMENT("copy", "filename copy"), 1109 FSMakeOriginalName(destName, destDir, suffix.String()); 1070 1110 undo.UpdateEntry(srcFile, destName); 1071 1111 } 1072 1112 … … 1098 1138 throw (status_t)err; 1099 1139 1100 1140 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)) { 1103 1144 throw (status_t)err; 1104 1145 } else { 1105 1146 // user selected continue in spite of error, update status bar … … 1371 1412 loopControl->UpdateStatus(ref.name, ref, 1024, true); 1372 1413 1373 1414 if (makeOriginalName) { 1374 FSMakeOriginalName(destName, destDir, " copy"); 1415 BString suffix(" "); 1416 suffix << B_TRANSLATE_COMMENT("copy", "filename copy"), 1417 FSMakeOriginalName(destName, destDir, suffix.String()); 1375 1418 undo.UpdateEntry(srcEntry, destName); 1376 1419 } 1377 1420 … … 1417 1460 err = destDir->CreateDirectory(destName, &newDir); 1418 1461 } 1419 1462 #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)) { 1423 1467 throw err; 1424 1468 } 1425 1469 … … 1536 1580 strcpy(name, ref.name); 1537 1581 1538 1582 BSymLink link; 1539 FSMakeOriginalName(name, destDir, " link"); 1583 BString suffix(" "); 1584 suffix << B_TRANSLATE_COMMENT("link", "filename link"), 1585 FSMakeOriginalName(name, destDir, suffix.String()); 1540 1586 undo.UpdateEntry(entry, name); 1541 1587 1542 1588 BPath path; … … 1616 1662 err = destDir->CreateSymLink(name, path.Path(), &link); 1617 1663 1618 1664 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); 1621 1668 } 1622 1669 1623 FailWithAlert::FailOnError(err, "Error creating link to \"%s\".", 1670 FailWithAlert::FailOnError(err, 1671 B_TRANSLATE("Error creating link to \"%name\"."), 1624 1672 ref.name); 1625 1673 1626 1674 if (loc && loc != (BPoint *)-1) { … … 1659 1707 // no alert, was already taken care of before 1660 1708 return error; 1661 1709 } 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(); 1666 1715 return error.fError; 1667 1716 } catch (FailWithAlert error) { 1668 char buffer[256];1717 BString buffer(error.fString); 1669 1718 if (error.fName) 1670 sprintf(buffer, error.fString, error.fName);1719 buffer.ReplaceFirst("%name", error.fName); 1671 1720 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(); 1675 1725 1676 1726 return error.fError; 1677 1727 } … … 1803 1853 if (volume == boot) { 1804 1854 char name[B_FILE_NAME_LENGTH]; 1805 1855 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); 1811 1861 alert->SetShortcut(0, B_ESCAPE); 1812 1862 alert->Go(); 1813 1863 } else { … … 1828 1878 trash_dir.GetEntry(&trashEntry); 1829 1879 1830 1880 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(); 1834 1886 1835 1887 // return no error so we don't get two dialogs 1836 1888 return B_OK; … … 1854 1906 char name[B_FILE_NAME_LENGTH]; 1855 1907 strcpy(name, ref.name); 1856 1908 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()); 1858 1912 undo.UpdateEntry(entry, name); 1859 1913 } 1860 1914 … … 1911 1965 // prompt user only if there is more than one collision, otherwise the 1912 1966 // single collision case will be handled as a "Prompt" case by CheckName 1913 1967 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); 1918 1973 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")); 1921 1978 alert->SetShortcut(0, B_ESCAPE); 1922 1979 switch (alert->Go()) { 1923 1980 case 0: … … 1974 2031 && moveMode != kCreateRelativeLink 1975 2032 && (srcDirectory == *destDir 1976 2033 || 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(); 1980 2039 return B_ERROR; 1981 2040 } 1982 2041 } 1983 2042 1984 2043 if (FSIsTrashDir(sourceEntry) && moveMode != kCreateLink 1985 2044 && 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(); 1988 2049 return B_ERROR; 1989 2050 } 1990 2051 … … 2007 2068 if (destIsDir) { 2008 2069 BDirectory test_dir(&entry); 2009 2070 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(); 2013 2076 return B_ERROR; 2014 2077 } 2015 2078 } … … 2019 2082 && moveMode != kCreateRelativeLink 2020 2083 && destIsDir != sourceIsDirectory) { 2021 2084 (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(); 2027 2091 return B_ERROR; 2028 2092 } 2029 2093 2030 2094 if (replaceAll != kReplaceAll) { 2031 2095 // prompt user to determine whether to replace or not 2032 2096 2033 char replaceMsg[512];2097 BString replaceMsg; 2034 2098 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 { 2041 2110 char sourceBuffer[96], destBuffer[96]; 2042 2111 StatStruct statBuffer; 2043 2112 … … 2052 2121 else 2053 2122 destBuffer[0] = '\0'; 2054 2123 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")); 2058 2132 } 2059 2133 2060 2134 // special case single collision (don't need Replace All shortcut) 2061 2135 BAlert *alert; 2062 2136 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")); 2064 2140 else { 2065 alert = new BAlert("", replaceMsg, "Cancel", "Replace"); 2141 alert = new BAlert("", replaceMsg.String(), 2142 B_TRANSLATE("Cancel"), 2143 B_TRANSLATE("Replace")); 2066 2144 alert->SetShortcut(0, B_ESCAPE); 2067 2145 } 2068 2146 switch (alert->Go()) { … … 2086 2164 return B_OK; 2087 2165 2088 2166 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); 2094 2172 alert->SetShortcut(0, B_ESCAPE); 2095 2173 alert->Go(); 2096 2174 } … … 2136 2214 else if (err == B_OK) 2137 2215 dir.Rewind(); 2138 2216 else { 2139 loopControl->FileError(kFileDeleteErrorString, ref.name, err, 2217 loopControl->FileError( 2218 B_TRANSLATE(kFileDeleteErrorString), 2219 ref.name, err, 2140 2220 false); 2141 2221 } 2142 2222 } … … 2705 2785 } 2706 2786 2707 2787 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(); 2710 2792 } 2711 2793 2712 2794 return B_OK; … … 2720 2802 bool dontMoveToTrash = TrackerSettings().DontMoveFilesToTrash(); 2721 2803 2722 2804 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); 2726 2811 2727 2812 alert->SetShortcut(0, B_ESCAPE); 2728 2813 alert->SetShortcut(1, 'm'); … … 2737 2822 return B_OK; 2738 2823 } 2739 2824 } 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); 2743 2830 2744 2831 alert->SetShortcut(0, B_ESCAPE); 2745 2832 alert->SetShortcut(1, 'd'); … … 2774 2861 } 2775 2862 2776 2863 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(); 2779 2868 } 2780 2869 2781 2870 delete list; … … 2930 3019 status_t result = dir.InitCheck(); 2931 3020 if (result == B_OK) { 2932 3021 char name[B_FILE_NAME_LENGTH]; 2933 strcpy(name, "New folder");3022 strcpy(name, B_TRANSLATE("New folder")); 2934 3023 2935 3024 int32 fnum = 1; 2936 3025 while (dir.Contains(name)) { … … 2938 3027 // ToDo: 2939 3028 // move this logic ot FSMakeOriginalName 2940 3029 if (++fnum > 9) 2941 sprintf(name, "New folder%ld", fnum); 3030 snprintf(name, sizeof(name), 3031 B_TRANSLATE("New folder%ld"), 3032 fnum); 2942 3033 else 2943 sprintf(name, "New folder %ld", fnum); 3034 snprintf(name, sizeof(name), 3035 B_TRANSLATE("New folder %ld"), 3036 fnum); 2944 3037 } 2945 3038 2946 3039 BDirectory newDir; … … 2960 3053 } 2961 3054 } 2962 3055 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); 2965 3060 alert->SetShortcut(0, B_ESCAPE); 2966 3061 alert->Go(); 2967 3062 return result; … … 3120 3215 if (nodeToClose) 3121 3216 dynamic_cast<TTracker *>(be_app)->CloseParent(*nodeToClose); 3122 3217 } 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)); 3125 3221 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); 3129 3227 alert->SetShortcut(0, B_ESCAPE); 3130 3228 if (alert->Go() == 1) 3131 3229 error = TrackerOpenWith(refs); 3132 3230 } 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); 3135 3234 alert->SetShortcut(0, B_ESCAPE); 3136 3235 alert->Go(); 3137 3236 } … … 3274 3373 } 3275 3374 3276 3375 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)); 3279 3379 if (openWithOK) 3280 alternative = kFindApplicationStr;3380 alternative = B_TRANSLATE(kFindApplicationStr); 3281 3381 3282 3382 break; 3283 3383 } else { … … 3325 3425 } 3326 3426 3327 3427 if (error == B_LAUNCH_FAILED_EXECUTABLE && !refsToPass) { 3328 alertString << "Could not open \"" << app.name3329 << "\". 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); 3330 3430 3331 3431 if (!openWithOK) { 3332 3432 // offer the possibility to change the permissions 3333 3433 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); 3338 3439 alert->SetShortcut(0, B_ESCAPE); 3339 3440 if (alert->Go() == 1) { 3340 3441 BEntry entry(&documentRef); … … 3350 3451 _TrackerLaunchDocuments(NULL, refs, false); 3351 3452 return; 3352 3453 } 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)); 3356 3457 } 3357 3458 } else 3358 3459 return; 3359 3460 } 3360 3461 3361 alternative = kFindApplicationStr;3462 alternative = B_TRANSLATE(kFindApplicationStr); 3362 3463 } else if (error == B_LAUNCH_FAILED_APP_IN_TRASH) { 3363 alertString << "Could not open \"" << documentRef.name3364 << "\" 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); 3367 3468 } 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); 3371 3473 } else if (error == B_MISSING_SYMBOL 3372 3474 && 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); 3378 3486 } else if (error == B_MISSING_LIBRARY 3379 3487 && 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); 3386 3499 } 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); 3391 3505 } 3392 3506 } 3393 3507 … … 3395 3509 if (openWithOK) { 3396 3510 ASSERT(alternative); 3397 3511 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); 3401 3516 alert->SetShortcut(0, B_ESCAPE); 3402 3517 if (alert->Go() == 1) 3403 3518 error = TrackerOpenWith(refs); 3404 3519 } 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); 3407 3523 alert->SetShortcut(0, B_ESCAPE); 3408 3524 alert->Go(); 3409 3525 } -
StatusWindow.cpp
39 39 40 40 #include <Application.h> 41 41 #include <Button.h> 42 #include <Catalog.h> 42 43 #include <ControlLook.h> 43 44 #include <Debug.h> 45 #include <Locale.h> 44 46 #include <MessageFilter.h> 45 47 #include <StringView.h> 46 48 #include <String.h> … … 182 184 // #pragma mark - BStatusWindow 183 185 184 186 187 #undef B_TRANSLATE_CONTEXT 188 #define B_TRANSLATE_CONTEXT "libTracker" 189 190 185 191 BStatusWindow::BStatusWindow() 186 192 : 187 BWindow(kStatusRect, "Tracker status", B_TITLED_WINDOW, 193 BWindow(kStatusRect, 194 B_TRANSLATE("Tracker status"), 195 B_TITLED_WINDOW, 188 196 B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE, 189 197 B_ALL_WORKSPACES), 190 198 fRetainDesktopFocus(false) … … 446 454 rect.top += 6; 447 455 rect.bottom = rect.top + 15; 448 456 449 const char* caption = NULL;457 BString caption; 450 458 int32 id = 0; 451 459 452 460 switch (type) { 453 461 case kCopyState: 454 caption = "Preparing to copy items" B_UTF8_ELLIPSIS;462 caption = B_TRANSLATE("Preparing to copy items" B_UTF8_ELLIPSIS); 455 463 id = R_CopyStatusBitmap; 456 464 break; 457 465 458 466 case kMoveState: 459 caption = "Preparing to move items" B_UTF8_ELLIPSIS;467 caption = B_TRANSLATE("Preparing to move items" B_UTF8_ELLIPSIS); 460 468 id = R_MoveStatusBitmap; 461 469 break; 462 470 463 471 case kCreateLinkState: 464 caption = "Preparing to create links" B_UTF8_ELLIPSIS;472 caption = B_TRANSLATE("Preparing to create links" B_UTF8_ELLIPSIS); 465 473 id = R_MoveStatusBitmap; 466 474 break; 467 475 468 476 case kTrashState: 469 caption = "Preparing to empty Trash" B_UTF8_ELLIPSIS;477 caption = B_TRANSLATE("Preparing to empty Trash" B_UTF8_ELLIPSIS); 470 478 id = R_TrashStatusBitmap; 471 479 break; 472 480 473 481 case kVolumeState: 474 caption = "Searching for disks to mount" B_UTF8_ELLIPSIS;482 caption = B_TRANSLATE("Searching for disks to mount" B_UTF8_ELLIPSIS); 475 483 break; 476 484 477 485 case kDeleteState: 478 caption = "Preparing to delete items" B_UTF8_ELLIPSIS;486 caption = B_TRANSLATE("Preparing to delete items" B_UTF8_ELLIPSIS); 479 487 id = R_TrashStatusBitmap; 480 488 break; 481 489 482 490 case kRestoreFromTrashState: 483 caption = "Preparing to restore items" B_UTF8_ELLIPSIS;491 caption = B_TRANSLATE("Preparing to restore items" B_UTF8_ELLIPSIS); 484 492 break; 485 493 486 494 default: … … 488 496 break; 489 497 } 490 498 491 if (caption != NULL) {492 fStatusBar = new BStatusBar(rect, "StatusBar", caption );499 if (caption.Length()) { 500 fStatusBar = new BStatusBar(rect, "StatusBar", caption.String()); 493 501 fStatusBar->SetBarHeight(12); 494 502 float width, height; 495 503 fStatusBar->GetPreferredSize(&width, &height); … … 572 580 } 573 581 574 582 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 } 577 589 578 590 switch (fType) { 579 591 case kCopyState: 580 fStatusBar->Reset("Copying: ", buffer.String()); 592 fStatusBar->Reset( 593 B_TRANSLATE("Copying: "), 594 buffer.String()); 581 595 break; 582 596 583 597 case kCreateLinkState: 584 fStatusBar->Reset("Creating links: ", buffer.String()); 598 fStatusBar->Reset( 599 B_TRANSLATE("Creating links: "), 600 buffer.String()); 585 601 break; 586 602 587 603 case kMoveState: 588 fStatusBar->Reset("Moving: ", buffer.String()); 604 fStatusBar->Reset( 605 B_TRANSLATE("Moving: "), 606 buffer.String()); 589 607 break; 590 608 591 609 case kTrashState: 592 fStatusBar->Reset("Emptying Trash" B_UTF8_ELLIPSIS " ", 610 fStatusBar->Reset( 611 B_TRANSLATE("Emptying Trash" B_UTF8_ELLIPSIS " "), 593 612 buffer.String()); 594 613 break; 595 614 596 615 case kDeleteState: 597 fStatusBar->Reset("Deleting: ", buffer.String()); 616 fStatusBar->Reset( 617 B_TRANSLATE("Deleting: "), 618 buffer.String()); 598 619 break; 599 620 600 621 case kRestoreFromTrashState: 601 fStatusBar->Reset("Restoring: ", buffer.String()); 622 fStatusBar->Reset( 623 B_TRANSLATE("Restoring: "), 624 buffer.String()); 602 625 break; 603 626 604 627 default: … … 650 673 tp.y += ceilf(fh.leading) + ceilf(fh.ascent); 651 674 652 675 if (IsPaused()) 653 DrawString("Paused: click to resume or stop", tp); 676 DrawString( 677 B_TRANSLATE("Paused: click to resume or stop"), 678 tp); 654 679 else if (fDestDir.Length()) { 655 680 BString buffer; 656 681 buffer << "To: " << fDestDir; … … 722 747 2, time->tm_hour, 2, time->tm_min); 723 748 } 724 749 725 BString buffer1("Finish: ");726 buffer1 << timeText;727 750 finishTime -= now; 728 751 time = gmtime(&finishTime); 752 char finishStr[16]; 729 753 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 } 739 767 740 buffer2 << " left"; 768 buffer.ReplaceFirst("%time", timeText); 769 buffer.ReplaceFirst("%finishtime", finishStr); 741 770 742 buffer = "(";743 buffer << buffer1 << " - " << buffer2 << ")";744 771 tp.x = fStatusBar->Frame().right - StringWidth(buffer.String()); 745 772 if (tp.x > rightDivider) 746 773 DrawString(buffer.String(), tp); 747 774 else { 748 775 // 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); 751 778 tp.x = fStatusBar->Frame().right - StringWidth(buffer.String()); 752 779 if (tp.x > rightDivider) 753 780 DrawString(buffer.String(), tp); -
SlowContextPopup.cpp
38 38 #include <Debug.h> 39 39 40 40 #include <Application.h> 41 #include <Catalog.h> 41 42 #include <Directory.h> 43 #include <Locale.h> 42 44 #include <Path.h> 43 45 #include <Query.h> 44 46 #include <StopWatch.h> … … 60 62 #include "Tracker.h" 61 63 62 64 65 66 #undef B_TRANSLATE_CONTEXT 67 #define B_TRANSLATE_CONTEXT "libTracker" 68 63 69 BSlowContextMenu::BSlowContextMenu(const char *title) 64 70 : BPopUpMenu(title, false, false), 65 71 fMenuBuilt(false), … … 490 496 fItemList->MakeEmpty(); 491 497 492 498 if (!count) { 493 BMenuItem *item = new BMenuItem("Empty folder", 0); 499 BMenuItem* item = new BMenuItem( 500 B_TRANSLATE("Empty folder"), 501 0); 494 502 item->SetEnabled(false); 495 503 AddItem(item); 496 504 } -
DeskWindow.cpp
32 32 All rights reserved. 33 33 */ 34 34 35 #include <Catalog.h> 35 36 #include <Debug.h> 36 37 #include <FindDirectory.h> 38 #include <Locale.h> 37 39 #include <NodeMonitor.h> 38 40 #include <Path.h> 39 41 #include <PopUpMenu.h> … … 103 105 104 106 // #pragma mark - 105 107 108 #undef B_TRANSLATE_CONTEXT 109 #define B_TRANSLATE_CONTEXT "libTracker" 106 110 107 111 BDeskWindow::BDeskWindow(LockingList<BWindow> *windowList) 108 112 : … … 266 270 void 267 271 BDeskWindow::AddWindowContextMenus(BMenu *menu) 268 272 { 269 TemplatesMenu *tempateMenu = new TemplatesMenu(PoseView()); 273 TemplatesMenu* tempateMenu = new TemplatesMenu(PoseView(), 274 B_TRANSLATE("New")); 270 275 271 276 menu->AddItem(tempateMenu); 272 277 tempateMenu->SetTargetForItems(PoseView()); … … 274 279 275 280 menu->AddSeparatorItem(); 276 281 277 BMenu* iconSizeMenu = new BMenu("Icon view"); 282 BMenu* iconSizeMenu = new BMenu( 283 B_TRANSLATE("Icon view")); 278 284 279 285 BMessage* message = new BMessage(kIconMode); 280 286 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); 282 289 item->SetMarked(PoseView()->IconSizeInt() == 32); 283 290 item->SetTarget(PoseView()); 284 291 iconSizeMenu->AddItem(item); 285 292 286 293 message = new BMessage(kIconMode); 287 294 message->AddInt32("size", 40); 288 item = new BMenuItem("40 x 40", message); 295 item = new BMenuItem( 296 B_TRANSLATE("40 x 40"), message); 289 297 item->SetMarked(PoseView()->IconSizeInt() == 40); 290 298 item->SetTarget(PoseView()); 291 299 iconSizeMenu->AddItem(item); 292 300 293 301 message = new BMessage(kIconMode); 294 302 message->AddInt32("size", 48); 295 item = new BMenuItem("48 x 48", message); 303 item = new BMenuItem( 304 B_TRANSLATE("48 x 48"), message); 296 305 item->SetMarked(PoseView()->IconSizeInt() == 48); 297 306 item->SetTarget(PoseView()); 298 307 iconSizeMenu->AddItem(item); 299 308 300 309 message = new BMessage(kIconMode); 301 310 message->AddInt32("size", 64); 302 item = new BMenuItem("64 x 64", message); 311 item = new BMenuItem( 312 B_TRANSLATE("64 x 64"), message); 303 313 item->SetMarked(PoseView()->IconSizeInt() == 64); 304 314 item->SetTarget(PoseView()); 305 315 iconSizeMenu->AddItem(item); … … 308 318 309 319 message = new BMessage(kIconMode); 310 320 message->AddInt32("scale", 0); 311 item = new BMenuItem("Decrease size", message, '-'); 321 item = new BMenuItem( 322 B_TRANSLATE("Decrease size"), message, '-'); 312 323 item->SetTarget(PoseView()); 313 324 iconSizeMenu->AddItem(item); 314 325 315 326 message = new BMessage(kIconMode); 316 327 message->AddInt32("scale", 1); 317 item = new BMenuItem("Increase size", message, '+'); 328 item = new BMenuItem( 329 B_TRANSLATE("Increase size"), message, '+'); 318 330 item->SetTarget(PoseView()); 319 331 iconSizeMenu->AddItem(item); 320 332 … … 325 337 iconSizeMenu->Superitem()->SetTarget(PoseView()); 326 338 iconSizeMenu->Superitem()->SetMarked(PoseView()->ViewMode() == kIconMode); 327 339 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'); 329 343 item->SetMarked(PoseView()->ViewMode() == kMiniIconMode); 330 344 menu->AddItem(item); 331 345 332 346 menu->AddSeparatorItem(); 333 347 334 348 #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')); 337 353 menu->AddSeparatorItem(); 338 354 #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), 341 360 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')); 343 364 344 365 menu->AddSeparatorItem(); 345 menu->AddItem(new MountMenu("Mount")); 366 menu->AddItem( 367 new MountMenu(B_TRANSLATE("Mount"))); 346 368 347 369 menu->AddSeparatorItem(); 348 menu->AddItem(new BMenu(kAddOnsMenuName)); 370 menu->AddItem( 371 new BMenu(B_TRANSLATE("Add-ons"))); 349 372 350 373 // target items as needed 351 374 menu->SetTargetForItems(PoseView()); -
Jamfile
3 3 SetSubDirSupportedPlatformsBeOSCompatible ; 4 4 AddSubDirSupportedPlatforms libbe_test ; 5 5 6 UsePrivateHeaders interface mount shared storage tracker ;6 UsePrivateHeaders interface libbe mount shared storage tracker ; 7 7 8 8 UseLibraryHeaders icon ; 9 9 10 AddResources libtracker.so : TrackerIcons.rdef ;10 AddResources libtracker.so : TrackerIcons.rdef libTracker.rdef ; 11 11 12 12 SubDirC++Flags 13 13 -D_BUILDING_tracker=1 -DOPEN_TRACKER=1 … … 91 91 VolumeWindow.cpp 92 92 WidgetAttributeText.cpp 93 93 94 : be translation $(vector_icon_libs) $(TARGET_LIBSTDC++) libshared.a 95 94 : be translation $(vector_icon_libs) $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS) libshared.a 96 95 ; 97 96 97 DoCatalogs 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 98 133 if $(TARGET_PLATFORM) = libbe_test { 99 134 HaikuInstall install-test-apps : $(HAIKU_APP_TEST_LIB_DIR) : libtracker.so 100 135 : tests!apps ; -
QueryPoseView.cpp
35 35 36 36 #include <new> 37 37 38 #include <Catalog.h> 38 39 #include <Debug.h> 40 #include <Locale.h> 39 41 #include <NodeMonitor.h> 40 42 #include <Query.h> 41 43 #include <Volume.h> … … 54 56 55 57 #include <fs_attr.h> 56 58 59 60 61 #undef B_TRANSLATE_CONTEXT 62 #define B_TRANSLATE_CONTEXT "libTracker" 63 57 64 using std::nothrow; 58 65 59 66 // Currently filtering out Trash doesn't node monitor too well - if you … … 113 120 if (fColumnList->CountItems() != 0) 114 121 return; 115 122 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, 117 126 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, 119 130 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, 121 134 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, 123 138 kAttrStatModified, B_TIME_TYPE, true, false)); 124 139 } 125 140 -
FSClipboard.cpp
35 35 #include "FSClipboard.h" 36 36 #include <Clipboard.h> 37 37 #include <Alert.h> 38 #include <Catalog.h> 39 #include <Locale.h> 38 40 #include <NodeMonitor.h> 39 41 #include "Commands.h" 40 42 #include "FSUtils.h" 41 43 #include "Tracker.h" 42 44 45 43 46 // prototypes 44 47 static void MakeNodeFromName(node_ref *node, char *name); 45 48 static inline void MakeRefName(char *refName, const node_ref *node); … … 49 52 50 53 51 54 //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; 55 57 56 58 /* 57 59 static bool … … 111 113 // #pragma mark - 112 114 113 115 116 #undef B_TRANSLATE_CONTEXT 117 #define B_TRANSLATE_CONTEXT "libTracker" 118 114 119 bool 115 120 FSClipboardHasRefs() 116 121 { … … 468 473 469 474 // can't copy/paste to root('/') directory 470 475 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"), 472 480 NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); 473 481 alert->SetShortcut(0, B_ESCAPE); 474 482 alert->Go(); … … 480 488 481 489 // can't copy items into the trash 482 490 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"), 484 494 NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); 485 495 alert->SetShortcut(0, B_ESCAPE); 486 496 alert->Go(); -
PoseView.cpp
43 43 44 44 #include <Alert.h> 45 45 #include <Application.h> 46 #include <Catalog.h> 46 47 #include <Clipboard.h> 47 48 #include <Debug.h> 48 49 #include <Dragger.h> … … 51 52 #include <Screen.h> 52 53 #include <Query.h> 53 54 #include <List.h> 55 #include <Locale.h> 54 56 #include <MenuItem.h> 55 57 #include <NodeMonitor.h> 56 58 #include <Path.h> … … 93 95 #include "WidthBuffer.h" 94 96 95 97 98 #undef B_TRANSLATE_CONTEXT 99 #define B_TRANSLATE_CONTEXT "libTracker" 100 96 101 using std::min; 97 102 using std::max; 98 103 … … 4083 4088 } else if (types) 4084 4089 description = embedTypeAs; 4085 4090 4086 const char *labelText; 4087 char text[1024]; 4091 BString labelText; 4088 4092 if (actionText) { 4089 4093 int32 length = 1024 - 1 - (int32)strlen(actionText); 4090 4094 if (length > 0) { 4091 4095 description.Truncate(length); 4092 sprintf(text, actionText, description.String());4093 labelText = text;4096 labelText.SetTo(actionText); 4097 labelText.ReplaceFirst("%s", description.String()); 4094 4098 } else 4095 labelText = "label too long";4099 labelText.SetTo(B_TRANSLATE("label too long")); 4096 4100 } else 4097 labelText = description .String();4101 labelText = description; 4098 4102 4099 menu->AddItem(new BMenuItem(labelText , 0));4103 menu->AddItem(new BMenuItem(labelText.String(), 0)); 4100 4104 } 4101 4105 4102 4106 menu->AddSeparatorItem(); 4103 menu->AddItem(new BMenuItem( "Cancel", 0));4107 menu->AddItem(new BMenuItem(B_TRANSLATE("Cancel"), 0)); 4104 4108 4105 4109 int32 result = -1; 4106 4110 BMenuItem *resultingItem = menu->Go(where, false, true); … … 4254 4258 if (specificActionIndex == -1) 4255 4259 return false; 4256 4260 } else if (types.CountItems() > 0) { 4257 specificTypeIndex = RunMimeTypeDestinationMenu("Create %s clipping", 4261 specificTypeIndex = RunMimeTypeDestinationMenu( 4262 B_TRANSLATE("Create %s clipping"), 4258 4263 &types, &typeNames, view->ConvertToScreen(dropPt)); 4259 4264 4260 4265 if (specificTypeIndex == -1) -
AutoMounterSettings.cpp
37 37 #include <Alert.h> 38 38 #include <Box.h> 39 39 #include <Button.h> 40 #include <Catalog.h> 40 41 #include <CheckBox.h> 41 42 #include <Debug.h> 42 43 #include <GridLayoutBuilder.h> 43 44 #include <GroupLayoutBuilder.h> 45 #include <Locale.h> 44 46 #include <SpaceLayoutItem.h> 45 47 #include <SeparatorView.h> 46 48 #include <Message.h> … … 54 56 const uint32 kBootMountSettingsChanged = 'bchg'; 55 57 const uint32 kEjectWhenUnmountingChanged = 'ejct'; 56 58 59 #undef B_TRANSLATE_CONTEXT 60 #define B_TRANSLATE_CONTEXT "libTracker" 57 61 58 62 class AutomountSettingsPanel : public BBox { 59 63 public: … … 103 107 104 108 BBox* autoMountBox = new BBox("autoMountBox", B_WILL_DRAW | B_FRAME_EVENTS 105 109 | B_PULSE_NEEDED | B_NAVIGABLE_JUMP); 106 autoMountBox->SetLabel( "Automatic disk mounting");110 autoMountBox->SetLabel(B_TRANSLATE("Automatic disk mounting")); 107 111 BGroupLayout* autoMountLayout = new BGroupLayout(B_VERTICAL, spacing); 108 112 autoMountBox->SetLayout(autoMountLayout); 109 113 autoMountLayout->SetInsets(spacing, 110 114 autoMountBox->InnerFrame().top + spacing, spacing, spacing); 111 115 112 fScanningDisabledCheck = new BRadioButton("scanningOff", "Don't automount", 116 fScanningDisabledCheck = new BRadioButton("scanningOff", 117 B_TRANSLATE("Don't automount"), 113 118 new BMessage(kAutomountSettingsChanged)); 114 119 115 fAutoMountAllBFSCheck = new BRadioButton("autoBFS", "All BeOS disks", 120 fAutoMountAllBFSCheck = new BRadioButton("autoBFS", 121 B_TRANSLATE("All BeOS disks"), 116 122 new BMessage(kAutomountSettingsChanged)); 117 123 118 fAutoMountAllCheck = new BRadioButton("autoAll", "All disks", 124 fAutoMountAllCheck = new BRadioButton("autoAll", 125 B_TRANSLATE("All disks"), 119 126 new BMessage(kAutomountSettingsChanged)); 120 127 121 128 // "Disk Mounting During Boot" group 122 129 123 130 BBox* bootMountBox = new BBox("", B_WILL_DRAW | B_FRAME_EVENTS 124 131 | B_PULSE_NEEDED | B_NAVIGABLE_JUMP); 125 bootMountBox->SetLabel( "Disk mounting during boot");132 bootMountBox->SetLabel(B_TRANSLATE("Disk mounting during boot")); 126 133 BGroupLayout* bootMountLayout = new BGroupLayout(B_VERTICAL, spacing); 127 134 bootMountBox->SetLayout(bootMountLayout); 128 135 bootMountLayout->SetInsets(spacing, 129 136 bootMountBox->InnerFrame().top + spacing, spacing, spacing); 130 137 131 138 fInitialDontMountCheck = new BRadioButton("initialNone", 132 "Only the boot disk", new BMessage(kBootMountSettingsChanged)); 139 B_TRANSLATE("Only the boot disk"), 140 new BMessage(kBootMountSettingsChanged)); 133 141 134 142 fInitialMountRestoreCheck = new BRadioButton("initialRestore", 135 "Previously mounted disks", new BMessage(kBootMountSettingsChanged)); 143 B_TRANSLATE("Previously mounted disks"), 144 new BMessage(kBootMountSettingsChanged)); 136 145 137 146 fInitialMountAllBFSCheck = new BRadioButton("initialBFS", 138 "All BeOS disks", new BMessage(kBootMountSettingsChanged)); 147 B_TRANSLATE("All BeOS disks"), 148 new BMessage(kBootMountSettingsChanged)); 139 149 140 150 fInitialMountAllCheck = new BRadioButton("initialAll", 141 "All disks", new BMessage(kBootMountSettingsChanged)); 151 B_TRANSLATE("All disks"), 152 new BMessage(kBootMountSettingsChanged)); 142 153 143 154 fEjectWhenUnmountingCheckBox = new BCheckBox("ejectWhenUnmounting", 144 "Eject when unmounting", new BMessage(kEjectWhenUnmountingChanged)); 155 B_TRANSLATE("Eject when unmounting"), 156 new BMessage(kEjectWhenUnmountingChanged)); 145 157 146 158 // Buttons 147 159 148 fDone = new BButton("Done", new BMessage(B_QUIT_REQUESTED)); 160 fDone = new BButton(B_TRANSLATE("Done"), 161 new BMessage(B_QUIT_REQUESTED)); 149 162 150 fMountAllNow = new BButton("mountAll", "Mount all disks now", 163 fMountAllNow = new BButton("mountAll", 164 B_TRANSLATE("Mount all disks now"), 151 165 new BMessage(kMountAllNow)); 152 166 153 167 fDone->MakeDefault(true); … … 292 306 AutomountSettingsDialog::AutomountSettingsDialog(BMessage* settings, 293 307 const BMessenger& target) 294 308 : 295 BWindow(BRect(100, 100, 320, 370), "Disk mount settings", 309 BWindow(BRect(100, 100, 320, 370), 310 B_TRANSLATE("Disk mount settings"), 296 311 B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE 297 312 | B_AUTO_UPDATE_SIZE_LIMITS) 298 313 { … … 325 340 BMessage reply; 326 341 status_t ret = target.SendMessage(&message, &reply, 2500000); 327 342 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(); 331 347 return; 332 348 } 333 349 -
ContainerWindow.cpp
39 39 #include <Alert.h> 40 40 #include <Application.h> 41 41 #include <AppFileInfo.h> 42 #include <Catalog.h> 42 43 #include <ControlLook.h> 43 44 #include <Debug.h> 44 45 #include <Directory.h> 45 46 #include <Entry.h> 46 47 #include <FindDirectory.h> 47 48 #include <InterfaceDefs.h> 49 #include <Locale.h> 48 50 #include <MenuItem.h> 49 51 #include <MenuBar.h> 50 52 #include <NodeMonitor.h> … … 89 91 #include "TemplatesMenu.h" 90 92 91 93 94 #undef B_TRANSLATE_CONTEXT 95 #define B_TRANSLATE_CONTEXT "libTracker" 96 92 97 const uint32 kRedo = 'REDO'; 93 98 // this is the same as B_REDO in Dano/Zeta/Haiku 94 99 … … 103 108 104 109 namespace BPrivate { 105 110 106 const char *kAddOnsMenuName = "Add-ons";107 108 111 class DraggableContainerIcon : public BView { 109 112 public: 110 113 DraggableContainerIcon(BRect rect, const char *name, uint32 resizeMask); … … 261 264 result = addonImage; 262 265 } 263 266 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); 266 270 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); 269 274 alert->SetShortcut(0, B_ESCAPE); 270 275 alert->Go(); 271 276 … … 406 411 float height = fontHeight.ascent + fontHeight.descent + fontHeight.leading + 2 407 412 + Bounds().Height() + 8; 408 413 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); 411 417 412 418 dragBitmap->Lock(); 413 419 BView *view = new BView(dragBitmap->Bounds(), "", B_FOLLOW_NONE, 0); … … 853 859 854 860 fMenuBar->RemoveItem(fFileMenu); 855 861 delete fFileMenu; 856 fFileMenu = new BMenu( "File");862 fFileMenu = new BMenu(B_TRANSLATE("File")); 857 863 AddFileMenu(fFileMenu); 858 864 fMenuBar->AddItem(fFileMenu); 859 865 860 866 fMenuBar->RemoveItem(fWindowMenu); 861 867 delete fWindowMenu; 862 fWindowMenu = new BMenu( "Window");868 fWindowMenu = new BMenu(B_TRANSLATE("Window")); 863 869 fMenuBar->AddItem(fWindowMenu); 864 870 AddWindowMenu(fWindowMenu); 865 871 866 872 // just create the attribute, decide to add it later 867 873 fMenuBar->RemoveItem(fAttrMenu); 868 874 delete fAttrMenu; 869 fAttrMenu = new BMenu( "Attributes");875 fAttrMenu = new BMenu(B_TRANSLATE("Attributes")); 870 876 NewAttributeMenu(fAttrMenu); 871 877 if (PoseView()->ViewMode() == kListMode) 872 878 ShowAttributeMenu(); … … 897 903 if (ShouldAddScrollBars()) 898 904 fPoseView->AddScrollBars(); 899 905 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)); 904 912 905 913 TrackerSettings settings; 906 914 … … 1635 1643 1636 1644 BMenuItem *item = fFileContextMenu->FindItem(kMoveToTrash); 1637 1645 if (item) 1638 item->SetLabel(dontMoveToTrash ? "Delete" : "Move to Trash"); 1646 item->SetLabel(dontMoveToTrash 1647 ? B_TRANSLATE("Delete") 1648 : B_TRANSLATE("Move to Trash")); 1639 1649 1640 1650 // Deskbar doesn't have a menu bar, so check if there is fMenuBar 1641 1651 if (fMenuBar && fFileMenu) { 1642 1652 item = fFileMenu->FindItem(kMoveToTrash); 1643 1653 if (item) 1644 item->SetLabel(dontMoveToTrash ? "Delete" : "Move to Trash"); 1654 item->SetLabel(dontMoveToTrash 1655 ? B_TRANSLATE("Delete") 1656 : B_TRANSLATE("Move to Trash")); 1645 1657 } 1646 1658 UpdateIfNeeded(); 1647 1659 } … … 1685 1697 || PoseView() != CurrentFocus()); 1686 1698 1687 1699 if (modifiers() & B_SHIFT_KEY) { 1688 item->SetLabel( "Cut more");1700 item->SetLabel(B_TRANSLATE("Cut more")); 1689 1701 item->SetShortcut('X', B_COMMAND_KEY | B_SHIFT_KEY); 1690 1702 item->SetMessage(new BMessage(kCutMoreSelectionToClipboard)); 1691 1703 } else { 1692 item->SetLabel( "Cut");1704 item->SetLabel(B_TRANSLATE("Cut")); 1693 1705 item->SetShortcut('X', B_COMMAND_KEY); 1694 1706 item->SetMessage(new BMessage(B_CUT)); 1695 1707 } … … 1708 1720 || PoseView() != CurrentFocus()); 1709 1721 1710 1722 if (modifiers() & B_SHIFT_KEY) { 1711 item->SetLabel( "Copy more");1723 item->SetLabel(B_TRANSLATE("Copy more")); 1712 1724 item->SetShortcut('C', B_COMMAND_KEY | B_SHIFT_KEY); 1713 1725 item->SetMessage(new BMessage(kCopyMoreSelectionToClipboard)); 1714 1726 } else { 1715 item->SetLabel( "Copy");1727 item->SetLabel(B_TRANSLATE("Copy")); 1716 1728 item->SetShortcut('C', B_COMMAND_KEY); 1717 1729 item->SetMessage(new BMessage(B_COPY)); 1718 1730 } … … 1730 1742 item->SetEnabled(FSClipboardHasRefs() || PoseView() != CurrentFocus()); 1731 1743 1732 1744 if (modifiers() & B_SHIFT_KEY) { 1733 item->SetLabel( "Paste links");1745 item->SetLabel(B_TRANSLATE("Paste links")); 1734 1746 item->SetShortcut('V', B_COMMAND_KEY | B_SHIFT_KEY); 1735 1747 item->SetMessage(new BMessage(kPasteLinksFromClipboard)); 1736 1748 } else { 1737 item->SetLabel( "Paste");1749 item->SetLabel(B_TRANSLATE("Paste")); 1738 1750 item->SetShortcut('V', B_COMMAND_KEY); 1739 1751 item->SetMessage(new BMessage(B_PASTE)); 1740 1752 } … … 1753 1765 && (PoseView()->ViewMode() != kListMode)); 1754 1766 1755 1767 if (modifiers() & B_SHIFT_KEY) { 1756 item->SetLabel( "Clean up all");1768 item->SetLabel(B_TRANSLATE("Clean up all")); 1757 1769 item->SetShortcut('K', B_COMMAND_KEY | B_SHIFT_KEY); 1758 1770 item->SetMessage(new BMessage(kCleanupAll)); 1759 1771 } else { 1760 item->SetLabel( "Clean up");1772 item->SetLabel(B_TRANSLATE("Clean up")); 1761 1773 item->SetShortcut('K', B_COMMAND_KEY); 1762 1774 item->SetMessage(new BMessage(kCleanup)); 1763 1775 } … … 1773 1785 return; 1774 1786 1775 1787 if (modifiers() & B_SHIFT_KEY) { 1776 item->SetLabel( "Close all");1788 item->SetLabel(B_TRANSLATE("Close all")); 1777 1789 item->SetShortcut('W', B_COMMAND_KEY | B_SHIFT_KEY); 1778 1790 item->SetTarget(be_app); 1779 1791 item->SetMessage(new BMessage(kCloseAllWindows)); 1780 1792 } else { 1781 item->SetLabel( "Close");1793 item->SetLabel(B_TRANSLATE("Close")); 1782 1794 item->SetShortcut('W', B_COMMAND_KEY); 1783 1795 item->SetTarget(this); 1784 1796 item->SetMessage(new BMessage(B_QUIT_REQUESTED)); … … 1803 1815 void 1804 1816 BContainerWindow::AddMenus() 1805 1817 { 1806 fFileMenu = new BMenu( "File");1818 fFileMenu = new BMenu(B_TRANSLATE("File")); 1807 1819 AddFileMenu(fFileMenu); 1808 1820 fMenuBar->AddItem(fFileMenu); 1809 fWindowMenu = new BMenu( "Window");1821 fWindowMenu = new BMenu(B_TRANSLATE("Window")); 1810 1822 fMenuBar->AddItem(fWindowMenu); 1811 1823 AddWindowMenu(fWindowMenu); 1812 1824 // just create the attribute, decide to add it later 1813 fAttrMenu = new BMenu( "Attributes");1825 fAttrMenu = new BMenu(B_TRANSLATE("Attributes")); 1814 1826 NewAttributeMenu(fAttrMenu); 1815 1827 } 1816 1828 … … 1819 1831 BContainerWindow::AddFileMenu(BMenu *menu) 1820 1832 { 1821 1833 if (!PoseView()->IsFilePanel()) 1822 menu->AddItem(new BMenuItem("Find"B_UTF8_ELLIPSIS, 1834 menu->AddItem(new BMenuItem( 1835 B_TRANSLATE("Find"B_UTF8_ELLIPSIS), 1823 1836 new BMessage(kFindButton), 'F')); 1824 1837 1825 1838 if (!TargetModel()->IsQuery() && !IsTrash() && !IsPrintersDir()) { 1826 1839 if (!PoseView()->IsFilePanel()) { 1827 TemplatesMenu *templateMenu = new TemplatesMenu(PoseView()); 1840 TemplatesMenu* templateMenu = new TemplatesMenu(PoseView(), 1841 B_TRANSLATE("New")); 1828 1842 menu->AddItem(templateMenu); 1829 1843 templateMenu->SetTargetForItems(PoseView()); 1830 1844 } 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')); 1832 1848 } 1833 1849 menu->AddSeparatorItem(); 1834 1850 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')); 1838 1857 1839 1858 if (IsTrash() || InTrash()) { 1840 menu->AddItem(new BMenuItem("Restore", new BMessage(kRestoreFromTrash))); 1859 menu->AddItem(new BMenuItem(B_TRANSLATE("Restore"), 1860 new BMessage(kRestoreFromTrash))); 1841 1861 if (IsTrash()) { 1842 1862 // 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); 1844 1866 menu->AddItem(new BSeparatorItem(), 1); 1845 1867 } 1846 1868 } 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), 1848 1871 new BMessage(kAddPrinter), 'N'), 0); 1849 1872 menu->AddItem(new BSeparatorItem(), 1); 1850 menu->AddItem(new BMenuItem("Make active printer", 1873 menu->AddItem( 1874 new BMenuItem(B_TRANSLATE("Make active printer"), 1851 1875 new BMessage(kMakeActivePrinter))); 1852 1876 } 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')); 1854 1880 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')); 1858 1885 1859 1886 menu->AddSeparatorItem(); 1860 1887 … … 1867 1894 if (!IsPrintersDir()) { 1868 1895 menu->AddSeparatorItem(); 1869 1896 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')); 1873 1906 1874 1907 menu->AddSeparatorItem(); 1875 1908 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")); 1878 1914 addOnMenuItem->SetFont(be_plain_font); 1879 1915 menu->AddItem(addOnMenuItem); 1880 1916 } … … 1894 1930 { 1895 1931 BMenuItem *item; 1896 1932 1897 BMenu* iconSizeMenu = new BMenu("Icon view"); 1933 BMenu* iconSizeMenu = new BMenu( 1934 B_TRANSLATE("Icon view")); 1898 1935 1899 1936 BMessage* message = new BMessage(kIconMode); 1900 1937 message->AddInt32("size", 32); 1901 item = new BMenuItem("32 x 32", message); 1938 item = new BMenuItem( 1939 B_TRANSLATE("32 x 32"), message); 1902 1940 item->SetTarget(PoseView()); 1903 1941 iconSizeMenu->AddItem(item); 1904 1942 1905 1943 message = new BMessage(kIconMode); 1906 1944 message->AddInt32("size", 40); 1907 item = new BMenuItem("40 x 40", message); 1945 item = new BMenuItem( 1946 B_TRANSLATE("40 x 40"), message); 1908 1947 item->SetTarget(PoseView()); 1909 1948 iconSizeMenu->AddItem(item); 1910 1949 1911 1950 message = new BMessage(kIconMode); 1912 1951 message->AddInt32("size", 48); 1913 item = new BMenuItem("48 x 48", message); 1952 item = new BMenuItem( 1953 B_TRANSLATE("48 x 48"), message); 1914 1954 item->SetTarget(PoseView()); 1915 1955 iconSizeMenu->AddItem(item); 1916 1956 1917 1957 message = new BMessage(kIconMode); 1918 1958 message->AddInt32("size", 64); 1919 item = new BMenuItem("64 x 64", message); 1959 item = new BMenuItem( 1960 B_TRANSLATE("64 x 64"), message); 1920 1961 item->SetTarget(PoseView()); 1921 1962 iconSizeMenu->AddItem(item); 1922 1963 … … 1924 1965 1925 1966 message = new BMessage(kIconMode); 1926 1967 message->AddInt32("scale", 0); 1927 item = new BMenuItem("Decrease size", message, '-'); 1968 item = new BMenuItem( 1969 B_TRANSLATE("Decrease size"), message, '-'); 1928 1970 item->SetTarget(PoseView()); 1929 1971 iconSizeMenu->AddItem(item); 1930 1972 1931 1973 message = new BMessage(kIconMode); 1932 1974 message->AddInt32("scale", 1); 1933 item = new BMenuItem("Increase size", message, '+'); 1975 item = new BMenuItem( 1976 B_TRANSLATE("Increase size"), message, '+'); 1934 1977 item->SetTarget(PoseView()); 1935 1978 iconSizeMenu->AddItem(item); 1936 1979 … … 1940 1983 iconSizeMenu->Superitem()->SetMessage(new BMessage(kIconMode)); 1941 1984 iconSizeMenu->Superitem()->SetTarget(PoseView()); 1942 1985 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'); 1944 1988 item->SetTarget(PoseView()); 1945 1989 menu->AddItem(item); 1946 1990 1947 item = new BMenuItem("List view", new BMessage(kListMode), '3'); 1991 item = new BMenuItem(B_TRANSLATE("List view"), 1992 new BMessage(kListMode), '3'); 1948 1993 item->SetTarget(PoseView()); 1949 1994 menu->AddItem(item); 1950 1995 1951 1996 menu->AddSeparatorItem(); 1952 1997 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'); 1954 2000 item->SetTarget(this); 1955 2001 menu->AddItem(item); 1956 2002 1957 item = new BMenuItem("Clean up", new BMessage(kCleanup), 'K'); 2003 item = new BMenuItem(B_TRANSLATE("Clean up"), 2004 new BMessage(kCleanup), 'K'); 1958 2005 item->SetTarget(PoseView()); 1959 2006 menu->AddItem(item); 1960 2007 1961 item = new BMenuItem("Select"B_UTF8_ELLIPSIS, 2008 item = new BMenuItem( 2009 B_TRANSLATE("Select"B_UTF8_ELLIPSIS), 1962 2010 new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY); 1963 2011 item->SetTarget(PoseView()); 1964 2012 menu->AddItem(item); 1965 2013 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'); 1967 2016 item->SetTarget(PoseView()); 1968 2017 menu->AddItem(item); 1969 2018 1970 item = new BMenuItem("Invert selection", new BMessage(kInvertSelection), 2019 item = new BMenuItem(B_TRANSLATE("Invert selection"), 2020 new BMessage(kInvertSelection), 1971 2021 'S'); 1972 2022 item->SetTarget(PoseView()); 1973 2023 menu->AddItem(item); 1974 2024 1975 2025 if (!IsTrash()) { 1976 item = new BMenuItem("Open parent", new BMessage(kOpenParentDir), 2026 item = new BMenuItem(B_TRANSLATE("Open parent"), 2027 new BMessage(kOpenParentDir), 1977 2028 B_UP_ARROW); 1978 2029 item->SetTarget(PoseView()); 1979 2030 menu->AddItem(item); 1980 2031 } 1981 2032 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'); 1983 2035 item->SetTarget(this); 1984 2036 menu->AddItem(item); 1985 2037 1986 item = new BMenuItem("Close all in workspace", 2038 item = new BMenuItem( 2039 B_TRANSLATE("Close all in workspace"), 1987 2040 new BMessage(kCloseAllInWorkspace), 'Q'); 1988 2041 item->SetTarget(be_app); 1989 2042 menu->AddItem(item); 1990 2043 1991 2044 menu->AddSeparatorItem(); 1992 2045 1993 item = new BMenuItem("Preferences"B_UTF8_ELLIPSIS, 2046 item = new BMenuItem( 2047 B_TRANSLATE("Preferences"B_UTF8_ELLIPSIS), 1994 2048 new BMessage(kShowSettingsWindow)); 1995 2049 item->SetTarget(be_app); 1996 2050 menu->AddItem(item); … … 2051 2105 AddMimeTypesToMenu(fAttrMenu); 2052 2106 2053 2107 if (IsPrintersDir()) 2054 EnableNamedMenuItem(fFileMenu, "Make active printer", selectCount == 1); 2108 EnableNamedMenuItem(fFileMenu, 2109 B_TRANSLATE("Make active printer"), 2110 selectCount == 1); 2055 2111 } 2056 2112 2057 2113 … … 2163 2219 bool poseViewIsQuery = TargetModel()->IsQuery(); 2164 2220 // if the view is a query pose view, add edit query menu item 2165 2221 2166 BMenuItem *item = menu->FindItem("Edit query"); 2222 BMenuItem* item = menu->FindItem( 2223 B_TRANSLATE("Edit query")); 2167 2224 if (!poseViewIsQuery && !queryInSelection && item) 2168 2225 item->Menu()->RemoveItem(item); 2169 2226 … … 2173 2230 item = menu->FindItem(kOpenSelection); 2174 2231 if (item) { 2175 2232 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'); 2177 2235 item->Menu()->AddItem(query, itemIndex + 1); 2178 2236 query->SetTarget(PoseView()); 2179 2237 } … … 2225 2283 2226 2284 int32 index = item->Menu()->IndexOf(item); 2227 2285 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)); 2230 2289 fOpenWithItem->SetTarget(PoseView()); 2231 2290 fOpenWithItem->SetShortcut('O', B_COMMAND_KEY | B_CONTROL_KEY); 2232 2291 … … 2260 2319 if (entry.SetTo(ref) == B_OK 2261 2320 && entry.GetParent(&entry) == B_OK 2262 2321 && 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); 2264 2324 menu->SetNavDir(model.EntryRef()); 2265 2325 menu->SetShowParent(true); 2266 2326 … … 2276 2336 path.Append("Tracker"); 2277 2337 if (entry.SetTo(path.Path()) == B_OK 2278 2338 && 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); 2280 2341 2281 2342 BMenuItem *item = new SpecialModelMenuItem(&model,menu); 2282 2343 item->SetMessage(new BMessage((uint32)what)); … … 2375 2436 // Set the "Create Link" item label here so it 2376 2437 // appears correctly when menus are disabled, too. 2377 2438 if (modifierKeys & B_SHIFT_KEY) 2378 fCreateLinkItem->SetLabel("Create relative link"); 2439 fCreateLinkItem->SetLabel( 2440 B_TRANSLATE("Create relative link")); 2379 2441 else 2380 fCreateLinkItem->SetLabel("Create link"); 2442 fCreateLinkItem->SetLabel( 2443 B_TRANSLATE("Create link")); 2381 2444 2382 2445 // only enable once the menus are built 2383 2446 fMoveToItem->SetEnabled(false); … … 2425 2488 BMenuItem *identifyItem = parent->FindItem(kIdentifyEntry); 2426 2489 if (identifyItem != NULL) { 2427 2490 if (modifierKeys & B_SHIFT_KEY) 2428 identifyItem->SetLabel("Force identify"); 2491 identifyItem->SetLabel( 2492 B_TRANSLATE("Force identify")); 2429 2493 else 2430 identifyItem->SetLabel("Identify"); 2494 identifyItem->SetLabel( 2495 B_TRANSLATE("Identify")); 2431 2496 } 2432 2497 } 2433 2498 … … 2446 2511 if (item == NULL) 2447 2512 item = fDropContextMenu->FindItem(kCreateRelativeLink); 2448 2513 if (item && (modifiers() & B_SHIFT_KEY)) { 2449 item->SetLabel("Create relative link here"); 2514 item->SetLabel( 2515 B_TRANSLATE("Create relative link here")); 2450 2516 item->SetMessage(new BMessage(kCreateRelativeLink)); 2451 2517 } else if (item) { 2452 item->SetLabel("Create link here"); 2518 item->SetLabel( 2519 B_TRANSLATE("Create link here")); 2453 2520 item->SetMessage(new BMessage(kCreateLink)); 2454 2521 } 2455 2522 … … 2572 2639 if (volume != boot) 2573 2640 ejectableVolumeSelected = true; 2574 2641 2575 EnableNamedMenuItem(fContextMenu, "Unmount", ejectableVolumeSelected); 2642 EnableNamedMenuItem(fContextMenu, B_TRANSLATE("Unmount"), 2643 ejectableVolumeSelected); 2576 2644 } 2577 2645 } 2578 2646 … … 2607 2675 void 2608 2676 BContainerWindow::AddFileContextMenus(BMenu *menu) 2609 2677 { 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')); 2613 2684 2614 2685 if (!IsTrash() && !InTrash() && !IsPrintersDir()) 2615 menu->AddItem(new BMenuItem("Duplicate", 2686 menu->AddItem( 2687 new BMenuItem(B_TRANSLATE("Duplicate"), 2616 2688 new BMessage(kDuplicateSelection), 'D')); 2617 2689 2618 2690 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')); 2622 2695 2623 2696 // add separator for copy to/move to items (navigation items) 2624 2697 menu->AddSeparatorItem(); 2625 2698 } 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)); 2628 2703 } 2629 2704 2630 2705 #ifdef CUT_COPY_PASTE_IN_CONTEXT_MENU 2631 2706 menu->AddSeparatorItem(); 2632 2707 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')); 2635 2714 #endif 2636 2715 2637 2716 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")); 2640 2721 addOnMenuItem->SetFont(be_plain_font); 2641 2722 menu->AddItem(addOnMenuItem); 2642 2723 … … 2652 2733 void 2653 2734 BContainerWindow::AddVolumeContextMenus(BMenu *menu) 2654 2735 { 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')); 2658 2742 2659 2743 menu->AddSeparatorItem(); 2660 menu->AddItem(new MountMenu( "Mount"));2744 menu->AddItem(new MountMenu(B_TRANSLATE("Mount"))); 2661 2745 2662 BMenuItem *item = new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U'); 2746 BMenuItem *item = new BMenuItem( 2747 B_TRANSLATE("Unmount"), 2748 new BMessage(kUnmountVolume), 'U'); 2663 2749 item->SetEnabled(false); 2664 2750 menu->AddItem(item); 2665 2751 2666 2752 menu->AddSeparatorItem(); 2667 menu->AddItem(new BMenu( kAddOnsMenuName));2753 menu->AddItem(new BMenu(B_TRANSLATE("Add-ons"))); 2668 2754 2669 2755 menu->SetTargetForItems(PoseView()); 2670 2756 } … … 2679 2765 2680 2766 bool needSeparator = true; 2681 2767 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))); 2683 2771 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')); 2685 2775 else if (InTrash()) 2686 2776 needSeparator = false; 2687 2777 else { 2688 TemplatesMenu *templateMenu = new TemplatesMenu(PoseView()); 2778 TemplatesMenu* templateMenu = new TemplatesMenu(PoseView(), 2779 B_TRANSLATE("New")); 2689 2780 menu->AddItem(templateMenu); 2690 2781 templateMenu->SetTargetForItems(PoseView()); 2691 2782 templateMenu->SetFont(be_plain_font); … … 2699 2790 menu->AddItem(pasteItem); 2700 2791 menu->AddSeparatorItem(); 2701 2792 #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), 2704 2798 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')); 2706 2802 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)); 2709 2806 2710 2807 menu->AddSeparatorItem(); 2711 BMenu *addOnMenuItem = new BMenu(kAddOnsMenuName); 2808 BMenu* addOnMenuItem = new BMenu( 2809 B_TRANSLATE("Add-ons")); 2712 2810 addOnMenuItem->SetFont(be_plain_font); 2713 2811 menu->AddItem(addOnMenuItem); 2714 2812 … … 2729 2827 void 2730 2828 BContainerWindow::AddDropContextMenus(BMenu *menu) 2731 2829 { 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))); 2735 2837 menu->AddSeparatorItem(); 2736 menu->AddItem(new BMenuItem("Cancel", new BMessage(kCancelButton))); 2838 menu->AddItem(new BMenuItem(B_TRANSLATE("Cancel"), 2839 new BMessage(kCancelButton))); 2737 2840 } 2738 2841 2739 2842 … … 2741 2844 BContainerWindow::AddTrashContextMenus(BMenu *menu) 2742 2845 { 2743 2846 // setup special trash context menu 2744 menu->AddItem(new BMenuItem("Empty Trash", 2847 menu->AddItem( 2848 new BMenuItem(B_TRANSLATE("Empty Trash"), 2745 2849 new BMessage(kEmptyTrash))); 2746 menu->AddItem(new BMenuItem( "Open",2850 menu->AddItem(new BMenuItem(B_TRANSLATE("Open"), 2747 2851 new BMessage(kOpenSelection), 'O')); 2748 menu->AddItem(new BMenuItem( "Get info",2852 menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"), 2749 2853 new BMessage(kGetInfo), 'I')); 2750 2854 menu->SetTargetForItems(PoseView()); 2751 2855 } … … 2887 2991 void 2888 2992 BContainerWindow::BuildAddOnMenu(BMenu *menu) 2889 2993 { 2890 BMenuItem *item = menu->FindItem(kAddOnsMenuName); 2994 BMenuItem* item = menu->FindItem( 2995 B_TRANSLATE("Add-ons")); 2891 2996 if (menu->IndexOf(item) == 0) { 2892 2997 // the folder of the context menu seems to be named "Add-Ons" 2893 2998 // so we just take the last menu item, which is correct if not … … 2965 3070 2966 3071 if (context == kMenuBarContext || context == kWindowPopUpContext) { 2967 3072 BMenu* sizeMenu = NULL; 2968 if (BMenuItem* item = menu->FindItem("Icon view")) { 3073 if (BMenuItem* item = menu->FindItem( 3074 B_TRANSLATE("Icon view"))) { 2969 3075 sizeMenu = item->Submenu(); 2970 3076 } 2971 3077 … … 3001 3107 EnableNamedMenuItem(menu, kEmptyTrash, count > 0); 3002 3108 EnableNamedMenuItem(menu, B_SELECT_ALL, count > 0); 3003 3109 3004 BMenuItem *item = menu->FindItem(kTemplatesMenuName); 3110 BMenuItem* item = menu->FindItem( 3111 B_TRANSLATE("New")); 3005 3112 if (item) { 3006 TemplatesMenu *templateMenu = dynamic_cast<TemplatesMenu *>(3113 TemplatesMenu* templateMenu = dynamic_cast<TemplatesMenu *>( 3007 3114 item->Submenu()); 3008 3115 if (templateMenu) 3009 3116 templateMenu->UpdateMenuState(); … … 3022 3129 entry_ref addonRef; 3023 3130 status_t result = message->FindRef("refs", &addonRef); 3024 3131 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); 3029 3140 alert->SetShortcut(0, B_ESCAPE); 3030 3141 alert->Go(); 3031 3142 return; … … 3086 3197 ASSERT(PoseView()); 3087 3198 3088 3199 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))); 3090 3203 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))); 3092 3207 item->SetTarget(PoseView()); 3093 3208 menu->AddSeparatorItem(); 3094 3209 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)); 3097 3213 3098 menu->AddItem(NewAttributeMenuItem ( "Size", kAttrStatSize, B_OFF_T_TYPE,3214 menu->AddItem(NewAttributeMenuItem (B_TRANSLATE("Size"), kAttrStatSize, B_OFF_T_TYPE, 3099 3215 80, B_ALIGN_RIGHT, false, true)); 3100 3216 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)); 3103 3220 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)); 3106 3224 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)); 3109 3228 3110 3229 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)); 3113 3233 else 3114 menu->AddItem(NewAttributeMenuItem ("Location", kAttrPath, B_STRING_TYPE, 3234 menu->AddItem(NewAttributeMenuItem( 3235 B_TRANSLATE("Location"), kAttrPath, B_STRING_TYPE, 3115 3236 225, B_ALIGN_LEFT, false, false)); 3116 3237 3117 3238 #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, 3119 3241 60, B_ALIGN_LEFT, false, true)); 3120 3242 3121 menu->AddItem(NewAttributeMenuItem ("Group", kAttrStatGroup, B_STRING_TYPE, 3243 menu->AddItem(NewAttributeMenuItem( 3244 B_TRANSLATE("Group"), kAttrStatGroup, B_STRING_TYPE, 3122 3245 60, B_ALIGN_LEFT, false, true)); 3123 3246 #endif 3124 3247 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)); 3127 3251 } 3128 3252 3129 3253 -
WidgetAttributeText.cpp
40 40 41 41 #include <Alert.h> 42 42 #include <AppFileInfo.h> 43 #include <Catalog.h> 43 44 #include <Debug.h> 45 #include <Locale.h> 44 46 #include <NodeInfo.h> 45 47 #include <Path.h> 46 48 #include <TextView.h> … … 61 63 #include "WidgetAttributeText.h" 62 64 63 65 66 67 #undef B_TRANSLATE_CONTEXT 68 #define B_TRANSLATE_CONTEXT "libTracker" 69 70 64 71 const int32 kGenericReadBufferSize = 1024; 65 72 66 73 template <class View> … … 215 222 *result = "-"; 216 223 return view->StringWidth("-"); 217 224 } else if (value < kKBSize) { 218 sprintf(buffer, "%Ld bytes", value);225 sprintf(buffer, B_TRANSLATE("%Ld bytes"), value); 219 226 if (view->StringWidth(buffer) > width) 220 sprintf(buffer, "%Ld B", value);227 sprintf(buffer, B_TRANSLATE("%Ld B"), value); 221 228 } else { 222 229 const char *suffix; 223 230 float floatValue; 224 231 if (value >= kTBSize) { 225 suffix = "TiB";232 suffix = B_TRANSLATE("TiB"); 226 233 floatValue = (float)value / kTBSize; 227 234 } else if (value >= kGBSize) { 228 suffix = "GiB";235 suffix = B_TRANSLATE("GiB"); 229 236 floatValue = (float)value / kGBSize; 230 237 } else if (value >= kMBSize) { 231 suffix = "MiB";238 suffix = B_TRANSLATE("MiB"); 232 239 floatValue = (float)value / kMBSize; 233 240 } else { 234 241 ASSERT(value >= kKBSize); 235 suffix = "KiB";242 suffix = B_TRANSLATE("KiB"); 236 243 floatValue = (float)value / kKBSize; 237 244 } 238 245 … … 751 758 752 759 // get the mime type 753 760 if (mime.SetType(fModel->MimeType()) != B_OK) 754 *result = "Unknown";761 *result = B_TRANSLATE("Unknown"); 755 762 // get the short mime type description 756 763 else if (mime.GetShortDescription(desc) == B_OK) 757 764 *result = desc; … … 872 879 873 880 bool removeExisting = false; 874 881 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); 878 888 879 889 alert->SetShortcut(0, 'r'); 880 890 … … 1592 1602 && type != B_DOUBLE_TYPE 1593 1603 && type != B_CHAR_TYPE 1594 1604 && 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); 1597 1609 alert->SetShortcut(0, B_ESCAPE); 1598 1610 alert->Go(); 1599 1611 return false; … … 1626 1638 sscanf(textView->Text(), "%c", &ch); 1627 1639 //Check if we read the start of a multi-byte glyph: 1628 1640 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); 1632 1646 alert->SetShortcut(0, B_ESCAPE); 1633 1647 alert->Go(); 1634 1648 return false; … … 1727 1741 } 1728 1742 1729 1743 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); 1733 1748 alert->SetShortcut(0, B_ESCAPE); 1734 1749 alert->Go(); 1735 1750 -
Tracker.cpp
40 40 41 41 #include <Alert.h> 42 42 #include <Autolock.h> 43 #include <Catalog.h> 43 44 #include <Debug.h> 44 45 #include <FindDirectory.h> 45 46 #include <fs_attr.h> 46 47 #include <fs_info.h> 47 48 #include <image.h> 49 #include <Locale.h> 48 50 #include <MenuItem.h> 49 51 #include <NodeInfo.h> 50 52 #include <NodeMonitor.h> … … 206 208 // #pragma mark - 207 209 208 210 211 #undef B_TRANSLATE_CONTEXT 212 #define B_TRANSLATE_CONTEXT "libTracker" 213 209 214 TTracker::TTracker() 210 215 : BApplication(kTrackerSignature), 211 216 fSettingsWindow(NULL) … … 663 668 664 669 if (!brokenLinkWithSpecificHandler) { 665 670 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); 669 677 alert->SetShortcut(0, B_ESCAPE); 670 678 alert->Go(); 671 679 return result; -
libTracker.rdef
1 resource app_signature "application/x-vnd.Haiku-libTracker"; -
MountMenu.cpp
34 34 35 35 // MountMenu implements a context menu used for mounting/unmounting volumes 36 36 37 #include <Catalog.h> 37 38 #include <Debug.h> 39 #include <Locale.h> 38 40 #include <MenuItem.h> 39 41 #include <Mime.h> 40 42 #include <InterfaceDefs.h> … … 154 156 // #pragma mark - 155 157 156 158 159 #undef B_TRANSLATE_CONTEXT 160 #define B_TRANSLATE_CONTEXT "libTracker" 161 157 162 MountMenu::MountMenu(const char *name) 158 163 : BMenu(name) 159 164 { … … 214 219 215 220 AddSeparatorItem(); 216 221 217 BMenuItem *mountAll = new BMenuItem("Mount all", 222 BMenuItem* mountAll = new BMenuItem( 223 B_TRANSLATE("Mount all"), 218 224 new BMessage(kMountAllNow)); 219 225 AddItem(mountAll); 220 BMenuItem *mountSettings = new BMenuItem("Settings" B_UTF8_ELLIPSIS, 226 BMenuItem* mountSettings = new BMenuItem( 227 B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), 221 228 new BMessage(kRunAutomounterSettings)); 222 229 AddItem(mountSettings); 223 230 -
QueryContainerWindow.cpp
32 32 All rights reserved. 33 33 */ 34 34 35 #include <Catalog.h> 36 #include <Locale.h> 35 37 #include <Menu.h> 36 38 #include <MenuItem.h> 37 39 #include <Path.h> … … 45 47 #include "QueryPoseView.h" 46 48 47 49 50 51 #undef B_TRANSLATE_CONTEXT 52 #define B_TRANSLATE_CONTEXT "libTracker" 53 48 54 BQueryContainerWindow::BQueryContainerWindow(LockingList<BWindow> *windowList, 49 55 uint32 containerWindowFlags, window_look look, 50 56 window_feel feel, uint32 flags, uint32 workspace) … … 85 91 { 86 92 BMenuItem *item; 87 93 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'); 89 96 item->SetTarget(this); 90 97 menu->AddItem(item); 91 98 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); 93 102 item->SetTarget(PoseView()); 94 103 menu->AddItem(item); 95 104 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'); 97 107 item->SetTarget(PoseView()); 98 108 menu->AddItem(item); 99 109 100 item = new BMenuItem("Invert selection", new BMessage(kInvertSelection), 'S'); 110 item = new BMenuItem(B_TRANSLATE("Invert selection"), 111 new BMessage(kInvertSelection), 'S'); 101 112 item->SetTarget(PoseView()); 102 113 menu->AddItem(item); 103 114 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'); 105 117 item->SetTarget(this); 106 118 menu->AddItem(item); 107 119 } … … 110 122 void 111 123 BQueryContainerWindow::AddWindowContextMenus(BMenu *menu) 112 124 { 113 BMenuItem *resizeItem = new BMenuItem("Resize to Fit", 125 BMenuItem* resizeItem = new BMenuItem( 126 B_TRANSLATE("Resize to Fit"), 114 127 new BMessage(kResizeToFit), 'Y'); 115 128 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"), 119 137 new BMessage(B_QUIT_REQUESTED), 'W'); 120 138 menu->AddItem(closeItem); 121 139 // target items as needed -
Model.cpp
46 46 47 47 #include <AppDefs.h> 48 48 #include <Bitmap.h> 49 #include <Catalog.h> 49 50 #include <Debug.h> 50 51 #include <Directory.h> 51 52 #include <Entry.h> 52 53 #include <File.h> 54 #include <Locale.h> 53 55 #include <NodeInfo.h> 54 56 #include <NodeMonitor.h> 55 57 #include <Path.h> … … 83 85 } 84 86 85 87 88 #undef B_TRANSLATE_CONTEXT 89 #define B_TRANSLATE_CONTEXT "libTracker" 90 86 91 Model::Model() 87 92 : 88 93 fPreferredAppName(NULL), … … 328 333 const char * 329 334 Model::Name() const 330 335 { 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 331 340 switch (fBaseType) { 332 341 case kRootNode: 333 return "Disks";342 return B_TRANSLATE(kRootNodeName); 334 343 335 344 case kVolumeNode: 336 345 if (fVolumeName) 337 346 return fVolumeName; 338 347 break; 339 340 348 case kTrashNode: 341 return "Trash";349 return B_TRANSLATE(kTrashNodeName); 342 350 343 351 case kDesktopNode: 344 return "Desktop";352 return B_TRANSLATE(kDesktopNodeName); 345 353 346 354 default: 347 355 break; -
DirMenu.cpp
35 35 // ToDo: 36 36 // get rid of fMenuBar, SetMenuBar and related mess 37 37 38 #include <Catalog.h> 38 39 #include <Debug.h> 39 40 #include <Directory.h> 41 #include <Locale.h> 40 42 #include <MenuBar.h> 41 43 #include <Path.h> 42 44 #include <Volume.h> … … 52 54 #include "Utilities.h" 53 55 54 56 57 58 #undef B_TRANSLATE_CONTEXT 59 #define B_TRANSLATE_CONTEXT "libTracker" 60 55 61 BDirMenu::BDirMenu(BMenuBar *bar, uint32 command, const char *entryName) 56 62 : BPopUpMenu("directories"), 57 63 fMenuBar(bar), … … 83 89 ThrowOnInitCheckError(&model); 84 90 85 91 ModelMenuItem *menu = new ModelMenuItem(&model, this, true, true); 86 92 87 93 if (fMenuBar) 88 94 fMenuBar->AddItem(menu); 89 95 … … 143 149 AddDisksIconToMenu(reverse); 144 150 entry = desktopEntry; 145 151 } 146 147 152 if (entry == desktopEntry) 148 153 hitRoot = true; 149 154 } 150 151 155 if (result == kReadAttrFailed || !info.fInvisible 152 156 || (showDesktop && desktopEntry == entry)) 153 157 AddItemToDirMenu(&entry, originatingWindow, reverse, … … 165 169 // select last item in menu 166 170 if (!select) 167 171 return; 168 169 172 ModelMenuItem *item = dynamic_cast<ModelMenuItem *>(ItemAt(CountItems() - 1)); 170 173 if (item) { 171 174 item->SetMarked(true); … … 249 252 BMessage *message = new BMessage(fCommand); 250 253 message->AddRef(fEntryName.String(), model.EntryRef()); 251 254 252 ModelMenuItem *item = new ModelMenuItem(&model, "Disks", message); 255 ModelMenuItem* item = new ModelMenuItem(&model, 256 B_TRANSLATE("Disks"), 257 message); 253 258 if (atEnd) 254 259 AddItem(item); 255 260 else -
TrackerInitialState.cpp
37 37 // important sniffer rules 38 38 39 39 #include <Alert.h> 40 #include <Catalog.h> 40 41 #include <Directory.h> 41 42 #include <InterfaceDefs.h> 43 #include <Locale.h> 42 44 #include <Message.h> 43 45 #include <Node.h> 44 46 #include <Path.h> … … 330 332 // #pragma mark - 331 333 332 334 335 #undef B_TRANSLATE_CONTEXT 336 #define B_TRANSLATE_CONTEXT "libTracker" 337 333 338 bool 334 339 TTracker::InstallMimeIfNeeded(const char *type, int32 bitsID, 335 340 const char *shortDescription, const char *longDescription, … … 592 597 BPath path; 593 598 status_t status = find_directory(B_SYSTEM_DATA_DIRECTORY, &path); 594 599 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(); 601 606 return; 602 607 } 603 608 path.Append("artwork"); -
SelectionWindow.cpp
35 35 #include <BeBuild.h> 36 36 #include <Alert.h> 37 37 #include <Box.h> 38 #include <Catalog.h> 39 #include <Locale.h> 38 40 #include <MenuItem.h> 39 41 40 42 #include "AutoLock.h" … … 47 49 48 50 const uint32 kSelectButtonPressed = 'sbpr'; 49 51 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 55 SelectionWindow::SelectionWindow(BContainerWindow* window) 56 : BWindow(BRect(0, 0, 270, 0), 57 B_TRANSLATE("Select"), 58 B_TITLED_WINDOW, 52 59 B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_V_RESIZABLE 53 60 | B_NO_WORKSPACE_ACTIVATION | B_ASYNCHRONOUS_CONTROLS 54 61 | B_NOT_ANCHORED_ON_ACTIVATE), … … 67 74 AddChild(backgroundView); 68 75 69 76 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)); 75 92 76 93 menu->SetLabelFromMarked(true); 77 94 menu->ItemAt(3)->SetMarked(true); … … 79 96 80 97 // Set up the menu field 81 98 fMatchingTypeMenuField = new BMenuField(BRect(7, 6, Bounds().right - 5, 0), 82 NULL, "Name", menu);99 NULL, B_TRANSLATE("Name"), menu); 83 100 backgroundView->AddChild(fMatchingTypeMenuField); 84 fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth("Name") + 8); 101 fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth( 102 B_TRANSLATE("Name")) + 8); 85 103 fMatchingTypeMenuField->ResizeToPreferred(); 86 104 87 105 // Set up the expression text control … … 93 111 fExpressionTextControl->MakeFocus(true); 94 112 95 113 // 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); 98 119 backgroundView->AddChild(fInverseCheckBox); 99 120 fInverseCheckBox->ResizeToPreferred(); 100 121 101 122 // 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); 104 130 fIgnoreCaseCheckBox->SetValue(1); 105 131 backgroundView->AddChild(fIgnoreCaseCheckBox); 106 132 fIgnoreCaseCheckBox->ResizeToPreferred(); 107 133 108 134 // 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"), 110 139 new BMessage(kSelectButtonPressed), B_FOLLOW_RIGHT); 111 140 112 141 backgroundView->AddChild(fSelectButton); … … 125 154 float topMiddleButton = 126 155 (fSelectButton->Bounds().Height() / 2 - 127 156 (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); 130 161 131 162 float bottomMinWidth = 32 + fSelectButton->Bounds().Width() + 132 163 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:###")); 134 165 float minWidth = bottomMinWidth > topMinWidth ? bottomMinWidth : topMinWidth; 135 166 136 167 Run(); -
FindPanel.cpp
35 35 #include <Application.h> 36 36 #include <Box.h> 37 37 #include <Button.h> 38 #include <Catalog.h> 38 39 #include <CheckBox.h> 39 40 #include <Debug.h> 40 41 #include <Directory.h> 41 42 #include <FindDirectory.h> 42 43 #include <File.h> 43 44 #include <FilePanel.h> 45 #include <Locale.h> 44 46 #include <MenuField.h> 45 47 #include <MenuItem.h> 46 48 #include <Mime.h> … … 73 75 #include "Tracker.h" 74 76 #include "Utilities.h" 75 77 78 79 #undef B_TRANSLATE_CONTEXT 80 #define B_TRANSLATE_CONTEXT "libTracker" 81 76 82 const char *kAllMimeTypes = "mime/ALLTYPES"; 77 83 78 84 const BRect kInitialRect(100, 100, 530, 210); … … 85 91 const uint32 kSwitchToQueryTemplate = 'swqt'; 86 92 const uint32 kRunSaveAsTemplatePanel = 'svtm'; 87 93 88 const char *kDragNDropTypes [] = { B_QUERY_MIMETYPE, B_QUERY_TEMPLATE_MIMETYPE }; 89 const char *kDragNDropActionSpecifiers [] = { "Create a Query", "Create a Query template" }; 94 const char* kDragNDropTypes [] = { 95 B_QUERY_MIMETYPE, 96 B_QUERY_TEMPLATE_MIMETYPE }; 97 static const char *kDragNDropActionSpecifiers [] = { 98 B_TRANSLATE_MARK("Create a Query"), 99 B_TRANSLATE_MARK("Create a Query template") }; 90 100 91 101 const uint32 kAttachFile = 'attf'; 92 102 … … 125 135 126 136 127 137 void 128 MoreOptionsStruct::EndianSwap(void 138 MoreOptionsStruct::EndianSwap(void*) 129 139 { 130 140 // noop for now 131 141 } … … 162 172 // #pragma mark - 163 173 164 174 165 FindWindow::FindWindow(const entry_ref *newRef, bool editIfTemplateOnly) 166 : BWindow(kInitialRect, "Find", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE), 175 FindWindow::FindWindow(const entry_ref* newRef, bool editIfTemplateOnly) 176 : BWindow(kInitialRect, 177 B_TRANSLATE("Find"), 178 B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE), 167 179 fFile(TryOpening(newRef)), 168 180 fFromTemplate(false), 169 181 fEditTemplateOnly(false), … … 176 188 if (BNodeInfo(fFile).GetType(type) == B_OK 177 189 && strcasecmp(type, B_QUERY_TEMPLATE_MIMETYPE) == 0) { 178 190 fEditTemplateOnly = true; 179 SetTitle( "Edit Query template");191 SetTitle(B_TRANSLATE("Edit Query template")); 180 192 } 181 193 } 182 194 } else { … … 205 217 206 218 fFromTemplate = IsQueryTemplate(fFile); 207 219 208 fBackground = new FindPanel(Bounds(), fFile, this, fFromTemplate, fEditTemplateOnly); 220 fBackground = new FindPanel(Bounds(), 221 fFile, this, fFromTemplate, fEditTemplateOnly); 209 222 AddChild(fBackground); 210 223 } 211 224 … … 362 375 363 376 // save date/time info for recent query support and transient query killer 364 377 int32 currentTime = (int32)time(0); 365 file->WriteAttr(kAttrQueryLastChange, B_INT32_TYPE, 0, ¤tTime, sizeof(int32)); 378 file->WriteAttr(kAttrQueryLastChange, 379 B_INT32_TYPE, 0, ¤tTime, sizeof(int32)); 366 380 int32 tmp = 1; 367 381 file->WriteAttr("_trk/recentQuery", B_INT32_TYPE, 0, &tmp, sizeof(int32)); 368 382 } … … 380 394 // and the file's location 381 395 FSSetPoseLocation(entry, *oldLocation); 382 396 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); 384 401 385 402 BString predicate; 386 403 bool dynamicDate; … … 434 451 // write out all the dialog items as attributes so that the query can 435 452 // be reopened and edited later 436 453 437 BView *focusedItem = CurrentFocus();454 BView* focusedItem = CurrentFocus(); 438 455 if (focusedItem) { 439 456 // text controls never get the focus, their internal text views do 440 BView *parent = focusedItem->Parent();457 BView* parent = focusedItem->Parent(); 441 458 if (dynamic_cast<BTextControl *>(parent)) 442 459 focusedItem = parent; 443 460 444 461 // write out the current focus and, if text control, selection 445 462 BString name(focusedItem->Name()); 446 463 file->WriteAttrString("_trk/focusedView", &name); 447 BTextControl *textControl = dynamic_cast<BTextControl *>(focusedItem);464 BTextControl* textControl = dynamic_cast<BTextControl *>(focusedItem); 448 465 if (textControl) { 449 466 int32 selStart, selEnd; 450 467 textControl->TextView()->GetSelection(&selStart, &selEnd); … … 474 491 if (!FindSaveCommon(true)) { 475 492 // have to wait for the node monitor to force old query to close 476 493 // to avoid a race condition 477 TTracker *tracker = dynamic_cast<TTracker *>(be_app);494 TTracker* tracker = dynamic_cast<TTracker *>(be_app); 478 495 ASSERT(tracker); 479 496 for (int32 timeOut = 0; ; timeOut++) { 480 497 if (!tracker->EntryHasWindowOpen(&fRef)) … … 494 511 } 495 512 496 513 int32 currentTime = (int32)time(0); 497 fFile->WriteAttr(kAttrQueryLastChange, B_INT32_TYPE, 0, ¤tTime, sizeof(int32)); 514 fFile->WriteAttr(kAttrQueryLastChange, 515 B_INT32_TYPE, 0, ¤tTime, sizeof(int32)); 498 516 499 517 // tell the tracker about it 500 518 BMessage message(B_REFS_RECEIVED); … … 625 643 else { 626 644 BMessenger panel(BackgroundView()); 627 645 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:")); 630 650 fSaveAsTemplatePanel->Show(); 631 651 } 632 652 break; … … 666 686 667 687 BMessenger self(this); 668 688 fRecentQueries = new BPopUpMenu("RecentQueries"); 669 FindPanel::AddRecentQueries(fRecentQueries, true, &self, kSwitchToQueryTemplate); 689 FindPanel::AddRecentQueries(fRecentQueries, 690 true, &self, kSwitchToQueryTemplate); 670 691 671 692 AddChild(new MiniMenuField(rect, "RecentQueries", fRecentQueries)); 672 693 … … 680 701 rect.right = rect.left + 150; 681 702 fMimeTypeField = new BMenuField(rect, "MimeTypeMenu", "", fMimeTypeMenu); 682 703 fMimeTypeField->SetDivider(0.0f); 683 fMimeTypeField->MenuItem()->SetLabel("All files and folders"); 704 fMimeTypeField->MenuItem()->SetLabel( 705 B_TRANSLATE("All files and folders")); 684 706 AddChild(fMimeTypeField); 685 707 686 708 // add popup for search criteria 687 709 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))); 691 719 692 720 fSearchModeMenu->ItemAt(initialMode == kByNameItem ? 0 : 693 721 (initialMode == kByAttributeItem ? 1 : 2))->SetMarked(true); … … 695 723 rect.left = rect.right + 10; 696 724 rect.right = rect.left + 100; 697 725 rect.bottom = rect.top + 15; 698 BMenuField *menuField = new BMenuField(rect, "", "", fSearchModeMenu);726 BMenuField* menuField = new BMenuField(rect, "", "", fSearchModeMenu); 699 727 menuField->SetDivider(0.0f); 700 728 AddChild(menuField); 701 729 … … 703 731 rect.right = bounds.right - 15; 704 732 rect.left = rect.right - 100; 705 733 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); 707 737 menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 8); 708 738 AddChild(menuField); 709 739 AddVolumes(fVolMenu); … … 715 745 dragNDropMessage.AddString("be:types", B_FILE_MIME_TYPE); 716 746 dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[0]); 717 747 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])); 720 752 721 753 BMessenger self(this); 722 fDraggableIcon = new DraggableQueryIcon(DraggableIcon::PreferredRect(draggableIconOrigin, 754 fDraggableIcon = new DraggableQueryIcon( 755 DraggableIcon::PreferredRect(draggableIconOrigin, 723 756 B_LARGE_ICON), "saveHere", &dragNDropMessage, 724 757 self, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); 725 758 AddChild(fDraggableIcon); … … 747 780 rect = expandedBounds; 748 781 rect.right = rect.left + 200; 749 782 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); 751 786 fQueryName->SetDivider(fQueryName->StringWidth(fQueryName->Label()) + 5); 752 787 fMoreOptionsPane->AddItem(fQueryName, 1); 753 788 FillCurrentQueryName(fQueryName, parent); … … 755 790 rect.top = rect.bottom + 6; 756 791 rect.bottom = rect.top + 16; 757 792 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); 759 796 fSearchTrashCheck->ResizeToPreferred(); 760 797 fMoreOptionsPane->AddItem(fSearchTrashCheck, 1); 761 798 762 799 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); 764 803 fMoreOptionsPane->AddItem(fTemporaryCheck, 1); 765 804 fTemporaryCheck->SetValue(1); 766 805 … … 787 826 rect.top = rect.bottom - 30; 788 827 rect.right = rect.left + 60; 789 828 rect.bottom = rect.top + 20; 790 BButton *button;829 BButton* button; 791 830 if (editTemplateOnly) 792 button = new BButton(rect, "save", "Save", 831 button = new BButton(rect, "save", 832 B_TRANSLATE("Save"), 793 833 new BMessage(kSaveButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); 794 834 else 795 button = new BButton(rect, "find", "Search", 835 button = new BButton(rect, "find", 836 B_TRANSLATE("Search"), 796 837 new BMessage(kFindButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); 797 838 798 839 AddChild(button); … … 831 872 textControl->MakeFocus(); 832 873 } 833 874 834 BButton *button = dynamic_cast<BButton *>(FindView("remove"));875 BButton* button = dynamic_cast<BButton *>(FindView("remove")); 835 876 if (button) 836 877 button->SetTarget(this); 837 878 … … 956 997 } else if (countSelected > 1) 957 998 // if more than two disks selected, don't use the disk name 958 999 // as a label 959 PopUpMenuSetTitle(fVolMenu, "multiple disks"); 1000 PopUpMenuSetTitle(fVolMenu, 1001 B_TRANSLATE("multiple disks")); 960 1002 else { 961 1003 ASSERT(tmpItem); 962 1004 PopUpMenuSetTitle(fVolMenu, tmpItem->Label()); … … 1053 1095 Window()->ResizeTo(Window()->Frame().Width(), 1054 1096 ViewHeightForMode(kByAttributeItem, fLatch->Value() != 0)); 1055 1097 1056 BBox *box = dynamic_cast<BBox *>(FindView("Box"));1098 BBox* box = dynamic_cast<BBox *>(FindView("Box")); 1057 1099 ASSERT(box); 1058 1100 box->ResizeTo(box->Bounds().Width(), 1059 1101 BoxHeightForMode(kByAttributeItem, fLatch->Value() != 0)); … … 1109 1151 bool queryTemplate = false; 1110 1152 1111 1153 if (actionSpecifier 1112 && strcasecmp(actionSpecifier, kDragNDropActionSpecifiers[0]) == 0) 1154 && strcasecmp(actionSpecifier, 1155 B_TRANSLATE(kDragNDropActionSpecifiers[0])) == 0) 1113 1156 query = true; 1114 1157 else if (actionSpecifier 1115 && strcasecmp(actionSpecifier, kDragNDropActionSpecifiers[1]) == 0) 1158 && strcasecmp(actionSpecifier, 1159 B_TRANSLATE(kDragNDropActionSpecifiers[1])) == 0) 1116 1160 queryTemplate = true; 1117 1161 else if (mimeType && strcasecmp(mimeType, kDragNDropTypes[0]) == 0) 1118 1162 query = true; … … 1137 1181 { 1138 1182 BDirectory directory(dir); 1139 1183 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); 1141 1187 1142 1188 BMessage attach(kAttachFile); 1143 1189 attach.AddRef("directory", dir); … … 1320 1366 BTextControl *textControl = dynamic_cast<BTextControl *>(FindView("TextControl")); 1321 1367 switch (Mode()) { 1322 1368 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; 1325 1372 1326 1373 case kByFormulaItem: 1327 result << "Formula " << textControl->TextView()->Text(); 1374 result.SetTo(B_TRANSLATE_COMMENT("Formula %formula", "FindResultTitle")); 1375 result.ReplaceFirst("%formula", textControl->TextView()->Text()); 1328 1376 break; 1329 1377 1330 1378 case kByAttributeItem: … … 1593 1641 { 1594 1642 BMessage *itemMessage = new BMessage(kMIMETypeItem); 1595 1643 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)); 1597 1647 MimeTypeMenu()->AddSeparatorItem(); 1598 1648 MimeTypeMenu()->ItemAt(0)->SetMarked(true); 1599 1649 … … 1673 1723 1674 1724 BMessage *message = new BMessage(kVolumeItem); 1675 1725 message->AddInt32("device", -1); 1676 menu->AddItem(new BMenuItem("All disks", message)); 1726 menu->AddItem( 1727 new BMenuItem(B_TRANSLATE("All disks"), 1728 message)); 1677 1729 menu->AddSeparatorItem(); 1678 PopUpMenuSetTitle(menu, "All disks");1730 PopUpMenuSetTitle(menu, B_TRANSLATE("All disks")); 1679 1731 1680 1732 BVolumeRoster roster; 1681 1733 BVolume volume; … … 1813 1865 menu->AddSeparatorItem(); 1814 1866 1815 1867 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); 1817 1872 menu->AddItem(item); 1818 1873 } 1819 1874 } … … 1840 1895 BRect rect = box->Bounds(); 1841 1896 rect.InsetBy(5, 10); 1842 1897 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")); 1844 1900 1845 button = new BButton(rect, "add", "Add", new BMessage(kAddItem), 1901 button = new BButton(rect, "add", 1902 B_TRANSLATE("Add"), 1903 new BMessage(kAddItem), 1846 1904 B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); 1847 1905 button->SetTarget(this); 1848 1906 box->AddChild(button); 1849 1907 1850 1908 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), 1853 1914 B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); 1854 1915 1855 1916 button->SetEnabled(false); … … 2333 2394 BPopUpMenu *menu = new BPopUpMenu("PopUp"); 2334 2395 2335 2396 // add NAME attribute to popup 2336 BMenu *submenu = new BMenu("Name");2397 BMenu* submenu = new BMenu(B_TRANSLATE("Name")); 2337 2398 submenu->SetRadioMode(true); 2338 2399 submenu->SetFont(be_plain_font); 2339 2400 BMessage *message = new BMessage(kAttributeItemMain); … … 2342 2403 BMenuItem *item = new BMenuItem(submenu, message); 2343 2404 menu->AddItem(item); 2344 2405 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")}; 2347 2418 2348 for (int32 i = 0; i < 5;i++) {2419 for (int32 i = 0; i < 5; i++) { 2349 2420 message = new BMessage(kAttributeItem); 2350 2421 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)); 2352 2425 } 2353 2426 2354 2427 // mark first item … … 2356 2429 submenu->ItemAt(0)->SetMarked(true); 2357 2430 2358 2431 // add SIZE attribute 2359 submenu = new BMenu( "Size");2432 submenu = new BMenu(B_TRANSLATE("Size")); 2360 2433 submenu->SetRadioMode(true); 2361 2434 submenu->SetFont(be_plain_font); 2362 2435 message = new BMessage(kAttributeItemMain); … … 2367 2440 2368 2441 message = new BMessage(kAttributeItem); 2369 2442 message->AddInt32("operator", B_GE); 2370 submenu->AddItem(new BMenuItem("greater than", message)); 2443 submenu->AddItem(new BMenuItem( 2444 B_TRANSLATE("greater than"), message)); 2371 2445 2372 2446 message = new BMessage(kAttributeItem); 2373 2447 message->AddInt32("operator", B_LE); 2374 submenu->AddItem(new BMenuItem("less than", message)); 2448 submenu->AddItem(new BMenuItem( 2449 B_TRANSLATE("less than"), message)); 2375 2450 2376 2451 message = new BMessage(kAttributeItem); 2377 2452 message->AddInt32("operator", B_EQ); 2378 submenu->AddItem(new BMenuItem("is", message)); 2453 submenu->AddItem(new BMenuItem( 2454 B_TRANSLATE("is"), message)); 2379 2455 2380 2456 // add "modified" field 2381 submenu = new BMenu("Modified"); 2457 submenu = new BMenu( 2458 B_TRANSLATE("Modified")); 2382 2459 submenu->SetRadioMode(true); 2383 2460 submenu->SetFont(be_plain_font); 2384 2461 message = new BMessage(kAttributeItemMain); … … 2389 2466 2390 2467 message = new BMessage(kAttributeItem); 2391 2468 message->AddInt32("operator", B_LE); 2392 submenu->AddItem(new BMenuItem("before", message)); 2469 submenu->AddItem(new BMenuItem( 2470 B_TRANSLATE("before"), message)); 2393 2471 2394 2472 message = new BMessage(kAttributeItem); 2395 2473 message->AddInt32("operator", B_GE); 2396 submenu->AddItem(new BMenuItem("after", message)); 2474 submenu->AddItem(new BMenuItem( 2475 B_TRANSLATE("after"), message)); 2397 2476 2398 2477 BRect bounds(Bounds()); 2399 2478 bounds.right = bounds.left + 100; … … 2518 2597 BPopUpMenu *menu = new BPopUpMenu(""); 2519 2598 BMessage *message = new BMessage(); 2520 2599 message->AddInt32("combine", B_AND); 2521 BMenuItem *item = new BMenuItem("And", message); 2600 BMenuItem* item = new BMenuItem( 2601 B_TRANSLATE("And"), message); 2522 2602 menu->AddItem(item); 2523 2603 if (selectAnd) 2524 2604 item->SetMarked(true); 2525 2605 2526 2606 message = new BMessage(); 2527 2607 message->AddInt32("combine", B_OR); 2528 item = new BMenuItem("Or", message); 2608 item = new BMenuItem( 2609 B_TRANSLATE("Or"), message); 2529 2610 menu->AddItem(item); 2530 2611 if (!selectAnd) 2531 2612 item->SetMarked(true); … … 2654 2735 case B_STRING_TYPE: 2655 2736 message = new BMessage(kAttributeItem); 2656 2737 message->AddInt32("operator", B_CONTAINS); 2657 submenu->AddItem(new BMenuItem("contains", message)); 2738 submenu->AddItem(new BMenuItem( 2739 B_TRANSLATE("contains"), 2740 message)); 2658 2741 2659 2742 message = new BMessage(kAttributeItem); 2660 2743 message->AddInt32("operator", B_EQ); 2661 submenu->AddItem(new BMenuItem("is", message)); 2744 submenu->AddItem( 2745 new BMenuItem(B_TRANSLATE("is"), 2746 message)); 2662 2747 2663 2748 message = new BMessage(kAttributeItem); 2664 2749 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)); 2666 2753 submenu->SetTargetForItems(this); 2667 2754 2668 2755 message = new BMessage(kAttributeItem); 2669 2756 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)); 2671 2760 submenu->SetTargetForItems(this); 2672 2761 2673 2762 message = new BMessage(kAttributeItem); 2674 2763 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)); 2676 2767 break; 2677 2768 2678 2769 case B_BOOL_TYPE: … … 2689 2780 case B_DOUBLE_TYPE: 2690 2781 message = new BMessage(kAttributeItem); 2691 2782 message->AddInt32("operator", B_EQ); 2692 submenu->AddItem(new BMenuItem("is", message)); 2783 submenu->AddItem( 2784 new BMenuItem(B_TRANSLATE("is"), 2785 message)); 2693 2786 2694 2787 message = new BMessage(kAttributeItem); 2695 2788 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)); 2697 2792 2698 2793 message = new BMessage(kAttributeItem); 2699 2794 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)); 2701 2798 break; 2702 2799 2703 2800 case B_TIME_TYPE: 2704 2801 message = new BMessage(kAttributeItem); 2705 2802 message->AddInt32("operator", B_LE); 2706 submenu->AddItem(new BMenuItem("before", message)); 2803 submenu->AddItem( 2804 new BMenuItem(B_TRANSLATE("before"), 2805 message)); 2707 2806 2708 2807 message = new BMessage(kAttributeItem); 2709 2808 message->AddInt32("operator", B_GE); 2710 submenu->AddItem(new BMenuItem("after", message)); 2809 submenu->AddItem( 2810 new BMenuItem(B_TRANSLATE("after"), 2811 message)); 2711 2812 break; 2712 2813 } 2713 2814 submenu->SetTargetForItems(this); … … 2990 3091 ASSERT(window); 2991 3092 dragMessage->AddString("be:clip_name", 2992 3093 window->BackgroundView()->UserSpecifiedName() ? 2993 window->BackgroundView()->UserSpecifiedName() : "New Query"); 3094 window->BackgroundView()->UserSpecifiedName() 3095 : B_TRANSLATE("New Query")); 2994 3096 2995 3097 return true; 2996 3098 } -
FilePermissionsView.cpp
38 38 #include <stdlib.h> 39 39 40 40 #include <Beep.h> 41 #include <Catalog.h> 42 #include <Locale.h> 41 43 42 44 43 45 const uint32 kPermissionsChanged = 'prch'; … … 45 47 const uint32 kNewGroupEntered = 'nwgr'; 46 48 47 49 50 #undef B_TRANSLATE_CONTEXT 51 #define B_TRANSLATE_CONTEXT "libTracker" 52 48 53 FilePermissionsView::FilePermissionsView(BRect rect, Model *model) 49 54 : BView(rect, "FilePermissionsView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW), 50 55 fModel(model) … … 63 68 strView->SetFontSize(kAttribFontHeight); 64 69 65 70 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")); 68 77 AddChild(strView); 69 78 strView->SetAlignment(B_ALIGN_CENTER); 70 79 strView->SetFontSize(kAttribFontHeight); 71 80 72 81 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")); 75 88 AddChild(strView); 76 89 strView->SetAlignment(B_ALIGN_CENTER); 77 90 strView->SetFontSize(kAttribFontHeight); … … 82 95 - kColumnLabelWidth / 2 - 5, kRowLabelHeight = 14; 83 96 84 97 strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop, kRowLabelRight, 85 kRowLabelTop + kRowLabelHeight), "", "Read"); 98 kRowLabelTop + kRowLabelHeight), 99 "", B_TRANSLATE("Read")); 86 100 AddChild(strView); 87 101 strView->SetAlignment(B_ALIGN_RIGHT); 88 102 strView->SetFontSize(kAttribFontHeight); 89 103 90 104 strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop 91 105 + kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop 92 + kRowLabelVerticalSpacing + kRowLabelHeight), "", "Write"); 106 + kRowLabelVerticalSpacing + kRowLabelHeight), 107 "", B_TRANSLATE("Write")); 93 108 AddChild(strView); 94 109 strView->SetAlignment(B_ALIGN_RIGHT); 95 110 strView->SetFontSize(kAttribFontHeight); 96 111 97 112 strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop 98 113 + 2 * kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop 99 + 2 * kRowLabelVerticalSpacing + kRowLabelHeight), "", "Execute"); 114 + 2 * kRowLabelVerticalSpacing + kRowLabelHeight), 115 "", B_TRANSLATE("Execute")); 100 116 AddChild(strView); 101 117 strView->SetAlignment(B_ALIGN_RIGHT); 102 118 strView->SetFontSize(kAttribFontHeight); … … 126 142 const float kTextControlLeft = 170, kTextControlRight = 270, 127 143 kTextControlTop = kColumnLabelTop, kTextControlHeight = 14, kTextControlSpacing = 16; 128 144 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")); 131 149 strView->SetAlignment(B_ALIGN_CENTER); 132 150 strView->SetFontSize(kAttribFontHeight); 133 151 AddChild(strView); … … 138 156 fOwnerTextControl->SetDivider(0); 139 157 AddChild(fOwnerTextControl); 140 158 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")); 144 164 strView->SetAlignment(B_ALIGN_CENTER); 145 165 strView->SetFontSize(kAttribFontHeight); 146 166 AddChild(strView); -
CountView.cpp
37 37 #include "CountView.h" 38 38 39 39 #include <Application.h> 40 #include <Catalog.h> 40 41 #include <ControlLook.h> 42 #include <Locale.h> 41 43 42 44 #include "AutoLock.h" 43 45 #include "Bitmaps.h" 44 46 #include "ContainerWindow.h" 45 47 #include "DirMenu.h" 46 48 #include "PoseView.h" 49 #include "Utilities.h" 47 50 48 51 49 52 const bigtime_t kBarberPoleDelay = 500000; 50 53 51 54 55 #undef B_TRANSLATE_CONTEXT 56 #define B_TRANSLATE_CONTEXT "libTracker" 57 52 58 BCountView::BCountView(BRect bounds, BPoseView* view) 53 59 : BView(bounds, "CountVw", B_FOLLOW_LEFT + B_FOLLOW_BOTTOM, 54 60 B_PULSE_NEEDED | B_WILL_DRAW), … … 217 223 itemString << fLastCount << " " << Filter(); 218 224 } else { 219 225 if (fLastCount == 0) 220 itemString << "no items";226 itemString << B_TRANSLATE("no items"); 221 227 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 } 225 235 } 226 236 227 BString string(itemString);228 237 BRect textRect(TextInvalRect()); 229 238 230 TruncateString(& string, IsTypingAhead() ? B_TRUNCATE_BEGINNING239 TruncateString(&itemString, IsTypingAhead() ? B_TRUNCATE_BEGINNING 231 240 : IsFiltering() ? B_TRUNCATE_MIDDLE : B_TRUNCATE_END, 232 241 textRect.Width()); 233 242 … … 238 247 SetHighColor(0, 0, 0); 239 248 240 249 MovePenTo(textRect.LeftBottom()); 241 DrawString( string.String());250 DrawString(itemString.String()); 242 251 243 252 bounds.top++; 244 253 -
FavoritesMenu.cpp
37 37 #include <compat/sys/stat.h> 38 38 39 39 #include <Application.h> 40 #include <Catalog.h> 40 41 #include <FindDirectory.h> 41 42 #include <FilePanel.h> 43 #include <Locale.h> 42 44 #include <Message.h> 43 45 #include <Path.h> 44 46 #include <Query.h> … … 56 58 #include "Utilities.h" 57 59 58 60 61 62 #undef B_TRANSLATE_CONTEXT 63 #define B_TRANSLATE_CONTEXT "libTracker" 64 59 65 FavoritesMenu::FavoritesMenu(const char *title, BMessage *openFolderMessage, 60 66 BMessage *openFileMessage, const BMessenger &target, 61 67 bool isSavePanel, BRefFilter *filter) … … 166 172 167 173 if (!fAddedSeparatorForSection) { 168 174 fAddedSeparatorForSection = true; 169 AddItem(new TitledSeparatorItem("Favorites")); 175 AddItem(new TitledSeparatorItem( 176 B_TRANSLATE("Favorites"))); 170 177 } 171 178 fUniqueRefCheck.push_back(*model.EntryRef()); 172 179 AddItem(item); … … 211 218 if (item) { 212 219 if (!fAddedSeparatorForSection) { 213 220 fAddedSeparatorForSection = true; 214 AddItem(new TitledSeparatorItem("Recent documents")); 221 AddItem(new TitledSeparatorItem( 222 B_TRANSLATE("Recent documents"))); 215 223 } 216 224 AddItem(item); 217 225 fSectionItemCount++; … … 253 261 254 262 if (!ShouldShowModel(&model)) 255 263 return true; 256 257 264 BMenuItem *item = BNavMenu::NewModelItem(&model, fOpenFolderMessage, 258 265 fTarget, true); 259 266 if (item) { 260 267 if (!fAddedSeparatorForSection) { 261 268 fAddedSeparatorForSection = true; 262 AddItem(new TitledSeparatorItem("Recent folders")); 269 AddItem(new TitledSeparatorItem( 270 B_TRANSLATE("Recent folders"))); 263 271 } 264 272 AddItem(item); 265 273 item->SetEnabled(true); … … 436 444 // 437 445 438 446 if (CountItems() <= 0) { 439 BMenuItem *item = new BMenuItem("<No recent items>", 0); 447 BMenuItem* item = new BMenuItem( 448 B_TRANSLATE("<No recent items>"), 0); 440 449 item->SetEnabled(false); 441 450 AddItem(item); 442 451 } else