* Applied libtracker localization patch from T.Murai (a.k.a mt) with some modifications (see below).

* Functional modifications:
     Reworked InfoWindow file size localization, the patch removed number formating (size in bytes) and was too complicated to my taste.
     Replaced the uses of sprintf with the safer snprintf.
     Changed signature to x-vnd.Haiku-libtracker instead of x-vnd.Haiku-libTracker (to be consistent with the binary name)
* Style modifications:
     Reworked lots of 80 char indenting (probably due to the now shorter line lengths since your previous patch that wasn't using the macros)
     Lots of missing brackets when "if's" becomes multiline.
     Other minor fixes.

Noticed a few uses of FindItem on translated names that might become problematic someday. Added some TODO's regarding localization of file sizes. Localization might still be 
optimized a bit regarding the produced en.catkeys

Note to translators: .catkeys files should be placed in haikusource/data/catalogs/kits/tracker though beware as the base en.catkeys might change 
slightly in the next days.
Note to users: As with any other app you need to restart Tracker (or any aother app using libtracker's filepanels) for it to pick the locale setting. E.g: use 'quit an 
application' and 'restart Tracker' from process controller.

Thanks a lot T.Murai 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37492 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner 2010-07-13 12:39:53 +00:00
parent 4195dda90c
commit 4ed28a571a
32 changed files with 1392 additions and 861 deletions

View File

@ -37,10 +37,12 @@ All rights reserved.
#include <Alert.h>
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <CheckBox.h>
#include <Debug.h>
#include <GridLayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <SpaceLayoutItem.h>
#include <SeparatorView.h>
#include <Message.h>
@ -54,6 +56,8 @@ const uint32 kAutomountSettingsChanged = 'achg';
const uint32 kBootMountSettingsChanged = 'bchg';
const uint32 kEjectWhenUnmountingChanged = 'ejct';
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
class AutomountSettingsPanel : public BBox {
public:
@ -103,51 +107,56 @@ AutomountSettingsPanel::AutomountSettingsPanel(BMessage* settings,
BBox* autoMountBox = new BBox("autoMountBox", B_WILL_DRAW | B_FRAME_EVENTS
| B_PULSE_NEEDED | B_NAVIGABLE_JUMP);
autoMountBox->SetLabel("Automatic disk mounting");
autoMountBox->SetLabel(B_TRANSLATE("Automatic disk mounting"));
BGroupLayout* autoMountLayout = new BGroupLayout(B_VERTICAL, spacing);
autoMountBox->SetLayout(autoMountLayout);
autoMountLayout->SetInsets(spacing,
autoMountBox->InnerFrame().top + spacing, spacing, spacing);
fScanningDisabledCheck = new BRadioButton("scanningOff", "Don't automount",
fScanningDisabledCheck = new BRadioButton("scanningOff",
B_TRANSLATE("Don't automount"),
new BMessage(kAutomountSettingsChanged));
fAutoMountAllBFSCheck = new BRadioButton("autoBFS", "All BeOS disks",
new BMessage(kAutomountSettingsChanged));
fAutoMountAllBFSCheck = new BRadioButton("autoBFS",
B_TRANSLATE("All BeOS disks"), new BMessage(kAutomountSettingsChanged));
fAutoMountAllCheck = new BRadioButton("autoAll", "All disks",
new BMessage(kAutomountSettingsChanged));
fAutoMountAllCheck = new BRadioButton("autoAll",
B_TRANSLATE("All disks"), new BMessage(kAutomountSettingsChanged));
// "Disk Mounting During Boot" group
BBox* bootMountBox = new BBox("", B_WILL_DRAW | B_FRAME_EVENTS
| B_PULSE_NEEDED | B_NAVIGABLE_JUMP);
bootMountBox->SetLabel("Disk mounting during boot");
bootMountBox->SetLabel(B_TRANSLATE("Disk mounting during boot"));
BGroupLayout* bootMountLayout = new BGroupLayout(B_VERTICAL, spacing);
bootMountBox->SetLayout(bootMountLayout);
bootMountLayout->SetInsets(spacing,
bootMountBox->InnerFrame().top + spacing, spacing, spacing);
fInitialDontMountCheck = new BRadioButton("initialNone",
"Only the boot disk", new BMessage(kBootMountSettingsChanged));
B_TRANSLATE("Only the boot disk"),
new BMessage(kBootMountSettingsChanged));
fInitialMountRestoreCheck = new BRadioButton("initialRestore",
"Previously mounted disks", new BMessage(kBootMountSettingsChanged));
B_TRANSLATE("Previously mounted disks"),
new BMessage(kBootMountSettingsChanged));
fInitialMountAllBFSCheck = new BRadioButton("initialBFS",
"All BeOS disks", new BMessage(kBootMountSettingsChanged));
B_TRANSLATE("All BeOS disks"),
new BMessage(kBootMountSettingsChanged));
fInitialMountAllCheck = new BRadioButton("initialAll",
"All disks", new BMessage(kBootMountSettingsChanged));
B_TRANSLATE("All disks"), new BMessage(kBootMountSettingsChanged));
fEjectWhenUnmountingCheckBox = new BCheckBox("ejectWhenUnmounting",
"Eject when unmounting", new BMessage(kEjectWhenUnmountingChanged));
B_TRANSLATE("Eject when unmounting"),
new BMessage(kEjectWhenUnmountingChanged));
// Buttons
fDone = new BButton("Done", new BMessage(B_QUIT_REQUESTED));
fDone = new BButton(B_TRANSLATE("Done"), new BMessage(B_QUIT_REQUESTED));
fMountAllNow = new BButton("mountAll", "Mount all disks now",
fMountAllNow = new BButton("mountAll", B_TRANSLATE("Mount all disks now"),
new BMessage(kMountAllNow));
fDone->MakeDefault(true);
@ -292,9 +301,9 @@ AutomountSettingsPanel::_SendSettings(bool rescan)
AutomountSettingsDialog::AutomountSettingsDialog(BMessage* settings,
const BMessenger& target)
:
BWindow(BRect(100, 100, 320, 370), "Disk mount settings",
BWindow(BRect(100, 100, 320, 370), B_TRANSLATE("Disk mount settings"),
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
| B_AUTO_UPDATE_SIZE_LIMITS)
| B_AUTO_UPDATE_SIZE_LIMITS)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
BView* view = new AutomountSettingsPanel(settings, target);
@ -325,9 +334,10 @@ AutomountSettingsDialog::RunAutomountSettings(const BMessenger& target)
BMessage reply;
status_t ret = target.SendMessage(&message, &reply, 2500000);
if (ret != B_OK) {
(new BAlert("Mount server error", "The mount server could not be "
"contacted.", "OK", NULL, NULL, B_WIDTH_AS_USUAL,
B_STOP_ALERT))->Go();
(new BAlert(B_TRANSLATE("Mount server error"),
B_TRANSLATE("The mount server could not be contacted."),
B_TRANSLATE("OK"),
NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
return;
}

View File

@ -39,12 +39,14 @@ All rights reserved.
#include <Alert.h>
#include <Application.h>
#include <AppFileInfo.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <Debug.h>
#include <Directory.h>
#include <Entry.h>
#include <FindDirectory.h>
#include <InterfaceDefs.h>
#include <Locale.h>
#include <MenuItem.h>
#include <MenuBar.h>
#include <NodeMonitor.h>
@ -89,6 +91,9 @@ All rights reserved.
#include "TemplatesMenu.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
const uint32 kRedo = 'REDO';
// this is the same as B_REDO in Dano/Zeta/Haiku
@ -103,8 +108,6 @@ const float kDragSlop = 3.0f;
namespace BPrivate {
const char *kAddOnsMenuName = "Add-ons";
class DraggableContainerIcon : public BView {
public:
DraggableContainerIcon(BRect rect, const char *name, uint32 resizeMask);
@ -261,10 +264,11 @@ AddOnThread(BMessage *refsMessage, entry_ref addonRef, entry_ref dirRef)
result = addonImage;
}
char buffer[1024];
sprintf(buffer, "Error %s loading Add-On %s.", strerror(result), addonRef.name);
BString buffer(B_TRANSLATE("Error %error loading Add-On %name."));
buffer.ReplaceFirst("%error", strerror(result));
buffer.ReplaceFirst("%name", addonRef.name);
BAlert *alert = new BAlert("", buffer, "Cancel", 0, 0,
BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("Cancel"), 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
@ -853,20 +857,20 @@ BContainerWindow::RepopulateMenus()
fMenuBar->RemoveItem(fFileMenu);
delete fFileMenu;
fFileMenu = new BMenu("File");
fFileMenu = new BMenu(B_TRANSLATE("File"));
AddFileMenu(fFileMenu);
fMenuBar->AddItem(fFileMenu);
fMenuBar->RemoveItem(fWindowMenu);
delete fWindowMenu;
fWindowMenu = new BMenu("Window");
fWindowMenu = new BMenu(B_TRANSLATE("Window"));
fMenuBar->AddItem(fWindowMenu);
AddWindowMenu(fWindowMenu);
// just create the attribute, decide to add it later
fMenuBar->RemoveItem(fAttrMenu);
delete fAttrMenu;
fAttrMenu = new BMenu("Attributes");
fAttrMenu = new BMenu(B_TRANSLATE("Attributes"));
NewAttributeMenu(fAttrMenu);
if (PoseView()->ViewMode() == kListMode)
ShowAttributeMenu();
@ -897,10 +901,12 @@ BContainerWindow::Init(const BMessage *message)
if (ShouldAddScrollBars())
fPoseView->AddScrollBars();
fMoveToItem = new BMenuItem(new BNavMenu("Move to", kMoveSelectionTo, this));
fCopyToItem = new BMenuItem(new BNavMenu("Copy to", kCopySelectionTo, this));
fCreateLinkItem = new BMenuItem(new BNavMenu("Create link", kCreateLink, this),
new BMessage(kCreateLink));
fMoveToItem = new BMenuItem(new BNavMenu(B_TRANSLATE("Move to"),
kMoveSelectionTo, this));
fCopyToItem = new BMenuItem(new BNavMenu(B_TRANSLATE("Copy to"),
kCopySelectionTo, this));
fCreateLinkItem = new BMenuItem(new BNavMenu(B_TRANSLATE("Create link"),
kCreateLink, this), new BMessage(kCreateLink));
TrackerSettings settings;
@ -1634,14 +1640,19 @@ BContainerWindow::MessageReceived(BMessage *message)
bool dontMoveToTrash = settings.DontMoveFilesToTrash();
BMenuItem *item = fFileContextMenu->FindItem(kMoveToTrash);
if (item)
item->SetLabel(dontMoveToTrash ? "Delete" : "Move to Trash");
if (item) {
item->SetLabel(dontMoveToTrash
? B_TRANSLATE("Delete")
: B_TRANSLATE("Move to Trash"));
}
// Deskbar doesn't have a menu bar, so check if there is fMenuBar
if (fMenuBar && fFileMenu) {
item = fFileMenu->FindItem(kMoveToTrash);
if (item)
item->SetLabel(dontMoveToTrash ? "Delete" : "Move to Trash");
if (item) {
item->SetLabel(dontMoveToTrash
? B_TRANSLATE("Delete")
: B_TRANSLATE("Move to Trash"));
}
}
UpdateIfNeeded();
}
@ -1685,11 +1696,11 @@ BContainerWindow::SetCutItem(BMenu *menu)
|| PoseView() != CurrentFocus());
if (modifiers() & B_SHIFT_KEY) {
item->SetLabel("Cut more");
item->SetLabel(B_TRANSLATE("Cut more"));
item->SetShortcut('X', B_COMMAND_KEY | B_SHIFT_KEY);
item->SetMessage(new BMessage(kCutMoreSelectionToClipboard));
} else {
item->SetLabel("Cut");
item->SetLabel(B_TRANSLATE("Cut"));
item->SetShortcut('X', B_COMMAND_KEY);
item->SetMessage(new BMessage(B_CUT));
}
@ -1708,11 +1719,11 @@ BContainerWindow::SetCopyItem(BMenu *menu)
|| PoseView() != CurrentFocus());
if (modifiers() & B_SHIFT_KEY) {
item->SetLabel("Copy more");
item->SetLabel(B_TRANSLATE("Copy more"));
item->SetShortcut('C', B_COMMAND_KEY | B_SHIFT_KEY);
item->SetMessage(new BMessage(kCopyMoreSelectionToClipboard));
} else {
item->SetLabel("Copy");
item->SetLabel(B_TRANSLATE("Copy"));
item->SetShortcut('C', B_COMMAND_KEY);
item->SetMessage(new BMessage(B_COPY));
}
@ -1730,11 +1741,11 @@ BContainerWindow::SetPasteItem(BMenu *menu)
item->SetEnabled(FSClipboardHasRefs() || PoseView() != CurrentFocus());
if (modifiers() & B_SHIFT_KEY) {
item->SetLabel("Paste links");
item->SetLabel(B_TRANSLATE("Paste links"));
item->SetShortcut('V', B_COMMAND_KEY | B_SHIFT_KEY);
item->SetMessage(new BMessage(kPasteLinksFromClipboard));
} else {
item->SetLabel("Paste");
item->SetLabel(B_TRANSLATE("Paste"));
item->SetShortcut('V', B_COMMAND_KEY);
item->SetMessage(new BMessage(B_PASTE));
}
@ -1753,11 +1764,11 @@ BContainerWindow::SetCleanUpItem(BMenu *menu)
&& (PoseView()->ViewMode() != kListMode));
if (modifiers() & B_SHIFT_KEY) {
item->SetLabel("Clean up all");
item->SetLabel(B_TRANSLATE("Clean up all"));
item->SetShortcut('K', B_COMMAND_KEY | B_SHIFT_KEY);
item->SetMessage(new BMessage(kCleanupAll));
} else {
item->SetLabel("Clean up");
item->SetLabel(B_TRANSLATE("Clean up"));
item->SetShortcut('K', B_COMMAND_KEY);
item->SetMessage(new BMessage(kCleanup));
}
@ -1773,12 +1784,12 @@ BContainerWindow::SetCloseItem(BMenu *menu)
return;
if (modifiers() & B_SHIFT_KEY) {
item->SetLabel("Close all");
item->SetLabel(B_TRANSLATE("Close all"));
item->SetShortcut('W', B_COMMAND_KEY | B_SHIFT_KEY);
item->SetTarget(be_app);
item->SetMessage(new BMessage(kCloseAllWindows));
} else {
item->SetLabel("Close");
item->SetLabel(B_TRANSLATE("Close"));
item->SetShortcut('W', B_COMMAND_KEY);
item->SetTarget(this);
item->SetMessage(new BMessage(B_QUIT_REQUESTED));
@ -1803,14 +1814,14 @@ BContainerWindow::IsShowing(const entry_ref *entry) const
void
BContainerWindow::AddMenus()
{
fFileMenu = new BMenu("File");
fFileMenu = new BMenu(B_TRANSLATE("File"));
AddFileMenu(fFileMenu);
fMenuBar->AddItem(fFileMenu);
fWindowMenu = new BMenu("Window");
fWindowMenu = new BMenu(B_TRANSLATE("Window"));
fMenuBar->AddItem(fWindowMenu);
AddWindowMenu(fWindowMenu);
// just create the attribute, decide to add it later
fAttrMenu = new BMenu("Attributes");
fAttrMenu = new BMenu(B_TRANSLATE("Attributes"));
NewAttributeMenu(fAttrMenu);
}
@ -1818,43 +1829,53 @@ BContainerWindow::AddMenus()
void
BContainerWindow::AddFileMenu(BMenu *menu)
{
if (!PoseView()->IsFilePanel())
menu->AddItem(new BMenuItem("Find"B_UTF8_ELLIPSIS,
if (!PoseView()->IsFilePanel()) {
menu->AddItem(new BMenuItem(B_TRANSLATE("Find" B_UTF8_ELLIPSIS),
new BMessage(kFindButton), 'F'));
}
if (!TargetModel()->IsQuery() && !IsTrash() && !IsPrintersDir()) {
if (!PoseView()->IsFilePanel()) {
TemplatesMenu *templateMenu = new TemplatesMenu(PoseView());
TemplatesMenu* templateMenu = new TemplatesMenu(PoseView(),
B_TRANSLATE("New"));
menu->AddItem(templateMenu);
templateMenu->SetTargetForItems(PoseView());
} else
menu->AddItem(new BMenuItem("New folder", new BMessage(kNewFolder), 'N'));
} else {
menu->AddItem(new BMenuItem(B_TRANSLATE("New folder"),
new BMessage(kNewFolder), 'N'));
}
}
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
if (IsTrash() || InTrash()) {
menu->AddItem(new BMenuItem("Restore", new BMessage(kRestoreFromTrash)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Restore"),
new BMessage(kRestoreFromTrash)));
if (IsTrash()) {
// add as first item in menu
menu->AddItem(new BMenuItem("Empty Trash", new BMessage(kEmptyTrash)), 0);
menu->AddItem(new BMenuItem(B_TRANSLATE("Empty Trash"),
new BMessage(kEmptyTrash)), 0);
menu->AddItem(new BSeparatorItem(), 1);
}
} else if (IsPrintersDir()) {
menu->AddItem(new BMenuItem("Add printer"B_UTF8_ELLIPSIS,
menu->AddItem(new BMenuItem(B_TRANSLATE("Add printer"B_UTF8_ELLIPSIS),
new BMessage(kAddPrinter), 'N'), 0);
menu->AddItem(new BSeparatorItem(), 1);
menu->AddItem(new BMenuItem("Make active printer",
menu->AddItem(new BMenuItem(B_TRANSLATE("Make active printer"),
new BMessage(kMakeActivePrinter)));
} else {
menu->AddItem(new BMenuItem("Duplicate",new BMessage(kDuplicateSelection), 'D'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Duplicate"),
new BMessage(kDuplicateSelection), 'D'));
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() ?
"Delete" : "Move to Trash",
new BMessage(kMoveToTrash), 'T'));
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
? B_TRANSLATE("Delete") : B_TRANSLATE("Move to Trash"),
new BMessage(kMoveToTrash), 'T'));
menu->AddSeparatorItem();
@ -1867,14 +1888,18 @@ BContainerWindow::AddFileMenu(BMenu *menu)
if (!IsPrintersDir()) {
menu->AddSeparatorItem();
menu->AddItem(cutItem = new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
menu->AddItem(copyItem = new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
menu->AddItem(cutItem = new BMenuItem(B_TRANSLATE("Cut"),
new BMessage(B_CUT), 'X'));
menu->AddItem(copyItem = new BMenuItem(B_TRANSLATE("Copy"),
new BMessage(B_COPY), 'C'));
menu->AddItem(pasteItem = new BMenuItem(B_TRANSLATE("Paste"),
new BMessage(B_PASTE), 'V'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Identify", new BMessage(kIdentifyEntry)));
BMenu *addOnMenuItem = new BMenu(kAddOnsMenuName);
menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"),
new BMessage(kIdentifyEntry)));
BMenu* addOnMenuItem = new BMenu(B_TRANSLATE("Add-ons"));
addOnMenuItem->SetFont(be_plain_font);
menu->AddItem(addOnMenuItem);
}
@ -1894,29 +1919,29 @@ BContainerWindow::AddWindowMenu(BMenu *menu)
{
BMenuItem *item;
BMenu* iconSizeMenu = new BMenu("Icon view");
BMenu* iconSizeMenu = new BMenu(B_TRANSLATE("Icon view"));
BMessage* message = new BMessage(kIconMode);
message->AddInt32("size", 32);
item = new BMenuItem("32 x 32", message);
item = new BMenuItem(B_TRANSLATE("32 x 32"), message);
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
message = new BMessage(kIconMode);
message->AddInt32("size", 40);
item = new BMenuItem("40 x 40", message);
item = new BMenuItem(B_TRANSLATE("40 x 40"), message);
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
message = new BMessage(kIconMode);
message->AddInt32("size", 48);
item = new BMenuItem("48 x 48", message);
item = new BMenuItem(B_TRANSLATE("48 x 48"), message);
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
message = new BMessage(kIconMode);
message->AddInt32("size", 64);
item = new BMenuItem("64 x 64", message);
item = new BMenuItem(B_TRANSLATE("64 x 64"), message);
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
@ -1924,13 +1949,13 @@ BContainerWindow::AddWindowMenu(BMenu *menu)
message = new BMessage(kIconMode);
message->AddInt32("scale", 0);
item = new BMenuItem("Decrease size", message, '-');
item = new BMenuItem(B_TRANSLATE("Decrease size"), message, '-');
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
message = new BMessage(kIconMode);
message->AddInt32("scale", 1);
item = new BMenuItem("Increase size", message, '+');
item = new BMenuItem(B_TRANSLATE("Increase size"), message, '+');
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
@ -1940,57 +1965,62 @@ BContainerWindow::AddWindowMenu(BMenu *menu)
iconSizeMenu->Superitem()->SetMessage(new BMessage(kIconMode));
iconSizeMenu->Superitem()->SetTarget(PoseView());
item = new BMenuItem("Mini icon view", new BMessage(kMiniIconMode), '2');
item = new BMenuItem(B_TRANSLATE("Mini icon view"),
new BMessage(kMiniIconMode), '2');
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("List view", new BMessage(kListMode), '3');
item = new BMenuItem(B_TRANSLATE("List view"),
new BMessage(kListMode), '3');
item->SetTarget(PoseView());
menu->AddItem(item);
menu->AddSeparatorItem();
item = new BMenuItem("Resize to fit", new BMessage(kResizeToFit), 'Y');
item = new BMenuItem(B_TRANSLATE("Resize to fit"),
new BMessage(kResizeToFit), 'Y');
item->SetTarget(this);
menu->AddItem(item);
item = new BMenuItem("Clean up", new BMessage(kCleanup), 'K');
item = new BMenuItem(B_TRANSLATE("Clean up"), new BMessage(kCleanup), 'K');
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Select"B_UTF8_ELLIPSIS,
item = new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A');
item = new BMenuItem(B_TRANSLATE("Select all"), new BMessage(B_SELECT_ALL),
'A');
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Invert selection", new BMessage(kInvertSelection),
'S');
item = new BMenuItem(B_TRANSLATE("Invert selection"),
new BMessage(kInvertSelection), 'S');
item->SetTarget(PoseView());
menu->AddItem(item);
if (!IsTrash()) {
item = new BMenuItem("Open parent", new BMessage(kOpenParentDir),
B_UP_ARROW);
item = new BMenuItem(B_TRANSLATE("Open parent"),
new BMessage(kOpenParentDir), B_UP_ARROW);
item->SetTarget(PoseView());
menu->AddItem(item);
}
item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W');
item = new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_QUIT_REQUESTED),
'W');
item->SetTarget(this);
menu->AddItem(item);
item = new BMenuItem("Close all in workspace",
item = new BMenuItem(B_TRANSLATE("Close all in workspace"),
new BMessage(kCloseAllInWorkspace), 'Q');
item->SetTarget(be_app);
menu->AddItem(item);
menu->AddSeparatorItem();
item = new BMenuItem("Preferences"B_UTF8_ELLIPSIS,
item = new BMenuItem(B_TRANSLATE("Preferences" B_UTF8_ELLIPSIS),
new BMessage(kShowSettingsWindow));
item->SetTarget(be_app);
menu->AddItem(item);
@ -2050,8 +2080,10 @@ BContainerWindow::MenusBeginning()
AddMimeTypesToMenu(fAttrMenu);
if (IsPrintersDir())
EnableNamedMenuItem(fFileMenu, "Make active printer", selectCount == 1);
if (IsPrintersDir()) {
EnableNamedMenuItem(fFileMenu, B_TRANSLATE("Make active printer"),
selectCount == 1);
}
}
@ -2163,7 +2195,7 @@ BContainerWindow::SetUpEditQueryItem(BMenu *menu)
bool poseViewIsQuery = TargetModel()->IsQuery();
// if the view is a query pose view, add edit query menu item
BMenuItem *item = menu->FindItem("Edit query");
BMenuItem* item = menu->FindItem(B_TRANSLATE("Edit query"));
if (!poseViewIsQuery && !queryInSelection && item)
item->Menu()->RemoveItem(item);
@ -2173,7 +2205,8 @@ BContainerWindow::SetUpEditQueryItem(BMenu *menu)
item = menu->FindItem(kOpenSelection);
if (item) {
int32 itemIndex = item->Menu()->IndexOf(item);
BMenuItem *query = new BMenuItem("Edit query", new BMessage(kEditQuery), 'G');
BMenuItem* query = new BMenuItem(B_TRANSLATE("Edit query"),
new BMessage(kEditQuery), 'G');
item->Menu()->AddItem(query, itemIndex + 1);
query->SetTarget(PoseView());
}
@ -2225,8 +2258,8 @@ BContainerWindow::SetupOpenWithMenu(BMenu *parent)
int32 index = item->Menu()->IndexOf(item);
fOpenWithItem = new BMenuItem(
new OpenWithMenu("Open with"B_UTF8_ELLIPSIS, &message, this, be_app),
new BMessage(kOpenSelectionWith));
new OpenWithMenu(B_TRANSLATE("Open with" B_UTF8_ELLIPSIS),
&message, this, be_app), new BMessage(kOpenSelectionWith));
fOpenWithItem->SetTarget(PoseView());
fOpenWithItem->SetShortcut('O', B_COMMAND_KEY | B_CONTROL_KEY);
@ -2260,7 +2293,8 @@ BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu *navMenu, uint32 what,
if (entry.SetTo(ref) == B_OK
&& entry.GetParent(&entry) == B_OK
&& model.SetTo(&entry) == B_OK) {
BNavMenu *menu = new BNavMenu("Current folder",what,this);
BNavMenu* menu = new BNavMenu(B_TRANSLATE("Current folder"), what,
this);
menu->SetNavDir(model.EntryRef());
menu->SetShowParent(true);
@ -2276,7 +2310,8 @@ BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu *navMenu, uint32 what,
path.Append("Tracker");
if (entry.SetTo(path.Path()) == B_OK
&& model.SetTo(&entry) == B_OK) {
BMenu *menu = new RecentsMenu("Recent folders",kRecentFolders,what,this);
BMenu* menu = new RecentsMenu(B_TRANSLATE("Recent folders"),
kRecentFolders, what, this);
BMenuItem *item = new SpecialModelMenuItem(&model,menu);
item->SetMessage(new BMessage((uint32)what));
@ -2375,9 +2410,9 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref *item_ref, BMenu *parent)
// Set the "Create Link" item label here so it
// appears correctly when menus are disabled, too.
if (modifierKeys & B_SHIFT_KEY)
fCreateLinkItem->SetLabel("Create relative link");
fCreateLinkItem->SetLabel(B_TRANSLATE("Create relative link"));
else
fCreateLinkItem->SetLabel("Create link");
fCreateLinkItem->SetLabel(B_TRANSLATE("Create link"));
// only enable once the menus are built
fMoveToItem->SetEnabled(false);
@ -2425,9 +2460,9 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref *item_ref, BMenu *parent)
BMenuItem *identifyItem = parent->FindItem(kIdentifyEntry);
if (identifyItem != NULL) {
if (modifierKeys & B_SHIFT_KEY)
identifyItem->SetLabel("Force identify");
identifyItem->SetLabel(B_TRANSLATE("Force identify"));
else
identifyItem->SetLabel("Identify");
identifyItem->SetLabel(B_TRANSLATE("Identify"));
}
}
@ -2446,10 +2481,10 @@ BContainerWindow::ShowDropContextMenu(BPoint loc)
if (item == NULL)
item = fDropContextMenu->FindItem(kCreateRelativeLink);
if (item && (modifiers() & B_SHIFT_KEY)) {
item->SetLabel("Create relative link here");
item->SetLabel(B_TRANSLATE("Create relative link here"));
item->SetMessage(new BMessage(kCreateRelativeLink));
} else if (item) {
item->SetLabel("Create link here");
item->SetLabel(B_TRANSLATE("Create link here"));
item->SetMessage(new BMessage(kCreateLink));
}
@ -2572,7 +2607,8 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *)
if (volume != boot)
ejectableVolumeSelected = true;
EnableNamedMenuItem(fContextMenu, "Unmount", ejectableVolumeSelected);
EnableNamedMenuItem(fContextMenu,
B_TRANSLATE("Unmount"), ejectableVolumeSelected);
}
}
@ -2607,36 +2643,45 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *)
void
BContainerWindow::AddFileContextMenus(BMenu *menu)
{
menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"), new BMessage(kGetInfo),
'I'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
if (!IsTrash() && !InTrash() && !IsPrintersDir())
menu->AddItem(new BMenuItem("Duplicate",
if (!IsTrash() && !InTrash() && !IsPrintersDir()) {
menu->AddItem(new BMenuItem(B_TRANSLATE("Duplicate"),
new BMessage(kDuplicateSelection), 'D'));
}
if (!IsTrash() && !InTrash()) {
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() ?
"Delete" : "Move to Trash",
new BMessage(kMoveToTrash), 'T'));
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
? B_TRANSLATE("Delete") : B_TRANSLATE("Move to Trash"),
new BMessage(kMoveToTrash), 'T'));
// add separator for copy to/move to items (navigation items)
menu->AddSeparatorItem();
} else {
menu->AddItem(new BMenuItem("Delete", new BMessage(kDelete), 0));
menu->AddItem(new BMenuItem("Restore", new BMessage(kRestoreFromTrash), 0));
menu->AddItem(new BMenuItem(B_TRANSLATE("Delete"),
new BMessage(kDelete), 0));
menu->AddItem(new BMenuItem(B_TRANSLATE("Restore"),
new BMessage(kRestoreFromTrash), 0));
}
#ifdef CUT_COPY_PASTE_IN_CONTEXT_MENU
menu->AddSeparatorItem();
BMenuItem *cutItem, *copyItem;
menu->AddItem(cutItem = new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
menu->AddItem(copyItem = new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
menu->AddItem(cutItem = new BMenuItem(B_TRANSLATE("Cut"),
new BMessage(B_CUT), 'X'));
menu->AddItem(copyItem = new BMenuItem(B_TRANSLATE("Copy"),
new BMessage(B_COPY), 'C'));
#endif
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Identify", new BMessage(kIdentifyEntry)));
BMenu *addOnMenuItem = new BMenu(kAddOnsMenuName);
menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"),
new BMessage(kIdentifyEntry)));
BMenu* addOnMenuItem = new BMenu(B_TRANSLATE("Add-ons"));
addOnMenuItem->SetFont(be_plain_font);
menu->AddItem(addOnMenuItem);
@ -2652,19 +2697,23 @@ BContainerWindow::AddFileContextMenus(BMenu *menu)
void
BContainerWindow::AddVolumeContextMenus(BMenu *menu)
{
menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
menu->AddSeparatorItem();
menu->AddItem(new MountMenu("Mount"));
menu->AddItem(new MountMenu(B_TRANSLATE("Mount")));
BMenuItem *item = new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U');
BMenuItem *item = new BMenuItem(B_TRANSLATE("Unmount"),
new BMessage(kUnmountVolume), 'U');
item->SetEnabled(false);
menu->AddItem(item);
menu->AddSeparatorItem();
menu->AddItem(new BMenu(kAddOnsMenuName));
menu->AddItem(new BMenu(B_TRANSLATE("Add-ons")));
menu->SetTargetForItems(PoseView());
}
@ -2678,14 +2727,17 @@ BContainerWindow::AddWindowContextMenus(BMenu *menu)
// mode menu
bool needSeparator = true;
if (IsTrash())
menu->AddItem(new BMenuItem("Empty Trash", new BMessage(kEmptyTrash)));
else if (IsPrintersDir())
menu->AddItem(new BMenuItem("Add printer"B_UTF8_ELLIPSIS, new BMessage(kAddPrinter), 'N'));
else if (InTrash())
if (IsTrash()) {
menu->AddItem(new BMenuItem(B_TRANSLATE("Empty Trash"),
new BMessage(kEmptyTrash)));
} else if (IsPrintersDir()) {
menu->AddItem(new BMenuItem(B_TRANSLATE("Add printer"B_UTF8_ELLIPSIS),
new BMessage(kAddPrinter), 'N'));
} else if (InTrash())
needSeparator = false;
else {
TemplatesMenu *templateMenu = new TemplatesMenu(PoseView());
TemplatesMenu* templateMenu = new TemplatesMenu(PoseView(),
B_TRANSLATE("New"));
menu->AddItem(templateMenu);
templateMenu->SetTargetForItems(PoseView());
templateMenu->SetFont(be_plain_font);
@ -2699,16 +2751,19 @@ BContainerWindow::AddWindowContextMenus(BMenu *menu)
menu->AddItem(pasteItem);
menu->AddSeparatorItem();
#endif
menu->AddItem(new BMenuItem("Clean up", new BMessage(kCleanup), 'K'));
menu->AddItem(new BMenuItem("Select"B_UTF8_ELLIPSIS,
menu->AddItem(new BMenuItem(B_TRANSLATE("Clean up"),
new BMessage(kCleanup), 'K'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
menu->AddItem(new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
if (!IsTrash())
menu->AddItem(new BMenuItem("Open parent", new BMessage(kOpenParentDir),
B_UP_ARROW));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select all"),
new BMessage(B_SELECT_ALL), 'A'));
if (!IsTrash()) {
menu->AddItem(new BMenuItem(B_TRANSLATE("Open parent"),
new BMessage(kOpenParentDir), B_UP_ARROW));
}
menu->AddSeparatorItem();
BMenu *addOnMenuItem = new BMenu(kAddOnsMenuName);
BMenu* addOnMenuItem = new BMenu(B_TRANSLATE("Add-ons"));
addOnMenuItem->SetFont(be_plain_font);
menu->AddItem(addOnMenuItem);
@ -2729,11 +2784,15 @@ BContainerWindow::AddWindowContextMenus(BMenu *menu)
void
BContainerWindow::AddDropContextMenus(BMenu *menu)
{
menu->AddItem(new BMenuItem("Create link here", new BMessage(kCreateLink)));
menu->AddItem(new BMenuItem("Move here", new BMessage(kMoveSelectionTo)));
menu->AddItem(new BMenuItem("Copy here", new BMessage(kCopySelectionTo)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Create link here"),
new BMessage(kCreateLink)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Move here"),
new BMessage(kMoveSelectionTo)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Copy here"),
new BMessage(kCopySelectionTo)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Cancel", new BMessage(kCancelButton)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Cancel"),
new BMessage(kCancelButton)));
}
@ -2741,11 +2800,11 @@ void
BContainerWindow::AddTrashContextMenus(BMenu *menu)
{
// setup special trash context menu
menu->AddItem(new BMenuItem("Empty Trash",
menu->AddItem(new BMenuItem(B_TRANSLATE("Empty Trash"),
new BMessage(kEmptyTrash)));
menu->AddItem(new BMenuItem("Open",
menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem("Get info",
menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
new BMessage(kGetInfo), 'I'));
menu->SetTargetForItems(PoseView());
}
@ -2887,7 +2946,7 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *,
void
BContainerWindow::BuildAddOnMenu(BMenu *menu)
{
BMenuItem *item = menu->FindItem(kAddOnsMenuName);
BMenuItem* item = menu->FindItem(B_TRANSLATE("Add-ons"));
if (menu->IndexOf(item) == 0) {
// the folder of the context menu seems to be named "Add-Ons"
// so we just take the last menu item, which is correct if not
@ -2965,7 +3024,7 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context)
if (context == kMenuBarContext || context == kWindowPopUpContext) {
BMenu* sizeMenu = NULL;
if (BMenuItem* item = menu->FindItem("Icon view")) {
if (BMenuItem* item = menu->FindItem(B_TRANSLATE("Icon view"))) {
sizeMenu = item->Submenu();
}
@ -3001,7 +3060,7 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context)
EnableNamedMenuItem(menu, kEmptyTrash, count > 0);
EnableNamedMenuItem(menu, B_SELECT_ALL, count > 0);
BMenuItem *item = menu->FindItem(kTemplatesMenuName);
BMenuItem* item = menu->FindItem(B_TRANSLATE("New"));
if (item) {
TemplatesMenu *templateMenu = dynamic_cast<TemplatesMenu *>(
item->Submenu());
@ -3022,10 +3081,12 @@ BContainerWindow::LoadAddOn(BMessage *message)
entry_ref addonRef;
status_t result = message->FindRef("refs", &addonRef);
if (result != B_OK) {
char buffer[1024];
sprintf(buffer, "Error %s loading add-On %s.", strerror(result), addonRef.name);
BAlert* alert = new BAlert("", buffer, "Cancel", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BString buffer(B_TRANSLATE("Error %error loading add-On %name."));
buffer.ReplaceFirst("%error", strerror(result));
buffer.ReplaceFirst("%name", addonRef.name);
BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("Cancel"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return;
@ -3086,44 +3147,47 @@ BContainerWindow::NewAttributeMenu(BMenu *menu)
ASSERT(PoseView());
BMenuItem *item;
menu->AddItem(item = new BMenuItem("Copy layout", new BMessage(kCopyAttributes)));
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Copy layout"),
new BMessage(kCopyAttributes)));
item->SetTarget(PoseView());
menu->AddItem(item = new BMenuItem("Paste layout", new BMessage(kPasteAttributes)));
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Paste layout"),
new BMessage(kPasteAttributes)));
item->SetTarget(PoseView());
menu->AddSeparatorItem();
menu->AddItem(NewAttributeMenuItem ("Name", kAttrStatName, B_STRING_TYPE,
145, B_ALIGN_LEFT, true, true));
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Name"),
kAttrStatName, B_STRING_TYPE, 145, B_ALIGN_LEFT, true, true));
menu->AddItem(NewAttributeMenuItem ("Size", kAttrStatSize, B_OFF_T_TYPE,
menu->AddItem(NewAttributeMenuItem (B_TRANSLATE("Size"), kAttrStatSize, B_OFF_T_TYPE,
80, B_ALIGN_RIGHT, false, true));
menu->AddItem(NewAttributeMenuItem ("Modified", kAttrStatModified, B_TIME_TYPE,
150, B_ALIGN_LEFT, false, true));
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Modified"),
kAttrStatModified, B_TIME_TYPE, 150, B_ALIGN_LEFT, false, true));
menu->AddItem(NewAttributeMenuItem ("Created", kAttrStatCreated, B_TIME_TYPE,
150, B_ALIGN_LEFT, false, true));
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Created"),
kAttrStatCreated, B_TIME_TYPE, 150, B_ALIGN_LEFT, false, true));
menu->AddItem(NewAttributeMenuItem ("Kind", kAttrMIMEType, B_MIME_STRING_TYPE,
145, B_ALIGN_LEFT, false, false));
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Kind"),
kAttrMIMEType, B_MIME_STRING_TYPE, 145, B_ALIGN_LEFT, false, false));
if (IsTrash() || InTrash())
menu->AddItem(NewAttributeMenuItem ("Original name", kAttrOriginalPath, B_STRING_TYPE,
225, B_ALIGN_LEFT, false, false));
else
menu->AddItem(NewAttributeMenuItem ("Location", kAttrPath, B_STRING_TYPE,
225, B_ALIGN_LEFT, false, false));
if (IsTrash() || InTrash()) {
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Original name"),
kAttrOriginalPath, B_STRING_TYPE, 225, B_ALIGN_LEFT, false, false));
} else {
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Location"), kAttrPath,
B_STRING_TYPE, 225, B_ALIGN_LEFT, false, false));
}
#ifdef OWNER_GROUP_ATTRIBUTES
menu->AddItem(NewAttributeMenuItem ("Owner", kAttrStatOwner, B_STRING_TYPE,
60, B_ALIGN_LEFT, false, true));
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Owner"), kAttrStatOwner,
B_STRING_TYPE, 60, B_ALIGN_LEFT, false, true));
menu->AddItem(NewAttributeMenuItem ("Group", kAttrStatGroup, B_STRING_TYPE,
60, B_ALIGN_LEFT, false, true));
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Group"), kAttrStatGroup,
B_STRING_TYPE, 60, B_ALIGN_LEFT, false, true));
#endif
menu->AddItem(NewAttributeMenuItem ("Permissions", kAttrStatMode, B_STRING_TYPE,
80, B_ALIGN_LEFT, false, true));
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Permissions"),
kAttrStatMode, B_STRING_TYPE, 80, B_ALIGN_LEFT, false, true));
}

View File

@ -37,18 +37,24 @@ All rights reserved.
#include "CountView.h"
#include <Application.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <Locale.h>
#include "AutoLock.h"
#include "Bitmaps.h"
#include "ContainerWindow.h"
#include "DirMenu.h"
#include "PoseView.h"
#include "Utilities.h"
const bigtime_t kBarberPoleDelay = 500000;
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
BCountView::BCountView(BRect bounds, BPoseView* view)
: BView(bounds, "CountVw", B_FOLLOW_LEFT + B_FOLLOW_BOTTOM,
B_PULSE_NEEDED | B_WILL_DRAW),
@ -217,17 +223,20 @@ BCountView::Draw(BRect updateRect)
itemString << fLastCount << " " << Filter();
} else {
if (fLastCount == 0)
itemString << "no items";
itemString << B_TRANSLATE("no items");
else if (fLastCount == 1)
itemString << "1 item";
else
itemString << fLastCount << " items";
itemString << B_TRANSLATE("1 item");
else {
itemString.SetTo(B_TRANSLATE("%num items"));
char numString[256];
snprintf(numString, sizeof(numString), "%ld", fLastCount);
itemString.ReplaceFirst("%num", numString);
}
}
BString string(itemString);
BRect textRect(TextInvalRect());
TruncateString(&string, IsTypingAhead() ? B_TRUNCATE_BEGINNING
TruncateString(&itemString, IsTypingAhead() ? B_TRUNCATE_BEGINNING
: IsFiltering() ? B_TRUNCATE_MIDDLE : B_TRUNCATE_END,
textRect.Width());
@ -238,7 +247,7 @@ BCountView::Draw(BRect updateRect)
SetHighColor(0, 0, 0);
MovePenTo(textRect.LeftBottom());
DrawString(string.String());
DrawString(itemString.String());
bounds.top++;

View File

@ -32,8 +32,10 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#include <Catalog.h>
#include <Debug.h>
#include <FindDirectory.h>
#include <Locale.h>
#include <NodeMonitor.h>
#include <Path.h>
#include <PopUpMenu.h>
@ -103,6 +105,8 @@ AddOneShortcut(const Model *model, const char *, uint32 shortcut, bool /*primary
// #pragma mark -
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
BDeskWindow::BDeskWindow(LockingList<BWindow> *windowList)
:
@ -266,7 +270,8 @@ BDeskWindow::CreatePoseView(Model *model)
void
BDeskWindow::AddWindowContextMenus(BMenu *menu)
{
TemplatesMenu *tempateMenu = new TemplatesMenu(PoseView());
TemplatesMenu* tempateMenu = new TemplatesMenu(PoseView(),
B_TRANSLATE("New"));
menu->AddItem(tempateMenu);
tempateMenu->SetTargetForItems(PoseView());
@ -274,32 +279,32 @@ BDeskWindow::AddWindowContextMenus(BMenu *menu)
menu->AddSeparatorItem();
BMenu* iconSizeMenu = new BMenu("Icon view");
BMenu* iconSizeMenu = new BMenu(B_TRANSLATE("Icon view"));
BMessage* message = new BMessage(kIconMode);
message->AddInt32("size", 32);
BMenuItem* item = new BMenuItem("32 x 32", message);
BMenuItem* item = new BMenuItem(B_TRANSLATE("32 x 32"), message);
item->SetMarked(PoseView()->IconSizeInt() == 32);
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
message = new BMessage(kIconMode);
message->AddInt32("size", 40);
item = new BMenuItem("40 x 40", message);
item = new BMenuItem(B_TRANSLATE("40 x 40"), message);
item->SetMarked(PoseView()->IconSizeInt() == 40);
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
message = new BMessage(kIconMode);
message->AddInt32("size", 48);
item = new BMenuItem("48 x 48", message);
item = new BMenuItem(B_TRANSLATE("48 x 48"), message);
item->SetMarked(PoseView()->IconSizeInt() == 48);
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
message = new BMessage(kIconMode);
message->AddInt32("size", 64);
item = new BMenuItem("64 x 64", message);
item = new BMenuItem(B_TRANSLATE("64 x 64"), message);
item->SetMarked(PoseView()->IconSizeInt() == 64);
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
@ -308,13 +313,13 @@ BDeskWindow::AddWindowContextMenus(BMenu *menu)
message = new BMessage(kIconMode);
message->AddInt32("scale", 0);
item = new BMenuItem("Decrease size", message, '-');
item = new BMenuItem(B_TRANSLATE("Decrease size"), message, '-');
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
message = new BMessage(kIconMode);
message->AddInt32("scale", 1);
item = new BMenuItem("Increase size", message, '+');
item = new BMenuItem(B_TRANSLATE("Increase size"), message, '+');
item->SetTarget(PoseView());
iconSizeMenu->AddItem(item);
@ -325,27 +330,31 @@ BDeskWindow::AddWindowContextMenus(BMenu *menu)
iconSizeMenu->Superitem()->SetTarget(PoseView());
iconSizeMenu->Superitem()->SetMarked(PoseView()->ViewMode() == kIconMode);
item = new BMenuItem("Mini icon view", new BMessage(kMiniIconMode), '2');
item = new BMenuItem(B_TRANSLATE("Mini icon view"),
new BMessage(kMiniIconMode), '2');
item->SetMarked(PoseView()->ViewMode() == kMiniIconMode);
menu->AddItem(item);
menu->AddSeparatorItem();
#ifdef CUT_COPY_PASTE_IN_CONTEXT_MENU
BMenuItem *pasteItem;
menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
BMenuItem* pasteItem = new BMenuItem(B_TRANSLATE("Paste"),
new BMessage(B_PASTE), 'V'));
menu->AddItem(pasteItem);
menu->AddSeparatorItem();
#endif
menu->AddItem(new BMenuItem("Clean up", new BMessage(kCleanup), 'K'));
menu->AddItem(new BMenuItem("Select"B_UTF8_ELLIPSIS,
menu->AddItem(new BMenuItem(B_TRANSLATE("Clean up"), new BMessage(kCleanup),
'K'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
menu->AddItem(new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select all"),
new BMessage(B_SELECT_ALL), 'A'));
menu->AddSeparatorItem();
menu->AddItem(new MountMenu("Mount"));
menu->AddItem(new MountMenu(B_TRANSLATE("Mount")));
menu->AddSeparatorItem();
menu->AddItem(new BMenu(kAddOnsMenuName));
menu->AddItem(new BMenu(B_TRANSLATE("Add-ons")));
// target items as needed
menu->SetTargetForItems(PoseView());

View File

@ -35,8 +35,10 @@ All rights reserved.
// ToDo:
// get rid of fMenuBar, SetMenuBar and related mess
#include <Catalog.h>
#include <Debug.h>
#include <Directory.h>
#include <Locale.h>
#include <MenuBar.h>
#include <Path.h>
#include <Volume.h>
@ -52,6 +54,9 @@ All rights reserved.
#include "Utilities.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
BDirMenu::BDirMenu(BMenuBar *bar, uint32 command, const char *entryName)
: BPopUpMenu("directories"),
fMenuBar(bar),
@ -249,7 +254,8 @@ BDirMenu::AddDisksIconToMenu(bool atEnd)
BMessage *message = new BMessage(fCommand);
message->AddRef(fEntryName.String(), model.EntryRef());
ModelMenuItem *item = new ModelMenuItem(&model, "Disks", message);
ModelMenuItem* item = new ModelMenuItem(&model, B_TRANSLATE("Disks"),
message);
if (atEnd)
AddItem(item);
else

View File

@ -35,11 +35,14 @@ All rights reserved.
#include "FSClipboard.h"
#include <Clipboard.h>
#include <Alert.h>
#include <Catalog.h>
#include <Locale.h>
#include <NodeMonitor.h>
#include "Commands.h"
#include "FSUtils.h"
#include "Tracker.h"
// prototypes
static void MakeNodeFromName(node_ref *node, char *name);
static inline void MakeRefName(char *refName, const node_ref *node);
@ -47,12 +50,6 @@ static inline void MakeModeName(char *modeName, const node_ref *node);
static inline void MakeModeNameFromRefName(char *modeName, char *refName);
static inline bool CompareModeAndRefName(const char *modeName, const char *refName);
//these are from PoseView.cpp
extern const char *kNoCopyToTrashStr;
extern const char *kNoCopyToRootStr;
extern const char *kOkToMoveStr;
/*
static bool
FSClipboardCheckIntegrity()
@ -111,6 +108,9 @@ CompareModeAndRefName(const char *modeName, const char *refName)
// #pragma mark -
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
bool
FSClipboardHasRefs()
{
@ -468,8 +468,10 @@ FSClipboardPaste(Model *model, uint32 linksMode)
// can't copy/paste to root('/') directory
if (model->IsRoot()) {
BAlert *alert = new BAlert("", kNoCopyToRootStr, "Cancel",
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("You must drop items on one of the disk icons "
"in the \"Disks\" window."), B_TRANSLATE("Cancel"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
okToMove = false;
@ -480,8 +482,10 @@ FSClipboardPaste(Model *model, uint32 linksMode)
// can't copy items into the trash
if (copyList->CountItems() > 0 && model->IsTrash()) {
BAlert *alert = new BAlert("", kNoCopyToTrashStr, "Cancel",
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("Sorry, you can't copy items to the Trash."),
B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
okToMove = false;

View File

@ -51,10 +51,12 @@ respective holders. All rights reserved.
#include <Alert.h>
#include <Application.h>
#include <Catalog.h>
#include <Debug.h>
#include <Directory.h>
#include <Entry.h>
#include <FindDirectory.h>
#include <Locale.h>
#include <NodeInfo.h>
#include <Path.h>
#include <Roster.h>
@ -99,6 +101,9 @@ enum ConflictCheckResult {
namespace BPrivate {
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
static status_t FSDeleteFolder(BEntry *, CopyLoopControl *, bool updateStatus,
bool deleteTopDir = true, bool upateFileNameInStatus = false);
static status_t MoveEntryToTrash(BEntry *, BPoint *, Undo &undo);
@ -137,40 +142,54 @@ status_t empty_trash(void *);
#endif
const char *kDeleteConfirmationStr = "Are you sure you want to delete the "
"selected item(s)? This operation cannot be reverted.";
static const char* kDeleteConfirmationStr =
B_TRANSLATE_MARK("Are you sure you want to delete the "
"selected item(s)? This operation cannot be reverted.");
const char *kReplaceStr = "You are trying to replace the item:\n"
"\t%s%s\n"
static const char* kReplaceStr =
B_TRANSLATE_MARK("You are trying to replace the item:\n"
"\t%name%dest\n"
"with:\n"
"\t%s%s\n\n"
"Would you like to replace it with the one you are %s?";
"\t%name%src\n\n"
"Would you like to replace it with the one you are %movemode?");
const char *kDirectoryReplaceStr = "An item named \"%s\" already exists in "
static const char* kDirectoryReplaceStr =
B_TRANSLATE_MARK("An item named \"%name\" already exists in "
"this folder, and may contain\nitems with the same names. Would you like "
"to replace them with those contained in the folder you are %s?";
"to replace them with those contained in the folder you are %verb?");
const char *kSymLinkReplaceStr = "An item named \"%s\" already exists in this "
static const char* kSymLinkReplaceStr =
B_TRANSLATE_MARK("An item named \"%name\" already exists in this "
"folder. Would you like to replace it with the symbolic link you are "
"creating?";
"creating?");
const char *kNoFreeSpace = "Sorry, there is not enough free space on the "
"destination volume to copy the selection.";
static const char* kNoFreeSpace =
B_TRANSLATE_MARK("Sorry, there is not enough free space on the "
"destination volume to copy the selection.");
const char *kFileErrorString = "Error copying file \"%s\":\n\t%s\n\nWould "
"you like to continue?";
const char *kFolderErrorString = "Error copying folder \"%s\":\n\t%s\n\nWould "
"you like to continue?";
const char *kFileDeleteErrorString = "There was an error deleting \"%s\""
":\n\t%s";
const char *kReplaceManyStr = "Some items already exist in this folder with "
"the same names as the items you are %s.\n \nWould you like to replace "
"them with the ones you are %s or be prompted for each one?";
static const char* kFileErrorString =
B_TRANSLATE_MARK("Error copying file \"%name\":\n\t%error\n\n"
"Would you like to continue?");
const char *kFindAlternativeStr = "Would you like to find some other suitable "
"application?";
const char *kFindApplicationStr = "Would you like to find a suitable "
"application to open the file?";
static const char* kFolderErrorString =
B_TRANSLATE_MARK("Error copying folder \"%name\":\n\t%error\n\n"
"Would you like to continue?");
static const char* kFileDeleteErrorString =
B_TRANSLATE_MARK("There was an error deleting \"%name\""
":\n\t%error");
static const char* kReplaceManyStr =
B_TRANSLATE_MARK("Some items already exist in this folder with "
"the same names as the items you are %verb.\n \nWould you like to replace "
"them with the ones you are %verb or be prompted for each one?");
static const char* kFindAlternativeStr =
B_TRANSLATE_MARK("Would you like to find some other suitable application?");
static const char *kFindApplicationStr =
B_TRANSLATE_MARK("Would you like to find a suitable application "
"to open the file?");
// Skip these attributes when copying in Tracker
const char *kSkipAttributes[] = {
@ -326,17 +345,18 @@ bool
TrackerCopyLoopControl::FileError(const char *message, const char *name,
status_t error, bool allowContinue)
{
char buffer[512];
sprintf(buffer, message, name, strerror(error));
BString buffer(message);
buffer.ReplaceFirst("%name", name);
buffer.ReplaceFirst("%error", strerror(error));
if (allowContinue) {
BAlert *alert = new BAlert("", buffer, "Cancel", "OK", 0,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("Cancel"),
B_TRANSLATE("OK"), 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetShortcut(0, B_ESCAPE);
return alert->Go() != 0;
}
BAlert *alert = new BAlert("", buffer, "Cancel", 0, 0,
BAlert* alert = new BAlert("", buffer.String(), B_TRANSLATE("Cancel"), 0, 0,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
@ -608,18 +628,20 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *action,
// quick way out
return true;
const char *warning = NULL;
BString warning;
bool requireOverride = true;
if (DirectoryMatchesOrContains(entry, B_BEOS_DIRECTORY)) {
warning = "If you %s the system folder or its contents, you "
warning.SetTo(
B_TRANSLATE("If you %action the system folder or its contents, you "
"won't be able to boot " OS_NAME "! Are you sure you want to do "
"this? To %s the system folder or its contents anyway, hold down "
"the Shift key and click \"Do it\".";
"this? To %action the system folder or its contents anyway, hold down "
"the Shift key and click \"Do it\"."));
} else if (DirectoryMatches(entry, B_USER_DIRECTORY)) {
warning = "If you %s the home folder, " OS_NAME " may not "
warning .SetTo(
B_TRANSLATE("If you %action the home folder, " OS_NAME " may not "
"behave properly! Are you sure you want to do this? "
"To %s the home anyway, click \"Do it\".";
"To %action the home anyway, click \"Do it\"."));
requireOverride = false;
} else if (DirectoryMatchesOrContains(entry, B_USER_CONFIG_DIRECTORY)
|| DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) {
@ -628,25 +650,28 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *action,
B_USER_SETTINGS_DIRECTORY)
|| DirectoryMatchesOrContains(entry, "beos_mime",
B_COMMON_SETTINGS_DIRECTORY)) {
warning = "If you %s the mime settings, " OS_NAME " may not "
"behave properly! Are you sure you want to do this? "
"To %s the mime settings anyway, click \"Do it\".";
warning.SetTo(
B_TRANSLATE("If you %action the mime settings, " OS_NAME
" may not behave properly! Are you sure you want to do this? "
"To %action the mime settings anyway, click \"Do it\"."));
requireOverride = false;
} else if (DirectoryMatches(entry, B_USER_CONFIG_DIRECTORY)) {
warning = "If you %s the config folder, " OS_NAME " may not "
"behave properly! Are you sure you want to do this? "
"To %s the config folder anyway, click \"Do it\".";
warning.SetTo(
B_TRANSLATE("If you %action the config folder, " OS_NAME
" may not behave properly! Are you sure you want to do this? "
"To %action the config folder anyway, click \"Do it\"."));
requireOverride = false;
} else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY)
|| DirectoryMatches(entry, B_COMMON_SETTINGS_DIRECTORY)) {
warning = "If you %s the settings folder, " OS_NAME " may not "
"behave properly! Are you sure you want to do this? "
"To %s the settings folder anyway, click \"Do it\".";
warning.SetTo(
B_TRANSLATE("If you %action the settings folder, " OS_NAME
" may not behave properly! Are you sure you want to do this? "
"To %action the settings folder anyway, click \"Do it\"."));
requireOverride = false;
}
}
if (!warning)
if (!warning.Length())
return true;
if (dontAsk)
@ -657,13 +682,11 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *action,
// we already warned about moving home this time around
return true;
char buffer[256];
sprintf(buffer, warning, action, action);
warning.ReplaceAll("%action", action);
if ((new OverrideAlert("", buffer, "Do it", (requireOverride
? B_SHIFT_KEY : 0),
"Cancel", 0, NULL, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go() == 1) {
if ((new OverrideAlert("", warning.String(), B_TRANSLATE("Do it"),
(requireOverride ? B_SHIFT_KEY : 0), B_TRANSLATE("Cancel"), 0, NULL,
0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go() == 1) {
if (confirmedAlready)
*confirmedAlready = kNotConfirmed;
return false;
@ -687,9 +710,9 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode,
int32 *collisionCount, ConflictCheckResult *preflightResult)
{
if (dstVol->IsReadOnly()) {
BAlert *alert = new BAlert("",
"You can't move or copy items to read-only volumes.",
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("You can't move or copy items to read-only volumes."),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return B_ERROR;
@ -702,21 +725,25 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode,
// the copy loops, except it takes forever to call CalcItemsAndSize
BEntry entry((entry_ref *)srcList->ItemAt(index));
if (IsDisksWindowIcon(&entry)) {
const char *errorStr;
if (moveMode == kCreateLink)
errorStr = "You cannot create a link to the root directory.";
else
errorStr = "You cannot copy or move the root directory.";
BString errorStr;
if (moveMode == kCreateLink) {
errorStr.SetTo(
B_TRANSLATE("You cannot create a link to the root "
"directory."));
} else {
errorStr.SetTo(
B_TRANSLATE("You cannot copy or move the root directory."));
}
BAlert *alert = new BAlert("", errorStr, "Cancel", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("", errorStr.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return B_ERROR;
}
if (moveMode == kMoveSelectionTo
&& !ConfirmChangeIfWellKnownDirectory(&entry, "move", false,
&askOnceOnly)) {
&& !ConfirmChangeIfWellKnownDirectory(&entry, B_TRANSLATE("move"),
false, &askOnceOnly)) {
return B_ERROR;
}
}
@ -753,7 +780,8 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode,
// check for free space before starting copy
if ((totalSize + (4 * kKBSize)) >= dstVol->FreeBytes()) {
BAlert *alert = new BAlert("", kNoFreeSpace, "Cancel",
BAlert* alert = new BAlert("",
B_TRANSLATE(kNoFreeSpace), B_TRANSLATE("Cancel"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
@ -923,10 +951,11 @@ MoveTask(BObjectList<entry_ref> *srcList, BEntry *destEntry, BList *pointList,
BEntry sourceEntry(srcRef);
if (sourceEntry.InitCheck() != B_OK) {
BString error;
error << "Error moving \"" << srcRef->name << "\".";
BAlert *alert = new BAlert("", error.String(), "Cancel", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BString error(B_TRANSLATE("Error moving \"%name\"."));
error.ReplaceFirst("%name", srcRef->name);
BAlert* alert = new BAlert("", error.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
break;
@ -939,11 +968,12 @@ MoveTask(BObjectList<entry_ref> *srcList, BEntry *destEntry, BList *pointList,
result = MoveEntryToTrash(&sourceEntry, loc, undo);
if (result != B_OK) {
BString error;
error << "Error moving \"" << srcRef->name
<< "\" to Trash. (" << strerror(result) << ")";
BAlert *alert = new BAlert("", error.String(), "Cancel",
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BString error(B_TRANSLATE("Error moving \"%name\" to Trash. (%error)"));
error.ReplaceFirst("%name", srcRef->name);
error.ReplaceFirst("%error", strerror(result));
BAlert* alert = new BAlert("", error.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
break;
@ -1054,7 +1084,8 @@ CopyFile(BEntry *srcFile, StatStruct *srcStat, BDirectory *destDir,
// check for free space first
if ((srcStat->st_size + kKBSize) >= volume.FreeBytes()) {
loopControl->FileError(kNoFreeSpace, "", B_DEVICE_FULL, false);
loopControl->FileError(B_TRANSLATE(kNoFreeSpace), "", B_DEVICE_FULL,
false);
throw (status_t)B_DEVICE_FULL;
}
@ -1066,7 +1097,9 @@ CopyFile(BEntry *srcFile, StatStruct *srcStat, BDirectory *destDir,
loopControl->UpdateStatus(destName, ref, 1024, true);
if (makeOriginalName) {
FSMakeOriginalName(destName, destDir, " copy");
BString suffix(" ");
suffix << B_TRANSLATE_COMMENT("copy", "filename copy"),
FSMakeOriginalName(destName, destDir, suffix.String());
undo.UpdateEntry(srcFile, destName);
}
@ -1098,8 +1131,8 @@ CopyFile(BEntry *srcFile, StatStruct *srcStat, BDirectory *destDir,
throw (status_t)err;
if (err != B_OK) {
if (!loopControl->FileError(kFileErrorString, destName, err,
true)) {
if (!loopControl->FileError(B_TRANSLATE(kFileErrorString), destName,
err, true)) {
throw (status_t)err;
} else {
// user selected continue in spite of error, update status bar
@ -1371,7 +1404,9 @@ CopyFolder(BEntry *srcEntry, BDirectory *destDir, CopyLoopControl *loopControl,
loopControl->UpdateStatus(ref.name, ref, 1024, true);
if (makeOriginalName) {
FSMakeOriginalName(destName, destDir, " copy");
BString suffix(" ");
suffix << B_TRANSLATE_COMMENT("copy", "filename copy"),
FSMakeOriginalName(destName, destDir, suffix.String());
undo.UpdateEntry(srcEntry, destName);
}
@ -1417,9 +1452,9 @@ CopyFolder(BEntry *srcEntry, BDirectory *destDir, CopyLoopControl *loopControl,
err = destDir->CreateDirectory(destName, &newDir);
}
#endif
if (err != B_OK) {
if (!loopControl->FileError(kFolderErrorString, destName, err,
true)) {
if (err != B_OK) {
if (!loopControl->FileError(B_TRANSLATE(kFolderErrorString),
destName, err, true)) {
throw err;
}
@ -1536,7 +1571,9 @@ MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode,
strcpy(name, ref.name);
BSymLink link;
FSMakeOriginalName(name, destDir, " link");
BString suffix(" ");
suffix << B_TRANSLATE_COMMENT("link", "filename link"),
FSMakeOriginalName(name, destDir, suffix.String());
undo.UpdateEntry(entry, name);
BPath path;
@ -1616,11 +1653,13 @@ MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode,
err = destDir->CreateSymLink(name, path.Path(), &link);
if (err == B_UNSUPPORTED) {
throw FailWithAlert(err, "The target disk does not support "
"creating links.", NULL);
throw FailWithAlert(err,
B_TRANSLATE("The target disk does not support "
"creating links."), NULL);
}
FailWithAlert::FailOnError(err, "Error creating link to \"%s\".",
FailWithAlert::FailOnError(err,
B_TRANSLATE("Error creating link to \"%name\"."),
ref.name);
if (loc && loc != (BPoint *)-1) {
@ -1659,19 +1698,19 @@ MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode,
// no alert, was already taken care of before
return error;
} catch (MoveError error) {
BString errorString;
errorString << "Error moving \"" << ref.name << '"';
(new BAlert("", errorString.String(), "OK", 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go();
BString errorString(B_TRANSLATE("Error moving \"%name\""));
errorString.ReplaceFirst("%name", ref.name);
(new BAlert("", errorString.String(), B_TRANSLATE("OK"), 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
return error.fError;
} catch (FailWithAlert error) {
char buffer[256];
BString buffer(error.fString);
if (error.fName)
sprintf(buffer, error.fString, error.fName);
buffer.ReplaceFirst("%name", error.fName);
else
strcpy(buffer, error.fString);
(new BAlert("", buffer, "OK", 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go();
buffer << error.fString;
(new BAlert("", buffer.String(), B_TRANSLATE("OK"), 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
return error.fError;
}
@ -1803,11 +1842,11 @@ MoveEntryToTrash(BEntry *entry, BPoint *loc, Undo &undo)
if (volume == boot) {
char name[B_FILE_NAME_LENGTH];
volume.GetName(name);
char buffer[256];
sprintf(buffer, "Cannot unmount the boot volume \"%s\".",
name);
BAlert *alert = new BAlert("", buffer, "Cancel", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BString buffer(B_TRANSLATE("Cannot unmount the boot volume \"%name\"."));
buffer.ReplaceFirst("%name", name);
BAlert* alert = new BAlert("", buffer.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
} else {
@ -1828,9 +1867,11 @@ MoveEntryToTrash(BEntry *entry, BPoint *loc, Undo &undo)
trash_dir.GetEntry(&trashEntry);
if (dir == trash_dir || dir.Contains(&trashEntry)) {
(new BAlert("", "You cannot put the Trash, home or Desktop "
"directory into the trash.", "OK", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
(new BAlert("",
B_TRANSLATE("You cannot put the Trash, home or Desktop "
"directory into the trash."),
B_TRANSLATE("OK"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
// return no error so we don't get two dialogs
return B_OK;
@ -1854,7 +1895,9 @@ MoveEntryToTrash(BEntry *entry, BPoint *loc, Undo &undo)
char name[B_FILE_NAME_LENGTH];
strcpy(name, ref.name);
if (trash_dir.Contains(name)) {
FSMakeOriginalName(name, &trash_dir, " copy");
BString suffix(" ");
suffix << B_TRANSLATE_COMMENT("copy", "filename copy"),
FSMakeOriginalName(name, &trash_dir, suffix.String());
undo.UpdateEntry(entry, name);
}
@ -1911,13 +1954,14 @@ PreFlightNameCheck(BObjectList<entry_ref> *srcList, const BDirectory *destDir,
// prompt user only if there is more than one collision, otherwise the
// single collision case will be handled as a "Prompt" case by CheckName
if (*collisionCount > 1) {
const char *verb = (moveMode == kMoveSelectionTo) ? "moving"
: "copying";
char replaceMsg[256];
sprintf(replaceMsg, kReplaceManyStr, verb, verb);
const char* verb = (moveMode == kMoveSelectionTo)
? B_TRANSLATE("moving") : B_TRANSLATE("copying");
BString replaceMsg(B_TRANSLATE(kReplaceManyStr));
replaceMsg.ReplaceAll("%verb", verb);
BAlert *alert = new BAlert("", replaceMsg,
"Cancel", "Prompt", "Replace all");
BAlert* alert = new BAlert("", replaceMsg.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Prompt"),
B_TRANSLATE("Replace all"));
alert->SetShortcut(0, B_ESCAPE);
switch (alert->Go()) {
case 0:
@ -1974,17 +2018,19 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry,
&& moveMode != kCreateRelativeLink
&& (srcDirectory == *destDir
|| srcDirectory.Contains(&destEntry))) {
(new BAlert("", "You can't move a folder into itself "
"or any of its own sub-folders.", "OK", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
(new BAlert("",
B_TRANSLATE("You can't move a folder into itself "
"or any of its own sub-folders."), B_TRANSLATE("OK"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
return B_ERROR;
}
}
if (FSIsTrashDir(sourceEntry) && moveMode != kCreateLink
&& moveMode != kCreateRelativeLink) {
(new BAlert("", "You can't move or copy the trash.",
"OK", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
(new BAlert("",
B_TRANSLATE("You can't move or copy the trash."),
B_TRANSLATE("OK"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
return B_ERROR;
}
@ -2007,9 +2053,11 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry,
if (destIsDir) {
BDirectory test_dir(&entry);
if (test_dir.Contains(sourceEntry)) {
(new BAlert("", "You can't replace a folder "
"with one of its sub-folders.", "OK", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
(new BAlert("",
B_TRANSLATE("You can't replace a folder "
"with one of its sub-folders."),
B_TRANSLATE("OK"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
return B_ERROR;
}
}
@ -2019,25 +2067,30 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry,
&& moveMode != kCreateRelativeLink
&& destIsDir != sourceIsDirectory) {
(new BAlert("", sourceIsDirectory
? "You cannot replace a file with a folder or a symbolic "
"link."
: "You cannot replace a folder or a symbolic link with a "
"file.", "OK", 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go();
? B_TRANSLATE("You cannot replace a file with a folder or a "
"symbolic link.")
: B_TRANSLATE("You cannot replace a folder or a symbolic link "
"with a file."), B_TRANSLATE("OK"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go();
return B_ERROR;
}
if (replaceAll != kReplaceAll) {
// prompt user to determine whether to replace or not
char replaceMsg[512];
BString replaceMsg;
if (moveMode == kCreateLink || moveMode == kCreateRelativeLink)
sprintf(replaceMsg, kSymLinkReplaceStr, name);
else if (sourceEntry->IsDirectory())
sprintf(replaceMsg, kDirectoryReplaceStr, name,
moveMode == kMoveSelectionTo ? "moving" : "copying");
else {
if (moveMode == kCreateLink || moveMode == kCreateRelativeLink) {
replaceMsg.SetTo(B_TRANSLATE(kSymLinkReplaceStr));
replaceMsg.ReplaceFirst("%name", name);
} else if (sourceEntry->IsDirectory()) {
replaceMsg.SetTo(B_TRANSLATE(kDirectoryReplaceStr));
replaceMsg.ReplaceFirst("%name", name);
replaceMsg.ReplaceFirst("%verb",
moveMode == kMoveSelectionTo
? B_TRANSLATE("moving")
: B_TRANSLATE("copying"));
} else {
char sourceBuffer[96], destBuffer[96];
StatStruct statBuffer;
@ -2052,17 +2105,24 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry,
else
destBuffer[0] = '\0';
sprintf(replaceMsg, kReplaceStr, name, destBuffer, name,
sourceBuffer, moveMode == kMoveSelectionTo ? "moving"
: "copying");
replaceMsg.SetTo(B_TRANSLATE(kReplaceStr));
replaceMsg.ReplaceAll("%name", name);
replaceMsg.ReplaceFirst("%dest", destBuffer);
replaceMsg.ReplaceFirst("%src", sourceBuffer);
replaceMsg.ReplaceFirst("%movemode",
moveMode == kMoveSelectionTo
? B_TRANSLATE("moving")
: B_TRANSLATE("copying"));
}
// special case single collision (don't need Replace All shortcut)
BAlert *alert;
if (multipleCollisions || sourceIsDirectory)
alert = new BAlert("", replaceMsg, "Skip", "Replace all");
else {
alert = new BAlert("", replaceMsg, "Cancel", "Replace");
if (multipleCollisions || sourceIsDirectory) {
alert = new BAlert("", replaceMsg.String(),
B_TRANSLATE("Skip"), B_TRANSLATE("Replace all"));
} else {
alert = new BAlert("", replaceMsg.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Replace"));
alert->SetShortcut(0, B_ESCAPE);
}
switch (alert->Go()) {
@ -2086,11 +2146,10 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry,
return B_OK;
if (err != B_OK) {
BString error;
error << "There was a problem trying to replace \""
<< name << "\". The item might be open or busy.";
BAlert *alert = new BAlert("", error.String(), "Cancel", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BString error(B_TRANSLATE("There was a problem trying to replace \"%name\". The item might be open or busy."));
error.ReplaceFirst("%name", name);;
BAlert* alert = new BAlert("", error.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
}
@ -2136,8 +2195,8 @@ FSDeleteFolder(BEntry *dir_entry, CopyLoopControl *loopControl,
else if (err == B_OK)
dir.Rewind();
else {
loopControl->FileError(kFileDeleteErrorString, ref.name, err,
false);
loopControl->FileError(B_TRANSLATE(kFileDeleteErrorString),
ref.name, err, false);
}
}
@ -2705,8 +2764,9 @@ empty_trash(void *)
}
if (err != B_OK && err != kTrashCanceled && err != kUserCanceled) {
(new BAlert("", "Error emptying Trash!", "OK", NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
(new BAlert("", B_TRANSLATE("Error emptying Trash!"),
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go();
}
return B_OK;
@ -2720,9 +2780,10 @@ _DeleteTask(BObjectList<entry_ref> *list, bool confirm)
bool dontMoveToTrash = TrackerSettings().DontMoveFilesToTrash();
if (!dontMoveToTrash) {
BAlert *alert = new BAlert("", kDeleteConfirmationStr,
"Cancel", "Move to Trash", "Delete", B_WIDTH_AS_USUAL,
B_OFFSET_SPACING, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE(kDeleteConfirmationStr), B_TRANSLATE("Cancel"),
B_TRANSLATE("Move to Trash"), B_TRANSLATE("Delete"),
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'm');
@ -2737,9 +2798,10 @@ _DeleteTask(BObjectList<entry_ref> *list, bool confirm)
return B_OK;
}
} else {
BAlert *alert = new BAlert("", kDeleteConfirmationStr,
"Cancel", "Delete", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE(kDeleteConfirmationStr), B_TRANSLATE("Cancel"),
B_TRANSLATE("Delete"), NULL, B_WIDTH_AS_USUAL,
B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd');
@ -2774,8 +2836,9 @@ _DeleteTask(BObjectList<entry_ref> *list, bool confirm)
}
if (err != kTrashCanceled && err != kUserCanceled && err != B_OK)
(new BAlert("", "Error deleting items", "OK", NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
(new BAlert("", B_TRANSLATE("Error deleting items"),
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go();
}
delete list;
@ -2930,17 +2993,20 @@ FSCreateNewFolderIn(const node_ref *dirNode, entry_ref *newRef,
status_t result = dir.InitCheck();
if (result == B_OK) {
char name[B_FILE_NAME_LENGTH];
strcpy(name, "New folder");
strcpy(name, B_TRANSLATE("New folder"));
int32 fnum = 1;
while (dir.Contains(name)) {
// if base name already exists then add a number
// ToDo:
// move this logic ot FSMakeOriginalName
if (++fnum > 9)
sprintf(name, "New folder%ld", fnum);
else
sprintf(name, "New folder %ld", fnum);
if (++fnum > 9) {
snprintf(name, sizeof(name), B_TRANSLATE("New folder%ld"),
fnum);
} else {
snprintf(name, sizeof(name), B_TRANSLATE("New folder %ld"),
fnum);
}
}
BDirectory newDir;
@ -2960,8 +3026,9 @@ FSCreateNewFolderIn(const node_ref *dirNode, entry_ref *newRef,
}
}
BAlert *alert = new BAlert("", "Sorry, could not create a new folder.",
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("Sorry, could not create a new folder."),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return result;
@ -3120,18 +3187,20 @@ _TrackerLaunchAppWithDocuments(const entry_ref *appRef, const BMessage *refs,
if (nodeToClose)
dynamic_cast<TTracker *>(be_app)->CloseParent(*nodeToClose);
} else {
alertString << "Could not open \"" << appRef->name << "\" ("
<< strerror(error) << "). ";
alertString.SetTo(B_TRANSLATE("Could not open \"%name\" (%error). "));
alertString.ReplaceFirst("%name", appRef->name);
alertString.ReplaceFirst("%error", strerror(error));
if (refs && openWithOK && error != B_SHUTTING_DOWN) {
alertString << kFindAlternativeStr;
BAlert *alert = new BAlert("", alertString.String(),
"Cancel", "Find", 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alertString << B_TRANSLATE(kFindAlternativeStr);
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Find"), 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 1)
error = TrackerOpenWith(refs);
} else {
BAlert *alert = new BAlert("", alertString.String(),
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
}
@ -3274,10 +3343,12 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs,
}
if (error != B_OK) {
alertString << "Could not find an application to open \""
<< documentRef.name << "\" (" << strerror(error) << "). ";
alertString.SetTo(B_TRANSLATE("Could not find an application to "
"open \"%name\" (%error). "));
alertString.ReplaceFirst("%name", documentRef.name);
alertString.ReplaceFirst("%error", strerror(error));
if (openWithOK)
alternative = kFindApplicationStr;
alternative = B_TRANSLATE(kFindApplicationStr);
break;
} else {
@ -3325,16 +3396,17 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs,
}
if (error == B_LAUNCH_FAILED_EXECUTABLE && !refsToPass) {
alertString << "Could not open \"" << app.name
<< "\". The file is mistakenly marked as executable. ";
alertString.SetTo(B_TRANSLATE("Could not open \"%name\". "
"The file is mistakenly marked as executable. "));
alertString.ReplaceFirst("%name", app.name);
if (!openWithOK) {
// offer the possibility to change the permissions
alertString << "\nShould this be fixed?";
BAlert *alert = new BAlert("", alertString.String(),
"Cancel", "Proceed", 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alertString << B_TRANSLATE("\nShould this be fixed?");
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Proceed"), 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 1) {
BEntry entry(&documentRef);
@ -3350,44 +3422,66 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs,
_TrackerLaunchDocuments(NULL, refs, false);
return;
} else {
alertString = "Could not update permissions of "
"file \"";
alertString << app.name << "\". " << strerror(error);
alertString.SetTo(B_TRANSLATE("Could not update "
"permissions of file \"%name\". %error"));
alertString.ReplaceFirst("%name", app.name);
alertString.ReplaceFirst("%error", strerror(error));
}
} else
return;
}
alternative = kFindApplicationStr;
alternative = B_TRANSLATE(kFindApplicationStr);
} else if (error == B_LAUNCH_FAILED_APP_IN_TRASH) {
alertString << "Could not open \"" << documentRef.name
<< "\" because application \"" << app.name << "\" is in the "
"Trash. ";
alternative = kFindAlternativeStr;
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"because application \"%app\" is in the Trash. "));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%app", app.name);
alternative = B_TRANSLATE(kFindAlternativeStr);
} else if (error == B_LAUNCH_FAILED_APP_NOT_FOUND) {
alertString << "Could not open \"" << documentRef.name << "\" "
<< "(" << strerror(error) << "). ";
alternative = kFindAlternativeStr;
alertString.SetTo(
B_TRANSLATE("Could not open \"%name\" (%error). "));
alertString.ReplaceFirst("%name", documentRef.name);
alertString.ReplaceFirst("%error", strerror(error));
alternative = B_TRANSLATE(kFindAlternativeStr);
} else if (error == B_MISSING_SYMBOL
&& LoaderErrorDetails(&app, loaderErrorString) == B_OK) {
alertString << "Could not open \"" << documentRef.name << "\" ";
if (openedDocuments)
alertString << "with application \"" << app.name << "\" ";
alertString << "(Missing symbol: " << loaderErrorString << "). \n";
alternative = kFindAlternativeStr;
if (openedDocuments) {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"with application \"%app\" (Missing symbol: %symbol). \n"));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%app", app.name);
alertString.ReplaceFirst("%symbol", loaderErrorString.String());
} else {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"(Missing symbol: %symbol). \n"));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%symbol", loaderErrorString.String());
}
alternative = B_TRANSLATE(kFindAlternativeStr);
} else if (error == B_MISSING_LIBRARY
&& LoaderErrorDetails(&app, loaderErrorString) == B_OK) {
alertString << "Could not open \"" << documentRef.name << "\" ";
if (openedDocuments)
alertString << "with application \"" << app.name << "\" ";
alertString << "(Missing libraries: " << loaderErrorString
<< "). \n";
alternative = kFindAlternativeStr;
if (openedDocuments) {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"with application \"%app\" (Missing libraries: %library). "
"\n"));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%app", app.name);
alertString.ReplaceFirst("%library", loaderErrorString.String());
} else {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"(Missing libraries: %library). \n"));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%library", loaderErrorString.String());
}
alternative = B_TRANSLATE(kFindAlternativeStr);
} else {
alertString << "Could not open \"" << documentRef.name
<< "\" with application \"" << app.name << "\" ("
<< strerror(error) << "). ";
alternative = kFindAlternativeStr;
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" with "
"application \"%app\" (%error). "));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%app", app.name);
alertString.ReplaceFirst("%error", strerror(error));
alternative = B_TRANSLATE(kFindAlternativeStr);
}
}
@ -3395,15 +3489,15 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs,
if (openWithOK) {
ASSERT(alternative);
alertString << alternative;
BAlert *alert = new BAlert("", alertString.String(),
"Cancel", "Find", 0, B_WIDTH_AS_USUAL,
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Find"), 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 1)
error = TrackerOpenWith(refs);
} else {
BAlert *alert = new BAlert("", alertString.String(),
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
}

View File

@ -37,8 +37,10 @@ All rights reserved.
#include <compat/sys/stat.h>
#include <Application.h>
#include <Catalog.h>
#include <FindDirectory.h>
#include <FilePanel.h>
#include <Locale.h>
#include <Message.h>
#include <Path.h>
#include <Query.h>
@ -56,6 +58,10 @@ All rights reserved.
#include "Utilities.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
FavoritesMenu::FavoritesMenu(const char *title, BMessage *openFolderMessage,
BMessage *openFileMessage, const BMessenger &target,
bool isSavePanel, BRefFilter *filter)
@ -166,7 +172,7 @@ FavoritesMenu::AddNextItem()
if (!fAddedSeparatorForSection) {
fAddedSeparatorForSection = true;
AddItem(new TitledSeparatorItem("Favorites"));
AddItem(new TitledSeparatorItem(B_TRANSLATE("Favorites")));
}
fUniqueRefCheck.push_back(*model.EntryRef());
AddItem(item);
@ -211,7 +217,8 @@ FavoritesMenu::AddNextItem()
if (item) {
if (!fAddedSeparatorForSection) {
fAddedSeparatorForSection = true;
AddItem(new TitledSeparatorItem("Recent documents"));
AddItem(new TitledSeparatorItem(
B_TRANSLATE("Recent documents")));
}
AddItem(item);
fSectionItemCount++;
@ -253,13 +260,14 @@ FavoritesMenu::AddNextItem()
if (!ShouldShowModel(&model))
return true;
BMenuItem *item = BNavMenu::NewModelItem(&model, fOpenFolderMessage,
fTarget, true);
if (item) {
if (!fAddedSeparatorForSection) {
fAddedSeparatorForSection = true;
AddItem(new TitledSeparatorItem("Recent folders"));
AddItem(new TitledSeparatorItem(
B_TRANSLATE("Recent folders")));
}
AddItem(item);
item->SetEnabled(true);
@ -436,7 +444,7 @@ RecentsMenu::DoneBuildingItemList()
//
if (CountItems() <= 0) {
BMenuItem *item = new BMenuItem("<No recent items>", 0);
BMenuItem* item = new BMenuItem(B_TRANSLATE("<No recent items>"), 0);
item->SetEnabled(false);
AddItem(item);
} else

View File

@ -53,9 +53,11 @@ All rights reserved.
#include <Alert.h>
#include <Application.h>
#include <Button.h>
#include <Catalog.h>
#include <Debug.h>
#include <Directory.h>
#include <FindDirectory.h>
#include <Locale.h>
#include <MenuBar.h>
#include <MenuField.h>
#include <MenuItem.h>
@ -133,6 +135,9 @@ key_down_filter(BMessage *message, BHandler **, BMessageFilter *filter)
// #pragma mark -
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
const BEntry *startDir, uint32 nodeFlavors, bool multipleSelection,
BMessage *message, BRefFilter *filter, uint32 containerWindowFlags,
@ -441,8 +446,8 @@ TFilePanel::SetRefFilter(BRefFilter *filter)
fPoseView->SetRefFilter(filter);
fPoseView->CommitActivePose();
fPoseView->Refresh();
FavoritesMenu *menu = dynamic_cast<FavoritesMenu *>(
fMenuBar->FindItem("Favorites")->Submenu());
FavoritesMenu* menu = dynamic_cast<FavoritesMenu *>
(fMenuBar->FindItem(B_TRANSLATE("Favorites"))->Submenu());
if (menu)
menu->SetRefFilter(filter);
}
@ -498,7 +503,7 @@ TFilePanel::AdjustButton()
BTextControl *textControl = dynamic_cast<BTextControl *>(FindView("text view"));
BObjectList<BPose> *selectionList = fPoseView->SelectionList();
const char *buttonText = fButtonText.String();
BString buttonText = fButtonText;
bool enabled = false;
if (fIsSavePanel && textControl) {
@ -509,7 +514,7 @@ TFilePanel::AdjustButton()
Model *model = selectionList->FirstItem()->TargetModel();
if (model->ResolveIfLink()->IsDirectory()) {
enabled = true;
buttonText = "Open";
buttonText = B_TRANSLATE("Open");
} else {
// insert the name of the selected model into the text field
textControl->SetText(model->Name());
@ -546,7 +551,7 @@ TFilePanel::AdjustButton()
}
}
button->SetLabel(buttonText);
button->SetLabel(buttonText.String());
button->SetEnabled(enabled);
}
@ -597,24 +602,25 @@ TFilePanel::Init(const BMessage *)
AddMenus();
AddContextMenus();
FavoritesMenu *favorites = new FavoritesMenu("Favorites",
FavoritesMenu* favorites = new FavoritesMenu(B_TRANSLATE("Favorites"),
new BMessage(kSwitchDirectory), new BMessage(B_REFS_RECEIVED),
BMessenger(this), IsSavePanel(), fPoseView->RefFilter());
favorites->AddItem(new BMenuItem("Add current folder",
favorites->AddItem(new BMenuItem(B_TRANSLATE("Add current folder"),
new BMessage(kAddCurrentDir)));
favorites->AddItem(new BMenuItem("Edit favorites"B_UTF8_ELLIPSIS,
favorites->AddItem(new BMenuItem(
B_TRANSLATE("Edit favorites"B_UTF8_ELLIPSIS),
new BMessage(kEditFavorites)));
fMenuBar->AddItem(favorites);
// configure menus
BMenuItem *item = fMenuBar->FindItem("Window");
BMenuItem* item = fMenuBar->FindItem(B_TRANSLATE("Window"));
if (item) {
fMenuBar->RemoveItem(item);
delete item;
}
item = fMenuBar->FindItem("File");
item = fMenuBar->FindItem(B_TRANSLATE("File"));
if (item) {
BMenu *menu = item->Submenu();
if (menu) {
@ -627,7 +633,7 @@ TFilePanel::Init(const BMessage *)
delete item;
// remove add-ons menu, identifier menu, separator
item = menu->FindItem(kAddOnsMenuName);
item = menu->FindItem(B_TRANSLATE("Add-ons"));
if (item) {
int32 index = menu->IndexOf(item);
delete menu->RemoveItem(index);
@ -683,7 +689,8 @@ TFilePanel::Init(const BMessage *)
rect.right = rect.left + 170;
rect.bottom = rect.top + 13;
fTextControl = new BTextControl(rect, "text view", "save text", "", NULL,
fTextControl = new BTextControl(rect, "text view",
B_TRANSLATE("save text"), "", NULL,
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
DisallowMetaKeys(fTextControl->TextView());
DisallowFilenameKeys(fTextControl->TextView());
@ -691,9 +698,9 @@ TFilePanel::Init(const BMessage *)
fTextControl->SetDivider(0.0f);
fTextControl->TextView()->SetMaxBytes(B_FILE_NAME_LENGTH - 1);
fButtonText = "Save";
fButtonText.SetTo(B_TRANSLATE("Save"));
} else
fButtonText = "Open";
fButtonText.SetTo(B_TRANSLATE("Open"));
rect = windRect;
rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10);
@ -741,11 +748,12 @@ TFilePanel::Init(const BMessage *)
fBackView->AddChild(default_button);
rect.right = rect.left -= 10;
float cancel_width = be_plain_font->StringWidth("Cancel") + 20;
float cancel_width = be_plain_font->StringWidth(B_TRANSLATE("Cancel")) + 20;
rect.left = (cancel_width > 75) ? (rect.right - cancel_width) : (rect.right - 75);
BButton *cancel_button = new BButton(rect, "cancel button", "Cancel",
new BMessage(kCancelButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
BButton* cancel_button = new BButton(rect, "cancel button",
B_TRANSLATE("Cancel"), new BMessage(kCancelButton),
B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
fBackView->AddChild(cancel_button);
if (!fIsSavePanel)
@ -847,14 +855,19 @@ TFilePanel::RestoreWindowState(const BMessage &message)
void
TFilePanel::AddFileContextMenus(BMenu *menu)
{
menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() ?
"Delete" : "Move to Trash",
new BMessage(kMoveToTrash), 'T'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
? B_TRANSLATE("Delete")
: B_TRANSLATE("Move to Trash"),
new BMessage(kMoveToTrash), 'T'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
menu->AddItem(new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"),
new BMessage(B_CUT), 'X'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Copy"),
new BMessage(B_COPY), 'C'));
// menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
menu->SetTargetForItems(PoseView());
@ -864,12 +877,16 @@ TFilePanel::AddFileContextMenus(BMenu *menu)
void
TFilePanel::AddVolumeContextMenus(BMenu *menu)
{
menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
menu->AddItem(new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"), new BMessage(B_CUT), 'X'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Copy"),
new BMessage(B_COPY), 'C'));
// menu->AddItem(pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
menu->SetTargetForItems(PoseView());
@ -879,30 +896,34 @@ TFilePanel::AddVolumeContextMenus(BMenu *menu)
void
TFilePanel::AddWindowContextMenus(BMenu *menu)
{
BMenuItem *item = new BMenuItem("New folder", new BMessage(kNewFolder), 'N');
BMenuItem* item = new BMenuItem(B_TRANSLATE("New folder"),
new BMessage(kNewFolder), 'N');
item->SetTarget(PoseView());
menu->AddItem(item);
menu->AddSeparatorItem();
item = new BMenuItem("Paste", new BMessage(B_PASTE), 'V');
item = new BMenuItem(B_TRANSLATE("Paste"), new BMessage(B_PASTE), 'V');
item->SetTarget(PoseView());
menu->AddItem(item);
menu->AddSeparatorItem();
item = new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow),
'A', B_SHIFT_KEY);
item = new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A');
item = new BMenuItem(B_TRANSLATE("Select all"),
new BMessage(B_SELECT_ALL), 'A');
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Invert selection", new BMessage(kInvertSelection), 'S');
item = new BMenuItem(B_TRANSLATE("Invert selection"),
new BMessage(kInvertSelection), 'S');
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Go to parent", new BMessage(kOpenParentDir), B_UP_ARROW);
item = new BMenuItem(B_TRANSLATE("Go to parent"),
new BMessage(kOpenParentDir), B_UP_ARROW);
item->SetTarget(this);
menu->AddItem(item);
}
@ -1051,8 +1072,9 @@ TFilePanel::MessageReceived(BMessage *message)
// Don't allow saves of multiple files
if (count > 1) {
ShowCenteredAlert("Sorry, saving more than one item is not allowed.",
"Cancel");
ShowCenteredAlert(
B_TRANSLATE("Sorry, saving more than one item is not allowed."),
B_TRANSLATE("Cancel"));
} else {
// if we are a savepanel, set up the filepanel correctly
// then pass control so we follow the same path as if the user
@ -1341,40 +1363,48 @@ TFilePanel::HandleSaveButton()
BDirectory dir;
if (TargetModel()->IsRoot()) {
ShowCenteredAlert("Sorry, you can't save things at the root of "
"your system.", "Cancel");
ShowCenteredAlert(
B_TRANSLATE("Sorry, you can't save things at the root of "
"your system."),
B_TRANSLATE("Cancel"));
return;
}
// check for some illegal file names
if (strcmp(fTextControl->Text(), ".") == 0
|| strcmp(fTextControl->Text(), "..") == 0) {
ShowCenteredAlert("The specified name is illegal. Please choose "
"another name.", "Cancel");
ShowCenteredAlert(
B_TRANSLATE("The specified name is illegal. Please choose "
"another name."),
B_TRANSLATE("Cancel"));
fTextControl->TextView()->SelectAll();
return;
}
if (dir.SetTo(TargetModel()->EntryRef()) != B_OK) {
ShowCenteredAlert("There was a problem trying to save in the folder "
"you specified. Please try another one.", "Cancel");
ShowCenteredAlert(
B_TRANSLATE("There was a problem trying to save in the folder "
"you specified. Please try another one."),
B_TRANSLATE("Cancel"));
return;
}
if (dir.Contains(fTextControl->Text())) {
if (dir.Contains(fTextControl->Text(), B_DIRECTORY_NODE)) {
ShowCenteredAlert("The specified name is already used as the name "
"of a folder. Please choose another name.", "Cancel");
ShowCenteredAlert(
B_TRANSLATE("The specified name is already used as the name "
"of a folder. Please choose another name."),
B_TRANSLATE("Cancel"));
fTextControl->TextView()->SelectAll();
return;
} else {
// if this was invoked by a dbl click, it is an explicit replacement
// of the file.
BString str;
str << "The file \"" << fTextControl->Text() << "\" already exists in the "
"specified folder. Do you want to replace it?";
BString str(B_TRANSLATE("The file \"%name\" already exists in the specified folder. Do you want to replace it?"));
str.ReplaceFirst("%name", fTextControl->Text());
if (ShowCenteredAlert(str.String(), "Cancel", "Replace") == 0) {
if (ShowCenteredAlert(str.String(), B_TRANSLATE("Cancel"),
B_TRANSLATE("Replace")) == 0) {
// user canceled
fTextControl->TextView()->SelectAll();
return;

View File

@ -38,6 +38,8 @@ All rights reserved.
#include <stdlib.h>
#include <Beep.h>
#include <Catalog.h>
#include <Locale.h>
const uint32 kPermissionsChanged = 'prch';
@ -45,6 +47,9 @@ const uint32 kNewOwnerEntered = 'nwow';
const uint32 kNewGroupEntered = 'nwgr';
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
FilePermissionsView::FilePermissionsView(BRect rect, Model *model)
: BView(rect, "FilePermissionsView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW),
fModel(model)
@ -63,15 +68,17 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model *model)
strView->SetFontSize(kAttribFontHeight);
strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
+ kColumnLabelSpacing, kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2
+ kColumnLabelSpacing, kColumnLabelBottom), "", "Group");
+ kColumnLabelSpacing, kColumnLabelTop,
kColumnLabelMiddle + kColumnLabelWidth / 2 + kColumnLabelSpacing,
kColumnLabelBottom), "", B_TRANSLATE("Group"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
+ 2 * kColumnLabelSpacing, kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2
+ 2 * kColumnLabelSpacing, kColumnLabelBottom), "", "Other");
+ 2 * kColumnLabelSpacing, kColumnLabelTop,
kColumnLabelMiddle + kColumnLabelWidth / 2 + 2 * kColumnLabelSpacing,
kColumnLabelBottom), "", B_TRANSLATE("Other"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
@ -82,21 +89,24 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model *model)
- kColumnLabelWidth / 2 - 5, kRowLabelHeight = 14;
strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop, kRowLabelRight,
kRowLabelTop + kRowLabelHeight), "", "Read");
kRowLabelTop + kRowLabelHeight),
"", B_TRANSLATE("Read"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_RIGHT);
strView->SetFontSize(kAttribFontHeight);
strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop
+ kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop
+ kRowLabelVerticalSpacing + kRowLabelHeight), "", "Write");
+ kRowLabelVerticalSpacing + kRowLabelHeight),
"", B_TRANSLATE("Write"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_RIGHT);
strView->SetFontSize(kAttribFontHeight);
strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop
+ 2 * kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop
+ 2 * kRowLabelVerticalSpacing + kRowLabelHeight), "", "Execute");
+ 2 * kRowLabelVerticalSpacing + kRowLabelHeight),
"", B_TRANSLATE("Execute"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_RIGHT);
strView->SetFontSize(kAttribFontHeight);
@ -126,8 +136,9 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model *model)
const float kTextControlLeft = 170, kTextControlRight = 270,
kTextControlTop = kColumnLabelTop, kTextControlHeight = 14, kTextControlSpacing = 16;
strView = new BStringView(BRect(kTextControlLeft, kTextControlTop, kTextControlRight,
kTextControlTop + kTextControlHeight), "", "Owner");
strView = new BStringView(BRect(kTextControlLeft, kTextControlTop,
kTextControlRight, kTextControlTop + kTextControlHeight), "",
B_TRANSLATE("Owner"));
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
AddChild(strView);
@ -138,9 +149,11 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model *model)
fOwnerTextControl->SetDivider(0);
AddChild(fOwnerTextControl);
strView = new BStringView(BRect(kTextControlLeft, kTextControlTop + 5
+ 2 * kTextControlSpacing, kTextControlRight, kTextControlTop + 2
+ 2 * kTextControlSpacing + kTextControlHeight), "", "Group");
strView = new BStringView(BRect(kTextControlLeft,
kTextControlTop + 5 + 2 * kTextControlSpacing,
kTextControlRight,
kTextControlTop + 2 + 2 * kTextControlSpacing + kTextControlHeight),
"", B_TRANSLATE("Group"));
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
AddChild(strView);

View File

@ -35,12 +35,14 @@ All rights reserved.
#include <Application.h>
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <CheckBox.h>
#include <Debug.h>
#include <Directory.h>
#include <FindDirectory.h>
#include <File.h>
#include <FilePanel.h>
#include <Locale.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Mime.h>
@ -73,6 +75,10 @@ All rights reserved.
#include "Tracker.h"
#include "Utilities.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
const char *kAllMimeTypes = "mime/ALLTYPES";
const BRect kInitialRect(100, 100, 530, 210);
@ -85,8 +91,12 @@ const uint32 kNameModifiedMessage = 'nmmd';
const uint32 kSwitchToQueryTemplate = 'swqt';
const uint32 kRunSaveAsTemplatePanel = 'svtm';
const char *kDragNDropTypes [] = { B_QUERY_MIMETYPE, B_QUERY_TEMPLATE_MIMETYPE };
const char *kDragNDropActionSpecifiers [] = { "Create a Query", "Create a Query template" };
const char* kDragNDropTypes [] = {
B_QUERY_MIMETYPE,
B_QUERY_TEMPLATE_MIMETYPE };
static const char *kDragNDropActionSpecifiers [] = {
B_TRANSLATE_MARK("Create a Query"),
B_TRANSLATE_MARK("Create a Query template") };
const uint32 kAttachFile = 'attf';
@ -162,12 +172,14 @@ MoreOptionsStruct::QueryTemporary(const BNode *node)
// #pragma mark -
FindWindow::FindWindow(const entry_ref *newRef, bool editIfTemplateOnly)
: BWindow(kInitialRect, "Find", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
fFile(TryOpening(newRef)),
fFromTemplate(false),
fEditTemplateOnly(false),
fSaveAsTemplatePanel(NULL)
FindWindow::FindWindow(const entry_ref* newRef, bool editIfTemplateOnly)
:
BWindow(kInitialRect, B_TRANSLATE("Find"), B_TITLED_WINDOW, B_NOT_RESIZABLE
| B_NOT_ZOOMABLE),
fFile(TryOpening(newRef)),
fFromTemplate(false),
fEditTemplateOnly(false),
fSaveAsTemplatePanel(NULL)
{
if (fFile) {
fRef = *newRef;
@ -176,7 +188,7 @@ FindWindow::FindWindow(const entry_ref *newRef, bool editIfTemplateOnly)
if (BNodeInfo(fFile).GetType(type) == B_OK
&& strcasecmp(type, B_QUERY_TEMPLATE_MIMETYPE) == 0) {
fEditTemplateOnly = true;
SetTitle("Edit Query template");
SetTitle(B_TRANSLATE("Edit Query template"));
}
}
} else {
@ -625,8 +637,10 @@ FindWindow::MessageReceived(BMessage *message)
else {
BMessenger panel(BackgroundView());
fSaveAsTemplatePanel = new BFilePanel(B_SAVE_PANEL, &panel);
fSaveAsTemplatePanel->SetSaveText("Query template");
fSaveAsTemplatePanel->Window()->SetTitle("Save as Query template:");
fSaveAsTemplatePanel->SetSaveText(
B_TRANSLATE("Query template"));
fSaveAsTemplatePanel->Window()->SetTitle(
B_TRANSLATE("Save as Query template:"));
fSaveAsTemplatePanel->Show();
}
break;
@ -666,7 +680,7 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
BMessenger self(this);
fRecentQueries = new BPopUpMenu("RecentQueries");
FindPanel::AddRecentQueries(fRecentQueries, true, &self, kSwitchToQueryTemplate);
FindPanel::AddRecentQueries(fRecentQueries, true, &self, kSwitchToQueryTemplate);
AddChild(new MiniMenuField(rect, "RecentQueries", fRecentQueries));
@ -680,14 +694,17 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
rect.right = rect.left + 150;
fMimeTypeField = new BMenuField(rect, "MimeTypeMenu", "", fMimeTypeMenu);
fMimeTypeField->SetDivider(0.0f);
fMimeTypeField->MenuItem()->SetLabel("All files and folders");
fMimeTypeField->MenuItem()->SetLabel(B_TRANSLATE("All files and folders"));
AddChild(fMimeTypeField);
// add popup for search criteria
fSearchModeMenu = new BPopUpMenu("searchMode");
fSearchModeMenu->AddItem(new BMenuItem("by name", new BMessage(kByNameItem)));
fSearchModeMenu->AddItem(new BMenuItem("by attribute", new BMessage(kByAttributeItem)));
fSearchModeMenu->AddItem(new BMenuItem("by formula", new BMessage(kByFormulaItem)));
fSearchModeMenu->AddItem(new BMenuItem(B_TRANSLATE("by name"),
new BMessage(kByNameItem)));
fSearchModeMenu->AddItem(new BMenuItem(B_TRANSLATE("by attribute"),
new BMessage(kByAttributeItem)));
fSearchModeMenu->AddItem(new BMenuItem(B_TRANSLATE("by formula"),
new BMessage(kByFormulaItem)));
fSearchModeMenu->ItemAt(initialMode == kByNameItem ? 0 :
(initialMode == kByAttributeItem ? 1 : 2))->SetMarked(true);
@ -703,7 +720,7 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
rect.right = bounds.right - 15;
rect.left = rect.right - 100;
fVolMenu = new BPopUpMenu("", false, false); // don't radioMode
menuField = new BMenuField(rect, "", "On", fVolMenu);
menuField = new BMenuField(rect, "", B_TRANSLATE("On"), fVolMenu);
menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 8);
AddChild(menuField);
AddVolumes(fVolMenu);
@ -715,8 +732,10 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
dragNDropMessage.AddString("be:types", B_FILE_MIME_TYPE);
dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[0]);
dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[1]);
dragNDropMessage.AddString("be:actionspecifier", kDragNDropActionSpecifiers[0]);
dragNDropMessage.AddString("be:actionspecifier", kDragNDropActionSpecifiers[1]);
dragNDropMessage.AddString("be:actionspecifier",
B_TRANSLATE(kDragNDropActionSpecifiers[0]));
dragNDropMessage.AddString("be:actionspecifier",
B_TRANSLATE(kDragNDropActionSpecifiers[1]));
BMessenger self(this);
fDraggableIcon = new DraggableQueryIcon(DraggableIcon::PreferredRect(draggableIconOrigin,
@ -747,7 +766,8 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
rect = expandedBounds;
rect.right = rect.left + 200;
rect.bottom = rect.top + 20;;
fQueryName = new BTextControl(rect, "queryName", "Query name:", "", 0);
fQueryName = new BTextControl(rect, "queryName", B_TRANSLATE("Query name:"),
"", 0);
fQueryName->SetDivider(fQueryName->StringWidth(fQueryName->Label()) + 5);
fMoreOptionsPane->AddItem(fQueryName, 1);
FillCurrentQueryName(fQueryName, parent);
@ -755,12 +775,14 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
rect.top = rect.bottom + 6;
rect.bottom = rect.top + 16;
rect.right = rect.left + 100;
fSearchTrashCheck = new BCheckBox(rect, "searchTrash", "Include trash", 0);
fSearchTrashCheck = new BCheckBox(rect, "searchTrash",
B_TRANSLATE("Include trash"), 0);
fSearchTrashCheck->ResizeToPreferred();
fMoreOptionsPane->AddItem(fSearchTrashCheck, 1);
rect.OffsetBy(fSearchTrashCheck->Bounds().Width() + 8, 0);
fTemporaryCheck = new BCheckBox(rect, "temporary", "Temporary", 0);
fTemporaryCheck = new BCheckBox(rect, "temporary",
B_TRANSLATE("Temporary"), 0);
fMoreOptionsPane->AddItem(fTemporaryCheck, 1);
fTemporaryCheck->SetValue(1);
@ -788,13 +810,13 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
rect.right = rect.left + 60;
rect.bottom = rect.top + 20;
BButton *button;
if (editTemplateOnly)
button = new BButton(rect, "save", "Save",
if (editTemplateOnly) {
button = new BButton(rect, "save", B_TRANSLATE("Save"),
new BMessage(kSaveButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
else
button = new BButton(rect, "find", "Search",
} else {
button = new BButton(rect, "find", B_TRANSLATE("Search"),
new BMessage(kFindButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
}
AddChild(button);
button->MakeDefault(true);
}
@ -956,7 +978,7 @@ FindPanel::ShowVolumeMenuLabel()
} else if (countSelected > 1)
// if more than two disks selected, don't use the disk name
// as a label
PopUpMenuSetTitle(fVolMenu, "multiple disks");
PopUpMenuSetTitle(fVolMenu, B_TRANSLATE("multiple disks"));
else {
ASSERT(tmpItem);
PopUpMenuSetTitle(fVolMenu, tmpItem->Label());
@ -1109,14 +1131,17 @@ FindPanel::MessageReceived(BMessage *message)
bool queryTemplate = false;
if (actionSpecifier
&& strcasecmp(actionSpecifier, kDragNDropActionSpecifiers[0]) == 0)
&& strcasecmp(actionSpecifier,
B_TRANSLATE(kDragNDropActionSpecifiers[0])) == 0) {
query = true;
else if (actionSpecifier
&& strcasecmp(actionSpecifier, kDragNDropActionSpecifiers[1]) == 0)
} else if (actionSpecifier
&& strcasecmp(actionSpecifier,
B_TRANSLATE(kDragNDropActionSpecifiers[1])) == 0) {
queryTemplate = true;
else if (mimeType && strcasecmp(mimeType, kDragNDropTypes[0]) == 0)
} else if (mimeType && strcasecmp(mimeType,
kDragNDropTypes[0]) == 0) {
query = true;
else if (mimeType && strcasecmp(mimeType, kDragNDropTypes[1]) == 0)
} else if (mimeType && strcasecmp(mimeType, kDragNDropTypes[1]) == 0)
queryTemplate = true;
if (query || queryTemplate)
@ -1320,11 +1345,15 @@ FindPanel::GetDefaultName(BString &result) const
BTextControl *textControl = dynamic_cast<BTextControl *>(FindView("TextControl"));
switch (Mode()) {
case kByNameItem:
result << "Name = " << textControl->TextView()->Text();
result.SetTo(B_TRANSLATE_COMMENT("Name = %name",
"FindResultTitle"));
result.ReplaceFirst("%name", textControl->TextView()->Text());
break;
case kByFormulaItem:
result << "Formula " << textControl->TextView()->Text();
result.SetTo(B_TRANSLATE_COMMENT("Formula %formula",
"FindResultTitle"));
result.ReplaceFirst("%formula", textControl->TextView()->Text());
break;
case kByAttributeItem:
@ -1593,7 +1622,8 @@ FindPanel::AddMimeTypesToMenu()
{
BMessage *itemMessage = new BMessage(kMIMETypeItem);
itemMessage->AddString("mimetype", kAllMimeTypes);
MimeTypeMenu()->AddItem(new BMenuItem("All files and folders", itemMessage));
MimeTypeMenu()->AddItem(new BMenuItem(B_TRANSLATE("All files and folders"),
itemMessage));
MimeTypeMenu()->AddSeparatorItem();
MimeTypeMenu()->ItemAt(0)->SetMarked(true);
@ -1673,9 +1703,9 @@ FindPanel::AddVolumes(BMenu *menu)
BMessage *message = new BMessage(kVolumeItem);
message->AddInt32("device", -1);
menu->AddItem(new BMenuItem("All disks", message));
menu->AddItem(new BMenuItem(B_TRANSLATE("All disks"), message));
menu->AddSeparatorItem();
PopUpMenuSetTitle(menu, "All disks");
PopUpMenuSetTitle(menu, B_TRANSLATE("All disks"));
BVolumeRoster roster;
BVolume volume;
@ -1813,7 +1843,8 @@ FindPanel::AddRecentQueries(BMenu *menu, bool addSaveAsItem, const BMessenger *t
menu->AddSeparatorItem();
BMessage *message = new BMessage(kRunSaveAsTemplatePanel);
BMenuItem *item = new BMenuItem("Save Query as template"B_UTF8_ELLIPSIS, message);
BMenuItem* item = new BMenuItem(
B_TRANSLATE("Save Query as template"B_UTF8_ELLIPSIS), message);
menu->AddItem(item);
}
}
@ -1840,17 +1871,19 @@ FindPanel::SetUpAddRemoveButtons(BBox *box)
BRect rect = box->Bounds();
rect.InsetBy(5, 10);
rect.top = rect.bottom - 20;
rect.right = rect.left + 22 + be_plain_font->StringWidth("Add");
rect.right = rect.left + 22
+ be_plain_font->StringWidth(B_TRANSLATE("Add"));
button = new BButton(rect, "add", "Add", new BMessage(kAddItem),
B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
button = new BButton(rect, "add", B_TRANSLATE("Add"),
new BMessage(kAddItem), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
button->SetTarget(this);
box->AddChild(button);
rect.OffsetBy(rect.Width() + 6, 0);
rect.right = rect.left + 22 + be_plain_font->StringWidth("Remove");
button = new BButton(rect, "remove", "Remove", new BMessage(kRemoveItem),
B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
rect.right = rect.left + 22
+ be_plain_font->StringWidth(B_TRANSLATE("Remove"));
button = new BButton(rect, "remove", B_TRANSLATE("Remove"),
new BMessage(kRemoveItem), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
button->SetEnabled(false);
button->SetTarget(this);
@ -2333,7 +2366,7 @@ TAttrView::TAttrView(BRect frame, int32 index)
BPopUpMenu *menu = new BPopUpMenu("PopUp");
// add NAME attribute to popup
BMenu *submenu = new BMenu("Name");
BMenu* submenu = new BMenu(B_TRANSLATE("Name"));
submenu->SetRadioMode(true);
submenu->SetFont(be_plain_font);
BMessage *message = new BMessage(kAttributeItemMain);
@ -2342,13 +2375,24 @@ TAttrView::TAttrView(BRect frame, int32 index)
BMenuItem *item = new BMenuItem(submenu, message);
menu->AddItem(item);
const int32 operators[] = {B_CONTAINS, B_EQ, B_NE, B_BEGINS_WITH, B_ENDS_WITH};
const char *operatorLabels[] = {"contains", "is", "is not", "starts with", "ends with"};
const int32 operators[] = {
B_CONTAINS,
B_EQ,
B_NE,
B_BEGINS_WITH,
B_ENDS_WITH};
static const char *operatorLabels[] = {
B_TRANSLATE_MARK("contains"),
B_TRANSLATE_MARK("is"),
B_TRANSLATE_MARK("is not"),
B_TRANSLATE_MARK("starts with"),
B_TRANSLATE_MARK("ends with")};
for (int32 i = 0;i < 5;i++) {
for (int32 i = 0; i < 5; i++) {
message = new BMessage(kAttributeItem);
message->AddInt32("operator", operators[i]);
submenu->AddItem(new BMenuItem(operatorLabels[i], message));
submenu->AddItem(new BMenuItem(B_TRANSLATE(operatorLabels[i]),
message));
}
// mark first item
@ -2356,7 +2400,7 @@ TAttrView::TAttrView(BRect frame, int32 index)
submenu->ItemAt(0)->SetMarked(true);
// add SIZE attribute
submenu = new BMenu("Size");
submenu = new BMenu(B_TRANSLATE("Size"));
submenu->SetRadioMode(true);
submenu->SetFont(be_plain_font);
message = new BMessage(kAttributeItemMain);
@ -2367,18 +2411,18 @@ TAttrView::TAttrView(BRect frame, int32 index)
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_GE);
submenu->AddItem(new BMenuItem("greater than", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("greater than"), message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_LE);
submenu->AddItem(new BMenuItem("less than", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("less than"), message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_EQ);
submenu->AddItem(new BMenuItem("is", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("is"), message));
// add "modified" field
submenu = new BMenu("Modified");
submenu = new BMenu(B_TRANSLATE("Modified"));
submenu->SetRadioMode(true);
submenu->SetFont(be_plain_font);
message = new BMessage(kAttributeItemMain);
@ -2389,11 +2433,11 @@ TAttrView::TAttrView(BRect frame, int32 index)
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_LE);
submenu->AddItem(new BMenuItem("before", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("before"), message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_GE);
submenu->AddItem(new BMenuItem("after", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("after"), message));
BRect bounds(Bounds());
bounds.right = bounds.left + 100;
@ -2518,14 +2562,14 @@ TAttrView::AddLogicMenu(bool selectAnd)
BPopUpMenu *menu = new BPopUpMenu("");
BMessage *message = new BMessage();
message->AddInt32("combine", B_AND);
BMenuItem *item = new BMenuItem("And", message);
BMenuItem* item = new BMenuItem(B_TRANSLATE("And"), message);
menu->AddItem(item);
if (selectAnd)
item->SetMarked(true);
message = new BMessage();
message->AddInt32("combine", B_OR);
item = new BMenuItem("Or", message);
item = new BMenuItem(B_TRANSLATE("Or"), message);
menu->AddItem(item);
if (!selectAnd)
item->SetMarked(true);
@ -2654,25 +2698,28 @@ TAttrView::AddAttributes(BMenu *menu, const BMimeType &mimeType)
case B_STRING_TYPE:
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_CONTAINS);
submenu->AddItem(new BMenuItem("contains", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("contains"),
message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_EQ);
submenu->AddItem(new BMenuItem("is", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("is"), message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_NE);
submenu->AddItem(new BMenuItem("is not", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("is not"), message));
submenu->SetTargetForItems(this);
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_BEGINS_WITH);
submenu->AddItem(new BMenuItem("starts with", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("starts with"),
message));
submenu->SetTargetForItems(this);
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_ENDS_WITH);
submenu->AddItem(new BMenuItem("ends with", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("ends with"),
message));
break;
case B_BOOL_TYPE:
@ -2689,25 +2736,27 @@ TAttrView::AddAttributes(BMenu *menu, const BMimeType &mimeType)
case B_DOUBLE_TYPE:
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_EQ);
submenu->AddItem(new BMenuItem("is", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("is"), message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_GE);
submenu->AddItem(new BMenuItem("greater than", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("greater than"),
message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_LE);
submenu->AddItem(new BMenuItem("less than", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("less than"),
message));
break;
case B_TIME_TYPE:
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_LE);
submenu->AddItem(new BMenuItem("before", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("before"), message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_GE);
submenu->AddItem(new BMenuItem("after", message));
submenu->AddItem(new BMenuItem(B_TRANSLATE("after"), message));
break;
}
submenu->SetTargetForItems(this);
@ -2990,7 +3039,8 @@ DraggableQueryIcon::DragStarted(BMessage *dragMessage)
ASSERT(window);
dragMessage->AddString("be:clip_name",
window->BackgroundView()->UserSpecifiedName() ?
window->BackgroundView()->UserSpecifiedName() : "New Query");
window->BackgroundView()->UserSpecifiedName()
: B_TRANSLATE("New Query"));
return true;
}

View File

@ -40,10 +40,12 @@ All rights reserved.
#include <stdlib.h>
#include <Alert.h>
#include <Catalog.h>
#include <Debug.h>
#include <Directory.h>
#include <File.h>
#include <Font.h>
#include <Locale.h>
#include <MenuField.h>
#include <Mime.h>
#include <NodeInfo.h>
@ -69,10 +71,15 @@ All rights reserved.
#include "Model.h"
#include "NavMenu.h"
#include "PoseView.h"
#include "StringForSize.h"
#include "Tracker.h"
#include "WidgetAttributeText.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
namespace BPrivate {
// States for tracking the mouse
@ -214,16 +221,6 @@ const uint32 kPaneSwitchClosed = 0;
const uint32 kPaneSwitchOpen = 2;
static BString &
PrintFloat(BString &result, float number)
{
char buffer[128];
sprintf(buffer, "%.1f", number);
result += buffer;
return result;
}
static void
OpenParentAndSelectOriginal(const entry_ref *ref)
{
@ -389,7 +386,7 @@ BInfoWindow::Show()
if (!TargetModel()->IsVolume() && !TargetModel()->IsRoot()) {
if (TargetModel()->IsDirectory()) {
// if this is a folder then spawn thread to calculate size
SetSizeStr("calculating" B_UTF8_ELLIPSIS);
SetSizeStr(B_TRANSLATE("calculating" B_UTF8_ELLIPSIS));
fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize",
B_NORMAL_PRIORITY, this);
resume_thread(fCalcThreadID);
@ -402,8 +399,8 @@ BInfoWindow::Show()
}
}
BString buffer;
buffer << TargetModel()->Name() << " info";
BString buffer(B_TRANSLATE_COMMENT("%name info", "InfoWindow Title"));
buffer.ReplaceFirst("%name", TargetModel()->Name());
SetTitle(buffer.String());
lock.Unlock();
@ -461,7 +458,7 @@ BInfoWindow::MessageReceived(BMessage *message)
// Start recalculating..
fStopCalc = false;
SetSizeStr("calculating" B_UTF8_ELLIPSIS);
SetSizeStr(B_TRANSLATE("calculating" B_UTF8_ELLIPSIS));
fCalcThreadID = spawn_thread(BInfoWindow::CalcSize, "CalcSize",
B_NORMAL_PRIORITY, this);
resume_thread(fCalcThreadID);
@ -652,47 +649,45 @@ BInfoWindow::MessageReceived(BMessage *message)
void
BInfoWindow::GetSizeString(BString &result, off_t size, int32 fileCount)
{
char numStr[256];
sprintf(numStr, "%Ld", size);
BString bytes;
char sizeBuffer[128];
result << string_for_size((double)size, sizeBuffer, sizeof(sizeBuffer));
uint32 length = strlen(numStr);
if (length >= 4) {
uint32 charsTillComma = length % 3;
if (charsTillComma == 0)
charsTillComma = 3;
uint32 numberIndex = 0;
while (numStr[numberIndex]) {
bytes += numStr[numberIndex++];
if (--charsTillComma == 0 && numStr[numberIndex]) {
bytes += ',';
// when we show the byte size, format it with a thousands delimiter (comma)
// TODO: use BCountry::FormatNumber
if (size >= kKBSize) {
char numStr[128];
snprintf(numStr, sizeof(numStr), "%Ld", size);
BString bytes;
uint32 length = strlen(numStr);
if (length >= 4) {
uint32 charsTillComma = length % 3;
if (charsTillComma == 0)
charsTillComma = 3;
uint32 numberIndex = 0;
while (numStr[numberIndex]) {
bytes += numStr[numberIndex++];
if (--charsTillComma == 0 && numStr[numberIndex]) {
bytes += ',';
charsTillComma = 3;
}
}
}
} else
bytes = numStr;
result << " " << B_TRANSLATE("(%bytes bytes)");
// "bytes" translation could come from string_for_size
// which could be part of the localekit itself
result.ReplaceFirst("%bytes", bytes);
}
if (size >= kGBSize)
PrintFloat(result, (float)size / kGBSize) << " GiB";
else if (size >= kMBSize)
PrintFloat(result, (float)size / kMBSize) << " MiB";
else if (size >= kKBSize)
result << (int64)(size + kHalfKBSize) / kKBSize << "KiB";
else
result << size;
if (size >= kKBSize)
result << " (" << bytes;
result << " bytes";
if (size >= kKBSize)
result << ")";
if (fileCount)
result << " for " << fileCount << " files";
if (fileCount != 0) {
result << " " << B_TRANSLATE("for %num files");
BString countString;
countString << fileCount;
result.ReplaceFirst("%num", countString);
}
}
@ -711,7 +706,7 @@ BInfoWindow::CalcSize(void *castToWindow)
if (!lock)
return B_ERROR;
window->SetSizeStr("Error calculating folder size.");
window->SetSizeStr(B_TRANSLATE("Error calculating folder size."));
return B_ERROR;
}
@ -799,10 +794,10 @@ BInfoWindow::OpenFilePanel(const entry_ref *ref)
false, &message);
if (fFilePanel != NULL) {
fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON,"Select");
fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Select"));
fFilePanel->Window()->ResizeTo(500, 300);
BString title;
title << "Link \"" << fModel->Name() << "\" to:";
BString title(B_TRANSLATE_COMMENT("Link \"%name\" to:", "File dialog title for new sym link"));
title.ReplaceFirst("%name", fModel->Name());
fFilePanel->Window()->SetTitle(title.String());
fFilePanel->Show();
fFilePanelOpen = true;
@ -880,7 +875,8 @@ AttributeView::AttributeView(BRect rect, Model *model)
// Find offset for attributes, might be overiden below if there
// is a prefered handle menu displayed
currentFont.SetSize(kAttribFontHeight);
fDivider = currentFont.StringWidth("Modified:") + kBorderMargin + kBorderWidth + 1;
fDivider = currentFont.StringWidth(B_TRANSLATE("Modified:"))
+ kBorderMargin + kBorderWidth + 1;
// Add a preferred handler pop-up menu if this item
// is a file...This goes in place of the Link To:
// string...
@ -897,12 +893,12 @@ AttributeView::AttributeView(BRect rect, Model *model)
fTitleRect.bottom + (lineHeight * 7),
Bounds().Width() - 5, fTitleRect.bottom + (lineHeight * 8));
fPreferredAppMenu = new BMenuField(preferredAppRect, "", "", new BPopUpMenu(""));
fDivider = currentFont.StringWidth("Opens with:") + 5;
fDivider = currentFont.StringWidth(B_TRANSLATE("Opens with:")) + 5;
fPreferredAppMenu->SetDivider(fDivider);
fDivider += (preferredAppRect.left - 2);
fPreferredAppMenu->SetFont(&currentFont);
fPreferredAppMenu->SetHighColor(kAttrTitleColor);
fPreferredAppMenu->SetLabel("Opens with:");
fPreferredAppMenu->SetLabel(B_TRANSLATE("Opens with:"));
char prefSignature[B_MIME_TYPE_LENGTH];
nodeInfo.GetPreferredApp(prefSignature);
@ -912,7 +908,8 @@ AttributeView::AttributeView(BRect rect, Model *model)
// Add the default menu item and set it to marked
BMenuItem *result;
result = new BMenuItem("Default application", new BMessage(kSetPreferredApp));
result = new BMenuItem(B_TRANSLATE("Default application"),
new BMessage(kSetPreferredApp));
result->SetTarget(this);
fPreferredAppMenu->Menu()->AddItem(result);
result->SetMarked(true);
@ -952,7 +949,7 @@ AttributeView::AttributeView(BRect rect, Model *model)
fPermissionsSwitch = new PaneSwitch(BRect(), "Permissions");
fPermissionsSwitch->SetMessage(new BMessage(kPermissionsSelected));
fPermissionsSwitch->SetLabels(NULL, "Permissions");
fPermissionsSwitch->SetLabels(NULL, B_TRANSLATE("Permissions"));
AddChild(fPermissionsSwitch);
fPermissionsSwitch->ResizeToPreferred();
fPermissionsSwitch->MoveTo(kBorderWidth + 3,
@ -1547,17 +1544,22 @@ AttributeView::CheckAndSetSize()
return;
fFreeBytes = freeBytes;
char buffer[500];
if (capacity >= kGBSize)
sprintf(buffer, "%.1f G", (float)capacity / kGBSize);
else
sprintf(buffer, "%.1f M", (float)capacity / kMBSize);
sprintf(buffer + strlen(buffer), "B (%.1f MB used -- %.1f MB free)",
(float)(capacity - fFreeBytes) / kMBSize,
(float)fFreeBytes / kMBSize);
char capacityStr[16], usedStr[16], freeStr[16];
sprintf(usedStr, "%.1f", (float)(capacity - fFreeBytes) / kMBSize);
sprintf(freeStr, "%.1f", (float)fFreeBytes / kMBSize);
if (capacity >= kGBSize) {
fSizeStr.SetTo(B_TRANSLATE("%capacity GB (%used MB used -- %free MB free)"));
sprintf(capacityStr, "%.1f", (float)capacity / kGBSize);
} else {
fSizeStr.SetTo(B_TRANSLATE("%capacity MB (%used MB used -- %free MB free)"));
sprintf(capacityStr, "%.1f", (float)capacity / kMBSize);
}
fSizeStr.ReplaceFirst("%capacity", capacityStr);
fSizeStr.ReplaceFirst("%used", usedStr);
fSizeStr.ReplaceFirst("%free", freeStr);
fSizeStr = buffer;
} else if (fModel->IsFile()) {
// poll for size changes because they do not get node monitored
// until a file gets closed (with the old BFS)
@ -1687,14 +1689,16 @@ AttributeView::Draw(BRect)
// Capacity/size
SetHighColor(kAttrTitleColor);
if (fModel->IsVolume() || fModel->IsRoot()) {
MovePenTo(BPoint(fDivider - (StringWidth("Capacity:")), lineBase));
DrawString("Capacity:");
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Capacity:"))),
lineBase));
DrawString(B_TRANSLATE("Capacity:"));
} else {
MovePenTo(BPoint(fDivider - (StringWidth("Size:")), lineBase));
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Size:"))),
lineBase));
fSizeRect.left = fDivider + 2;
fSizeRect.top = lineBase - fontMetrics.ascent;
fSizeRect.bottom = lineBase + fontMetrics.descent;
DrawString("Size:");
DrawString(B_TRANSLATE("Size:"));
}
MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
@ -1714,27 +1718,29 @@ AttributeView::Draw(BRect)
// Created
SetHighColor(kAttrTitleColor);
MovePenTo(BPoint(fDivider - (StringWidth("Created:")), lineBase));
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Created:"))),
lineBase));
SetHighColor(kAttrTitleColor);
DrawString("Created:");
DrawString(B_TRANSLATE("Created:"));
MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
SetHighColor(kAttrValueColor);
DrawString(fCreatedStr.String());
lineBase += lineHeight;
// Modified
MovePenTo(BPoint(fDivider - (StringWidth("Modified:")), lineBase));
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Modified:"))),
lineBase));
SetHighColor(kAttrTitleColor);
DrawString("Modified:");
DrawString(B_TRANSLATE("Modified:"));
MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
SetHighColor(kAttrValueColor);
DrawString(fModifiedStr.String());
lineBase += lineHeight;
// Kind
MovePenTo(BPoint(fDivider - (StringWidth("Kind:")), lineBase));
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Kind:"))), lineBase));
SetHighColor(kAttrTitleColor);
DrawString("Kind:");
DrawString(B_TRANSLATE("Kind:"));
MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
SetHighColor(kAttrValueColor);
DrawString(fKindStr.String());
@ -1744,9 +1750,10 @@ AttributeView::Draw(BRect)
GetFont(&normalFont);
// Path
MovePenTo(BPoint(fDivider - (StringWidth("Location:")), lineBase));
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Location:"))),
lineBase));
SetHighColor(kAttrTitleColor);
DrawString("Location:");
DrawString(B_TRANSLATE("Location:"));
MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
SetHighColor(kLinkColor);
@ -1770,9 +1777,10 @@ AttributeView::Draw(BRect)
// Link to/version
if (fModel->IsSymLink()) {
MovePenTo(BPoint(fDivider - (StringWidth("Link to:")), lineBase));
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Link to:"))),
lineBase));
SetHighColor(kAttrTitleColor);
DrawString("Link To:");
DrawString(B_TRANSLATE("Link To:"));
MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
SetHighColor(kLinkColor);
@ -1795,9 +1803,10 @@ AttributeView::Draw(BRect)
fDescRect = BRect(-1, -1, -1, -1);
} else if (fModel->IsExecutable()) {
//Version
MovePenTo(BPoint(fDivider - (StringWidth("Version:")), lineBase));
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Version:"))),
lineBase));
SetHighColor(kAttrTitleColor);
DrawString("Version:");
DrawString(B_TRANSLATE("Version:"));
MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
SetHighColor(kAttrValueColor);
BString nameString;
@ -1808,9 +1817,10 @@ AttributeView::Draw(BRect)
lineBase += lineHeight;
// Description
MovePenTo(BPoint(fDivider - (StringWidth("Description:")), lineBase));
MovePenTo(BPoint(fDivider - (StringWidth(B_TRANSLATE("Description:"))),
lineBase));
SetHighColor(kAttrTitleColor);
DrawString("Description:");
DrawString(B_TRANSLATE("Description:"));
MovePenTo(BPoint(fDivider + kDrawMargin, lineBase));
SetHighColor(kAttrValueColor);
// Check for truncation
@ -1893,9 +1903,11 @@ AttributeView::FinishEditingTitle(bool commit)
if (entry.InitCheck() == B_OK
&& entry.GetParent(&parent) == B_OK) {
if (parent.Contains(text)) {
(new BAlert("", "That name is already taken. "
"Please type another one.", "OK", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
(new BAlert("",
B_TRANSLATE("That name is already taken. "
"Please type another one."),
B_TRANSLATE("OK"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
reopen = true;
} else {
if (fModel->IsVolume()) {
@ -1914,9 +1926,11 @@ AttributeView::FinishEditingTitle(bool commit)
}
}
} else if (length >= B_FILE_NAME_LENGTH) {
(new BAlert("", "That name is too long. "
"Please type another one.", "OK", 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
(new BAlert("",
B_TRANSLATE("That name is too long. "
"Please type another one."),
B_TRANSLATE("OK"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
reopen = true;
}
@ -2020,14 +2034,17 @@ AttributeView::BuildContextMenu(BMenu *parent)
navigationItem->SetTarget(be_app);
}
parent->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
parent->AddItem(new BMenuItem(B_TRANSLATE("Open"),
new BMessage(kOpenSelection), 'O'));
if (!model.IsTrash()) {
parent->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
parent->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
parent->AddSeparatorItem();
if (fModel->IsVolume()) {
BMenuItem *item;
parent->AddItem(item = new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U'));
BMenuItem* item = new BMenuItem(B_TRANSLATE("Unmount"),
new BMessage(kUnmountVolume), 'U');
parent->AddItem(item);
// volume model, enable/disable the Unmount item
BVolume boot;
BVolumeRoster().GetBootVolume(&boot);
@ -2035,24 +2052,29 @@ AttributeView::BuildContextMenu(BMenu *parent)
volume.SetTo(fModel->NodeRef()->device);
if (volume == boot)
item->SetEnabled(false);
} else
parent->AddItem(new BMenuItem("Identify", new BMessage(kIdentifyEntry)));
} else
parent->AddItem(new BMenuItem("Empty Trash", new BMessage(kEmptyTrash)));
} else {
parent->AddItem(new BMenuItem(B_TRANSLATE("Identify"),
new BMessage(kIdentifyEntry)));
}
} else {
parent->AddItem(new BMenuItem(B_TRANSLATE("Empty Trash"),
new BMessage(kEmptyTrash)));
}
BMenuItem *sizeItem = NULL;
if (model.IsDirectory() && !model.IsVolume() && !model.IsRoot()) {
parent->AddItem(sizeItem = new BMenuItem("Recalculate folder size",
parent->AddItem(sizeItem = new BMenuItem(B_TRANSLATE("Recalculate folder size"),
new BMessage(kRecalculateSize)));
}
if (model.IsSymLink()) {
parent->AddItem(sizeItem = new BMenuItem("Set new link target",
parent->AddItem(sizeItem = new BMenuItem(B_TRANSLATE("Set new link target"),
new BMessage(kSetLinkTarget)));
}
parent->AddItem(new BSeparatorItem());
parent->AddItem(new BMenuItem("Permissions", new BMessage(kPermissionsSelected), 'P'));
parent->AddItem(new BMenuItem(B_TRANSLATE("Permissions"),
new BMessage(kPermissionsSelected), 'P'));
parent->SetFont(be_plain_font);
parent->SetTargetForItems(this);

View File

@ -7,7 +7,7 @@ UsePrivateHeaders interface mount shared storage tracker ;
UseLibraryHeaders icon ;
AddResources libtracker.so : TrackerIcons.rdef ;
AddResources libtracker.so : TrackerIcons.rdef libtracker.rdef ;
SubDirC++Flags
-D_BUILDING_tracker=1 -DOPEN_TRACKER=1
@ -91,10 +91,45 @@ SharedLibrary libtracker.so :
VolumeWindow.cpp
WidgetAttributeText.cpp
: be translation $(vector_icon_libs) $(TARGET_LIBSTDC++) libshared.a
: be translation $(vector_icon_libs) $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS) libshared.a
;
DoCatalogs libtracker.so :
x-vnd.Haiku-libtracker
:
Tracker.cpp
AutoMounterSettings.cpp
ContainerWindow.cpp
CountView.cpp
DeskWindow.cpp
DirMenu.cpp
FavoritesMenu.cpp
FilePanelPriv.cpp
FilePermissionsView.cpp
FindPanel.cpp
FSClipboard.cpp
FSUtils.cpp
InfoWindow.cpp
Model.cpp
MountMenu.cpp
NavMenu.cpp
OpenWithWindow.cpp
PoseView.cpp
QueryContainerWindow.cpp
QueryPoseView.cpp
SelectionWindow.cpp
SettingsViews.cpp
SlowContextPopup.cpp
StatusWindow.cpp
TemplatesMenu.cpp
Tracker.cpp
TrackerInitialState.cpp
TrackerSettingsWindow.cpp
VolumeWindow.cpp
WidgetAttributeText.cpp
;
if $(TARGET_PLATFORM) = libbe_test {
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_LIB_DIR) : libtracker.so
: tests!apps ;

View File

@ -46,10 +46,12 @@ All rights reserved.
#include <AppDefs.h>
#include <Bitmap.h>
#include <Catalog.h>
#include <Debug.h>
#include <Directory.h>
#include <Entry.h>
#include <File.h>
#include <Locale.h>
#include <NodeInfo.h>
#include <NodeMonitor.h>
#include <Path.h>
@ -83,6 +85,9 @@ bool CheckNodeIconHintPrivate(const BNode *, bool);
}
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
Model::Model()
:
fPreferredAppName(NULL),
@ -328,20 +333,23 @@ Model::CompareFolderNamesFirst(const Model *compareModel) const
const char *
Model::Name() const
{
static const char* kRootNodeName = B_TRANSLATE_MARK("Disks");
static const char* kTrashNodeName = B_TRANSLATE_MARK("Trash");
static const char* kDesktopNodeName = B_TRANSLATE_MARK("Desktop");
switch (fBaseType) {
case kRootNode:
return "Disks";
return B_TRANSLATE(kRootNodeName);
case kVolumeNode:
if (fVolumeName)
return fVolumeName;
break;
case kTrashNode:
return "Trash";
return B_TRANSLATE(kTrashNodeName);
case kDesktopNode:
return "Desktop";
return B_TRANSLATE(kDesktopNodeName);
default:
break;

View File

@ -34,7 +34,9 @@ All rights reserved.
// MountMenu implements a context menu used for mounting/unmounting volumes
#include <Catalog.h>
#include <Debug.h>
#include <Locale.h>
#include <MenuItem.h>
#include <Mime.h>
#include <InterfaceDefs.h>
@ -154,6 +156,9 @@ AddMenuItemVisitor::Visit(BPartition *partition, int32 level)
// #pragma mark -
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
MountMenu::MountMenu(const char *name)
: BMenu(name)
{
@ -214,10 +219,11 @@ MountMenu::AddDynamicItem(add_state)
AddSeparatorItem();
BMenuItem *mountAll = new BMenuItem("Mount all",
BMenuItem* mountAll = new BMenuItem(B_TRANSLATE("Mount all"),
new BMessage(kMountAllNow));
AddItem(mountAll);
BMenuItem *mountSettings = new BMenuItem("Settings" B_UTF8_ELLIPSIS,
BMenuItem* mountSettings = new BMenuItem(
B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
new BMessage(kRunAutomounterSettings));
AddItem(mountSettings);

View File

@ -42,7 +42,9 @@ All rights reserved.
#include <StopWatch.h>
#include <Application.h>
#include <Catalog.h>
#include <Directory.h>
#include <Locale.h>
#include <Query.h>
#include <Path.h>
#include <Screen.h>
@ -79,7 +81,7 @@ SpringLoadedFolderCompareMessages(const BMessage *incoming, const BMessage *drag
{
if (!dragmessage || !incoming)
return false;
bool retvalue=false;
for (int32 inIndex=0; incoming->HasRef("refs", inIndex); inIndex++) {
entry_ref inRef;
@ -137,7 +139,7 @@ SpringLoadedFolderSetMenuStates(const BMenu* menu, const BObjectList<BString> *t
ModelMenuItem *item = dynamic_cast<ModelMenuItem *>(menu->ItemAt(index));
if (!item)
continue;
const Model *model = item->TargetModel();
if (!model)
continue;
@ -244,6 +246,9 @@ SpringLoadedFolderCacheDragData(const BMessage *incoming, BMessage **message, BO
// #pragma mark -
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
BNavMenu::BNavMenu(const char *title, uint32 message, const BHandler *target,
BWindow *parentWindow, const BObjectList<BString> *list)
: BSlowMenu(title),
@ -574,7 +579,7 @@ BNavMenu::NewModelItem(Model *model, const BMessage *invokeMessage,
PoseInfo poseInfo;
ssize_t size = -1;
if (result->Node())
size = result->Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
&poseInfo, sizeof(poseInfo));
@ -722,7 +727,7 @@ BNavMenu::DoneBuildingItemList()
fItemList->MakeEmpty();
if (!count) {
BMenuItem *item = new BMenuItem("Empty folder", 0);
BMenuItem *item = new BMenuItem(B_TRANSLATE("Empty folder"), 0);
item->SetEnabled(false);
AddItem(item);
}

View File

@ -44,6 +44,8 @@ All rights reserved.
#include <Alert.h>
#include <Button.h>
#include <Catalog.h>
#include <Locale.h>
#include <Mime.h>
#include <NodeInfo.h>
#include <Path.h>
@ -55,6 +57,7 @@ All rights reserved.
#include <stdio.h>
#include <string.h>
const char *kDefaultOpenWithTemplate = "OpenWithSettings";
// ToDo:
@ -70,6 +73,9 @@ const int32 kOpenAndMakeDefault = 'OpDf';
const rgb_color kOpenWithDefaultColor = { 0xFF, 0xFF, 0xCC, 255};
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen,
LockingList<BWindow> *windowList, window_look look, window_feel feel,
uint32 flags, uint32 workspace)
@ -92,7 +98,7 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen,
// add buttons
fLaunchButton = new BButton(rect, "ok", "Open",
fLaunchButton = new BButton(rect, "ok", B_TRANSLATE("Open"),
new BMessage(kDefaultButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
fLaunchButton->ResizeToPreferred();
fLaunchButton->MoveTo(rect.right - 10 - kDocumentKnobWidth
@ -102,7 +108,7 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen,
BRect buttonRect = fLaunchButton->Frame();
fLaunchAndMakeDefaultButton = new BButton(buttonRect, "make default",
"Open and make preferred", new BMessage(kOpenAndMakeDefault),
B_TRANSLATE("Open and make preferred"), new BMessage(kOpenAndMakeDefault),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
// wide button, have to resize to fit text
fLaunchAndMakeDefaultButton->ResizeToPreferred();
@ -112,7 +118,7 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen,
fLaunchAndMakeDefaultButton->SetEnabled(false);
buttonRect = fLaunchAndMakeDefaultButton->Frame();
BButton *button = new BButton(buttonRect, "cancel", "Cancel",
BButton *button = new BButton(buttonRect, "cancel", B_TRANSLATE("Cancel"),
new BMessage(kCancelButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
button->MoveBy(- 10 - button->Bounds().Width(), 0);
@ -147,7 +153,7 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen,
SetTitle(buffer.String());
} else
// use generic title
SetTitle("Open selection with:");
SetTitle(B_TRANSLATE("Open selection with:"));
AddCommonFilter(new BMessageFilter(B_KEY_DOWN, &OpenWithContainerWindow::KeyDownFilter));
}
@ -377,7 +383,7 @@ OpenWithContainerWindow::NewAttributeMenu(BMenu *menu)
message->AddInt32("attr_align", B_ALIGN_LEFT);
message->AddBool("attr_editable", false);
message->AddBool("attr_statfield", false);
BMenuItem *item = new BMenuItem("Relation", message);
BMenuItem *item = new BMenuItem(B_TRANSLATE("Relation"), message);
menu->AddItem(item);
message = new BMessage(kAttributeItem);
message->AddString("attr_name", kAttrAppVersion);
@ -387,7 +393,7 @@ OpenWithContainerWindow::NewAttributeMenu(BMenu *menu)
message->AddInt32("attr_align", B_ALIGN_LEFT);
message->AddBool("attr_editable", false);
message->AddBool("attr_statfield", false);
item = new BMenuItem("Version", message);
item = new BMenuItem(B_TRANSLATE("Version"), message);
menu->AddItem(item);
}
@ -662,8 +668,8 @@ OpenWithPoseView::OpenSelection(BPose *pose, int32 *)
errorString << "Could not find application \""
<< pose->TargetModel()->Name() << "\"";
(new BAlert("", errorString.String(), "OK", 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go();
(new BAlert("", errorString.String(), B_TRANSLATE("OK"), 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
return;
}
@ -677,8 +683,9 @@ OpenWithPoseView::OpenSelection(BPose *pose, int32 *)
"publisher of the application and ask them to update their application "
"to list the type of your document as supported.";
BAlert *alert = new BAlert("", warning.String(),
"Cancel", "Open", 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("", warning.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Open"), 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 0)
return;
@ -756,16 +763,16 @@ OpenWithPoseView::SetUpDefaultColumnsIfNeeded()
if (fColumnList->CountItems() != 0)
return;
BColumn *nameColumn = new BColumn("Name", kColumnStart, 125, B_ALIGN_LEFT,
kAttrStatName, B_STRING_TYPE, true, true);
BColumn *nameColumn = new BColumn(B_TRANSLATE("Name"), kColumnStart, 125,
B_ALIGN_LEFT, kAttrStatName, B_STRING_TYPE, true, true);
fColumnList->AddItem(nameColumn);
BColumn *relationColumn = new BColumn("Relation", 180, 100, B_ALIGN_LEFT,
kAttrOpenWithRelation, B_STRING_TYPE, false, false);
BColumn *relationColumn = new BColumn(B_TRANSLATE("Relation"), 180, 100,
B_ALIGN_LEFT, kAttrOpenWithRelation, B_STRING_TYPE, false, false);
fColumnList->AddItem(relationColumn);
fColumnList->AddItem(new BColumn("Location", 290, 225, B_ALIGN_LEFT,
kAttrPath, B_STRING_TYPE, true, false));
fColumnList->AddItem(new BColumn("Version", 525, 70, B_ALIGN_LEFT,
kAttrAppVersion, B_STRING_TYPE, false, false));
fColumnList->AddItem(new BColumn(B_TRANSLATE("Location"), 290, 225,
B_ALIGN_LEFT, kAttrPath, B_STRING_TYPE, true, false));
fColumnList->AddItem(new BColumn(B_TRANSLATE("Version"), 525, 70,
B_ALIGN_LEFT, kAttrAppVersion, B_STRING_TYPE, false, false));
// sort by relation and by name
SetPrimarySort(relationColumn->AttrHash());
@ -1152,7 +1159,7 @@ OpenWithMenu::DoneBuildingItemList()
SetTargetForItems(fMessenger);
if (!CountItems()) {
BMenuItem *item = new BMenuItem("no supporting apps", 0);
BMenuItem* item = new BMenuItem(B_TRANSLATE("no supporting apps"), 0);
item->SetEnabled(false);
AddItem(item);
}

View File

@ -43,6 +43,7 @@ All rights reserved.
#include <Alert.h>
#include <Application.h>
#include <Catalog.h>
#include <Clipboard.h>
#include <Debug.h>
#include <Dragger.h>
@ -51,6 +52,7 @@ All rights reserved.
#include <Screen.h>
#include <Query.h>
#include <List.h>
#include <Locale.h>
#include <MenuItem.h>
#include <NodeMonitor.h>
#include <Path.h>
@ -93,6 +95,9 @@ All rights reserved.
#include "WidthBuffer.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
using std::min;
using std::max;
@ -4083,24 +4088,23 @@ RunMimeTypeDestinationMenu(const char *actionText, const BObjectList<BString> *t
} else if (types)
description = embedTypeAs;
const char *labelText;
char text[1024];
BString labelText;
if (actionText) {
int32 length = 1024 - 1 - (int32)strlen(actionText);
if (length > 0) {
description.Truncate(length);
sprintf(text, actionText, description.String());
labelText = text;
labelText.SetTo(actionText);
labelText.ReplaceFirst("%s", description.String());
} else
labelText = "label too long";
labelText.SetTo(B_TRANSLATE("label too long"));
} else
labelText = description.String();
labelText = description;
menu->AddItem(new BMenuItem(labelText, 0));
menu->AddItem(new BMenuItem(labelText.String(), 0));
}
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Cancel", 0));
menu->AddItem(new BMenuItem(B_TRANSLATE("Cancel"), 0));
int32 result = -1;
BMenuItem *resultingItem = menu->Go(where, false, true);
@ -4254,7 +4258,8 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target
if (specificActionIndex == -1)
return false;
} else if (types.CountItems() > 0) {
specificTypeIndex = RunMimeTypeDestinationMenu("Create %s clipping",
specificTypeIndex = RunMimeTypeDestinationMenu(
B_TRANSLATE("Create %s clipping"),
&types, &typeNames, view->ConvertToScreen(dropPt));
if (specificTypeIndex == -1)

View File

@ -32,6 +32,8 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#include <Catalog.h>
#include <Locale.h>
#include <Menu.h>
#include <MenuItem.h>
#include <Path.h>
@ -45,6 +47,9 @@ All rights reserved.
#include "QueryPoseView.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
BQueryContainerWindow::BQueryContainerWindow(LockingList<BWindow> *windowList,
uint32 containerWindowFlags, window_look look,
window_feel feel, uint32 flags, uint32 workspace)
@ -85,23 +90,28 @@ BQueryContainerWindow::AddWindowMenu(BMenu *menu)
{
BMenuItem *item;
item = new BMenuItem("Resize to fit", new BMessage(kResizeToFit), 'Y');
item = new BMenuItem(B_TRANSLATE("Resize to fit"),
new BMessage(kResizeToFit), 'Y');
item->SetTarget(this);
menu->AddItem(item);
item = new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
item = new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A');
item = new BMenuItem(B_TRANSLATE("Select all"), new BMessage(B_SELECT_ALL),
'A');
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Invert selection", new BMessage(kInvertSelection), 'S');
item = new BMenuItem(B_TRANSLATE("Invert selection"),
new BMessage(kInvertSelection), 'S');
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W');
item = new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_QUIT_REQUESTED),
'W');
item->SetTarget(this);
menu->AddItem(item);
}
@ -110,12 +120,14 @@ BQueryContainerWindow::AddWindowMenu(BMenu *menu)
void
BQueryContainerWindow::AddWindowContextMenus(BMenu *menu)
{
BMenuItem *resizeItem = new BMenuItem("Resize to Fit",
BMenuItem* resizeItem = new BMenuItem(B_TRANSLATE("Resize to Fit"),
new BMessage(kResizeToFit), 'Y');
menu->AddItem(resizeItem);
menu->AddItem(new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
menu->AddItem(new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
BMenuItem *closeItem = new BMenuItem("Close",
menu->AddItem(new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select all"),
new BMessage(B_SELECT_ALL), 'A'));
BMenuItem* closeItem = new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W');
menu->AddItem(closeItem);
// target items as needed

View File

@ -35,7 +35,9 @@ All rights reserved.
#include <new>
#include <Catalog.h>
#include <Debug.h>
#include <Locale.h>
#include <NodeMonitor.h>
#include <Query.h>
#include <Volume.h>
@ -54,6 +56,10 @@ All rights reserved.
#include <fs_attr.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
using std::nothrow;
// Currently filtering out Trash doesn't node monitor too well - if you
@ -113,14 +119,14 @@ BQueryPoseView::SetUpDefaultColumnsIfNeeded()
if (fColumnList->CountItems() != 0)
return;
fColumnList->AddItem(new BColumn("Name", kColumnStart, 145, B_ALIGN_LEFT,
kAttrStatName, B_STRING_TYPE, true, true));
fColumnList->AddItem(new BColumn("Location", 200, 225, B_ALIGN_LEFT,
kAttrPath, B_STRING_TYPE, true, false));
fColumnList->AddItem(new BColumn("Size", 440, 80, B_ALIGN_RIGHT,
kAttrStatSize, B_OFF_T_TYPE, true, false));
fColumnList->AddItem(new BColumn("Modified", 535, 150, B_ALIGN_LEFT,
kAttrStatModified, B_TIME_TYPE, true, false));
fColumnList->AddItem(new BColumn(B_TRANSLATE("Name"), kColumnStart, 145,
B_ALIGN_LEFT, kAttrStatName, B_STRING_TYPE, true, true));
fColumnList->AddItem(new BColumn(B_TRANSLATE("Location"), 200, 225,
B_ALIGN_LEFT, kAttrPath, B_STRING_TYPE, true, false));
fColumnList->AddItem(new BColumn(B_TRANSLATE("Size"), 440, 80,
B_ALIGN_RIGHT, kAttrStatSize, B_OFF_T_TYPE, true, false));
fColumnList->AddItem(new BColumn(B_TRANSLATE("Modified"), 535, 150,
B_ALIGN_LEFT, kAttrStatModified, B_TIME_TYPE, true, false));
}

View File

@ -35,6 +35,8 @@ All rights reserved.
#include <BeBuild.h>
#include <Alert.h>
#include <Box.h>
#include <Catalog.h>
#include <Locale.h>
#include <MenuItem.h>
#include "AutoLock.h"
@ -47,8 +49,12 @@ const int frameThickness = 9;
const uint32 kSelectButtonPressed = 'sbpr';
SelectionWindow::SelectionWindow(BContainerWindow *window)
: BWindow(BRect(0, 0, 270, 0), "Select", B_TITLED_WINDOW,
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
SelectionWindow::SelectionWindow(BContainerWindow* window)
:
BWindow(BRect(0, 0, 270, 0), B_TRANSLATE("Select"), B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_V_RESIZABLE
| B_NO_WORKSPACE_ACTIVATION | B_ASYNCHRONOUS_CONTROLS
| B_NOT_ANCHORED_ON_ACTIVATE),
@ -67,11 +73,13 @@ SelectionWindow::SelectionWindow(BContainerWindow *window)
AddChild(backgroundView);
BMenu *menu = new BPopUpMenu("");
menu->AddItem(new BMenuItem("starts with", NULL));
menu->AddItem(new BMenuItem("ends with", NULL));
menu->AddItem(new BMenuItem("contains", NULL));
menu->AddItem(new BMenuItem("matches wildcard expression", NULL));
menu->AddItem(new BMenuItem("matches regular expression", NULL));
menu->AddItem(new BMenuItem(B_TRANSLATE("starts with"), NULL));
menu->AddItem(new BMenuItem(B_TRANSLATE("ends with"), NULL));
menu->AddItem(new BMenuItem(B_TRANSLATE("contains"), NULL));
menu->AddItem(new BMenuItem(B_TRANSLATE("matches wildcard expression"),
NULL));
menu->AddItem(new BMenuItem(B_TRANSLATE("matches regular expression"),
NULL));
menu->SetLabelFromMarked(true);
menu->ItemAt(3)->SetMarked(true);
@ -79,9 +87,10 @@ SelectionWindow::SelectionWindow(BContainerWindow *window)
// Set up the menu field
fMatchingTypeMenuField = new BMenuField(BRect(7, 6, Bounds().right - 5, 0),
NULL, "Name", menu);
NULL, B_TRANSLATE("Name"), menu);
backgroundView->AddChild(fMatchingTypeMenuField);
fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth("Name") + 8);
fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth(
B_TRANSLATE("Name")) + 8);
fMatchingTypeMenuField->ResizeToPreferred();
// Set up the expression text control
@ -93,20 +102,23 @@ SelectionWindow::SelectionWindow(BContainerWindow *window)
fExpressionTextControl->MakeFocus(true);
// Set up the Invert checkbox
fInverseCheckBox = new BCheckBox(BRect(7, fExpressionTextControl->Frame().bottom
+ 6, 6, 6), NULL, "Invert", NULL);
fInverseCheckBox = new BCheckBox(
BRect(7, fExpressionTextControl->Frame().bottom + 6, 6, 6), NULL,
B_TRANSLATE("Invert"), NULL);
backgroundView->AddChild(fInverseCheckBox);
fInverseCheckBox->ResizeToPreferred();
// Set up the Ignore Case checkbox
fIgnoreCaseCheckBox = new BCheckBox(BRect(fInverseCheckBox->Frame().right + 10,
fInverseCheckBox->Frame().top, 6, 6), NULL, "Ignore case", NULL);
fIgnoreCaseCheckBox = new BCheckBox(
BRect(fInverseCheckBox->Frame().right + 10,
fInverseCheckBox->Frame().top, 6, 6), NULL, B_TRANSLATE("Ignore case"),
NULL);
fIgnoreCaseCheckBox->SetValue(1);
backgroundView->AddChild(fIgnoreCaseCheckBox);
fIgnoreCaseCheckBox->ResizeToPreferred();
// Set up the Select button
fSelectButton = new BButton(BRect(0, 0, 5, 5), NULL, "Select",
fSelectButton = new BButton(BRect(0, 0, 5, 5), NULL, B_TRANSLATE("Select"),
new BMessage(kSelectButtonPressed), B_FOLLOW_RIGHT);
backgroundView->AddChild(fSelectButton);
@ -126,11 +138,13 @@ SelectionWindow::SelectionWindow(BContainerWindow *window)
(fSelectButton->Bounds().Height() / 2 -
(fh.ascent + fh.descent + fh.leading + 4) / 2) + fSelectButton->Frame().top;
fInverseCheckBox->MoveTo(fInverseCheckBox->Frame().left, topMiddleButton);
fIgnoreCaseCheckBox->MoveTo(fIgnoreCaseCheckBox->Frame().left, topMiddleButton);
fIgnoreCaseCheckBox->MoveTo(fIgnoreCaseCheckBox->Frame().left,
topMiddleButton);
float bottomMinWidth = 32 + fSelectButton->Bounds().Width() +
fInverseCheckBox->Bounds().Width() + fIgnoreCaseCheckBox->Bounds().Width();
float topMinWidth = be_plain_font->StringWidth("Name matches wildcard expression:###");
float topMinWidth = be_plain_font->StringWidth(
B_TRANSLATE("Name matches wildcard expression:###"));
float minWidth = bottomMinWidth > topMinWidth ? bottomMinWidth : topMinWidth;
Run();

View File

@ -43,6 +43,8 @@ All rights reserved.
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <Locale.h>
#include <MenuField.h>
#include <ColorControl.h>
#include <NodeMonitor.h>
@ -78,6 +80,9 @@ send_bool_notices(uint32 what, const char *name, bool value)
// #pragma mark -
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
SettingsView::SettingsView(BRect rect, const char *name)
: BView(rect, name, B_FOLLOW_ALL, 0)
{
@ -164,7 +169,8 @@ DesktopSettingsView::DesktopSettingsView(BRect rect)
: SettingsView(rect, "DesktopSettingsView")
{
rect.OffsetTo(B_ORIGIN);
fShowDisksIconRadioButton = new BRadioButton(rect, "", "Show Disks icon",
fShowDisksIconRadioButton = new BRadioButton(rect, "",
B_TRANSLATE("Show Disks icon"),
new BMessage(kShowDisksIconChanged));
fShowDisksIconRadioButton->ResizeToPreferred();
AddChild(fShowDisksIconRadioButton);
@ -173,14 +179,16 @@ DesktopSettingsView::DesktopSettingsView(BRect rect)
rect.OffsetBy(0, itemSpacing);
fMountVolumesOntoDesktopRadioButton = new BRadioButton(rect, "",
"Show volumes on Desktop", new BMessage(kVolumesOnDesktopChanged));
B_TRANSLATE("Show volumes on Desktop"),
new BMessage(kVolumesOnDesktopChanged));
AddChild(fMountVolumesOntoDesktopRadioButton);
fMountVolumesOntoDesktopRadioButton->ResizeToPreferred();
rect.OffsetBy(20, itemSpacing);
fMountSharedVolumesOntoDesktopCheckBox = new BCheckBox(rect, "",
"Show shared volumes on Desktop", new BMessage(kVolumesOnDesktopChanged));
B_TRANSLATE("Show shared volumes on Desktop"),
new BMessage(kVolumesOnDesktopChanged));
AddChild(fMountSharedVolumesOntoDesktopCheckBox);
fMountSharedVolumesOntoDesktopCheckBox->ResizeToPreferred();
@ -188,7 +196,8 @@ DesktopSettingsView::DesktopSettingsView(BRect rect)
rect = Bounds();
rect.top = rect.bottom;
fMountButton = new BButton(rect, "", "Mount settings" B_UTF8_ELLIPSIS,
fMountButton = new BButton(rect, "",
B_TRANSLATE("Mount settings" B_UTF8_ELLIPSIS),
new BMessage(kRunAutomounterSettings), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fMountButton->ResizeToPreferred();
fMountButton->MoveBy(0, -fMountButton->Bounds().Height());
@ -409,7 +418,8 @@ WindowsSettingsView::WindowsSettingsView(BRect rect)
: SettingsView(rect, "WindowsSettingsView")
{
rect.OffsetTo(B_ORIGIN);
fShowFullPathInTitleBarCheckBox = new BCheckBox(rect, "", "Show folder location in title tab",
fShowFullPathInTitleBarCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("Show folder location in title tab"),
new BMessage(kWindowsShowFullPathChanged));
fShowFullPathInTitleBarCheckBox->ResizeToPreferred();
AddChild(fShowFullPathInTitleBarCheckBox);
@ -417,35 +427,40 @@ WindowsSettingsView::WindowsSettingsView(BRect rect)
const float itemSpacing = fShowFullPathInTitleBarCheckBox->Bounds().Height() + kItemExtraSpacing;
rect.OffsetBy(0, itemSpacing);
fSingleWindowBrowseCheckBox = new BCheckBox(rect, "", "Single window navigation",
fSingleWindowBrowseCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("Single window navigation"),
new BMessage(kSingleWindowBrowseChanged));
fSingleWindowBrowseCheckBox->ResizeToPreferred();
AddChild(fSingleWindowBrowseCheckBox);
rect.OffsetBy(20, itemSpacing);
fShowNavigatorCheckBox = new BCheckBox(rect, "", "Show navigator",
fShowNavigatorCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("Show navigator"),
new BMessage(kShowNavigatorChanged));
fShowNavigatorCheckBox->ResizeToPreferred();
AddChild(fShowNavigatorCheckBox);
rect.OffsetBy(-20, itemSpacing);
fOutlineSelectionCheckBox = new BCheckBox(rect, "", "Outline selection rectangle only",
fOutlineSelectionCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("Outline selection rectangle only"),
new BMessage(kTransparentSelectionChanged));
fOutlineSelectionCheckBox->ResizeToPreferred();
AddChild(fOutlineSelectionCheckBox);
rect.OffsetBy(0, itemSpacing);
fSortFolderNamesFirstCheckBox = new BCheckBox(rect, "", "List folders first",
fSortFolderNamesFirstCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("List folders first"),
new BMessage(kSortFolderNamesFirstChanged));
fSortFolderNamesFirstCheckBox->ResizeToPreferred();
AddChild(fSortFolderNamesFirstCheckBox);
rect.OffsetBy(0, itemSpacing);
fTypeAheadFilteringCheckBox = new BCheckBox(rect, "", "Enable type-ahead filtering",
fTypeAheadFilteringCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("Enable type-ahead filtering"),
new BMessage(kTypeAheadFilteringChanged));
fTypeAheadFilteringCheckBox->ResizeToPreferred();
AddChild(fTypeAheadFilteringCheckBox);
@ -714,12 +729,13 @@ TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
rect.bottom = ceilf(fontHeight.ascent + fontHeight.descent) + 10;
BBox *clockBox = new BBox(rect, "Clock");
clockBox->SetLabel("Clock");
clockBox->SetLabel(B_TRANSLATE("Clock"));
AddChild(clockBox);
rect.left = 8;
rect.top = rect.bottom - 8;
f24HrRadioButton = new BRadioButton(rect, "", "24 hour",
f24HrRadioButton = new BRadioButton(rect, "",
B_TRANSLATE("24 hour"),
new BMessage(kSettingsContentsModified));
f24HrRadioButton->ResizeToPreferred();
clockBox->AddChild(f24HrRadioButton);
@ -727,7 +743,8 @@ TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
const float itemSpacing = f24HrRadioButton->Bounds().Height() + kItemExtraSpacing;
rect.OffsetBy(0, itemSpacing);
f12HrRadioButton = new BRadioButton(rect, "", "12 hour",
f12HrRadioButton = new BRadioButton(rect, "",
B_TRANSLATE("12 hour"),
new BMessage(kSettingsContentsModified));
f12HrRadioButton->ResizeToPreferred();
clockBox->AddChild(f12HrRadioButton);
@ -739,25 +756,28 @@ TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
rect = clockBox->Frame();
rect.OffsetBy(rect.Width() + 8, 0);
BBox *dateFormatBox = new BBox(rect, "Date order");
dateFormatBox->SetLabel("Date order");
dateFormatBox->SetLabel(B_TRANSLATE("Date order"));
AddChild(dateFormatBox);
rect = f24HrRadioButton->Frame();
fYMDRadioButton = new BRadioButton(rect, "", "Year-month-day",
fYMDRadioButton = new BRadioButton(rect, "",
B_TRANSLATE("Year-month-day"),
new BMessage(kSettingsContentsModified));
fYMDRadioButton->ResizeToPreferred();
dateFormatBox->AddChild(fYMDRadioButton);
rect.OffsetBy(0, itemSpacing);
fDMYRadioButton = new BRadioButton(rect, "", "Day-month-year",
fDMYRadioButton = new BRadioButton(rect, "",
B_TRANSLATE("Day-month-year"),
new BMessage(kSettingsContentsModified));
fDMYRadioButton->ResizeToPreferred();
dateFormatBox->AddChild(fDMYRadioButton);
rect.OffsetBy(0, itemSpacing);
fMDYRadioButton = new BRadioButton(rect, "", "Month-day-year",
fMDYRadioButton = new BRadioButton(rect, "",
B_TRANSLATE("Month-day-year"),
new BMessage(kSettingsContentsModified));
fMDYRadioButton->ResizeToPreferred();
dateFormatBox->AddChild(fMDYRadioButton);
@ -766,8 +786,10 @@ TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
dateFormatBox->Bounds().Height());
BPopUpMenu *menu = new BPopUpMenu("Separator");
menu->AddItem(new BMenuItem("None", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem("Space", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem(B_TRANSLATE("None"),
new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Space"),
new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem("-", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem("/", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem("\\", new BMessage(kSettingsContentsModified)));
@ -785,7 +807,7 @@ TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
rect.OffsetBy(0, itemSpacing + 10);
BStringView *exampleView = new BStringView(rect, "", "Examples:");
BStringView* exampleView = new BStringView(rect, "", B_TRANSLATE("Examples:"));
exampleView->ResizeToPreferred();
AddChild(exampleView);
@ -1052,7 +1074,8 @@ SpaceBarSettingsView::SpaceBarSettingsView(BRect rect)
: SettingsView(rect, "SpaceBarSettingsView")
{
rect.OffsetTo(B_ORIGIN);
fSpaceBarShowCheckBox = new BCheckBox(rect, "", "Show space bars on volumes",
fSpaceBarShowCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("Show space bars on volumes"),
new BMessage(kUpdateVolumeSpaceBar));
fSpaceBarShowCheckBox->ResizeToPreferred();
AddChild(fSpaceBarShowCheckBox);
@ -1064,11 +1087,17 @@ SpaceBarSettingsView::SpaceBarSettingsView(BRect rect)
menu->SetFont(be_plain_font);
BMenuItem *item;
menu->AddItem(item = new BMenuItem("Used space color", new BMessage(kSpaceBarSwitchColor)));
menu->AddItem(item = new BMenuItem(
B_TRANSLATE("Used space color"),
new BMessage(kSpaceBarSwitchColor)));
item->SetMarked(true);
fCurrentColor = 0;
menu->AddItem(new BMenuItem("Free space color", new BMessage(kSpaceBarSwitchColor)));
menu->AddItem(new BMenuItem("Warning space color", new BMessage(kSpaceBarSwitchColor)));
menu->AddItem(new BMenuItem(
B_TRANSLATE("Free space color"),
new BMessage(kSpaceBarSwitchColor)));
menu->AddItem(new BMenuItem(
B_TRANSLATE("Warning space color"),
new BMessage(kSpaceBarSwitchColor)));
BBox *box = new BBox(rect);
box->SetLabel(fColorPicker = new BMenuField(rect, NULL, NULL, menu));
@ -1302,7 +1331,8 @@ TrashSettingsView::TrashSettingsView(BRect rect)
: SettingsView(rect, "TrashSettingsView")
{
rect.OffsetTo(B_ORIGIN);
fDontMoveFilesToTrashCheckBox = new BCheckBox(rect, "", "Don't move files to Trash",
fDontMoveFilesToTrashCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("Don't move files to Trash"),
new BMessage(kDontMoveFilesToTrashChanged));
fDontMoveFilesToTrashCheckBox->ResizeToPreferred();
AddChild(fDontMoveFilesToTrashCheckBox);
@ -1310,7 +1340,8 @@ TrashSettingsView::TrashSettingsView(BRect rect)
rect = fDontMoveFilesToTrashCheckBox->Frame();
rect.OffsetBy(0, fDontMoveFilesToTrashCheckBox->Bounds().Height() + kItemExtraSpacing);
fAskBeforeDeleteFileCheckBox = new BCheckBox(rect, "", "Ask before delete",
fAskBeforeDeleteFileCheckBox = new BCheckBox(rect, "",
B_TRANSLATE("Ask before delete"),
new BMessage(kAskBeforeDeleteFileChanged));
fAskBeforeDeleteFileCheckBox->ResizeToPreferred();
AddChild(fAskBeforeDeleteFileCheckBox);

View File

@ -38,7 +38,9 @@ All rights reserved.
#include <Debug.h>
#include <Application.h>
#include <Catalog.h>
#include <Directory.h>
#include <Locale.h>
#include <Path.h>
#include <Query.h>
#include <StopWatch.h>
@ -60,6 +62,9 @@ All rights reserved.
#include "Tracker.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
BSlowContextMenu::BSlowContextMenu(const char *title)
: BPopUpMenu(title, false, false),
fMenuBuilt(false),
@ -486,7 +491,7 @@ BSlowContextMenu::DoneBuildingItemList()
fItemList->MakeEmpty();
if (!count) {
BMenuItem *item = new BMenuItem("Empty folder", 0);
BMenuItem* item = new BMenuItem(B_TRANSLATE("Empty folder"), 0);
item->SetEnabled(false);
AddItem(item);
}

View File

@ -39,8 +39,10 @@ All rights reserved.
#include <Application.h>
#include <Button.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <Debug.h>
#include <Locale.h>
#include <MessageFilter.h>
#include <StringView.h>
#include <String.h>
@ -182,11 +184,14 @@ public:
// #pragma mark - BStatusWindow
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
BStatusWindow::BStatusWindow()
:
BWindow(kStatusRect, "Tracker status", B_TITLED_WINDOW,
B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE,
B_ALL_WORKSPACES),
BWindow(kStatusRect, B_TRANSLATE("Tracker status"), B_TITLED_WINDOW,
B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES),
fRetainDesktopFocus(false)
{
SetSizeLimits(0, 100000, 0, 100000);
@ -446,41 +451,41 @@ BStatusView::BStatusView(BRect bounds, thread_id thread,
rect.top += 6;
rect.bottom = rect.top + 15;
const char* caption = NULL;
BString caption;
int32 id = 0;
switch (type) {
case kCopyState:
caption = "Preparing to copy items" B_UTF8_ELLIPSIS;
caption = B_TRANSLATE("Preparing to copy items" B_UTF8_ELLIPSIS);
id = R_CopyStatusBitmap;
break;
case kMoveState:
caption = "Preparing to move items" B_UTF8_ELLIPSIS;
caption = B_TRANSLATE("Preparing to move items" B_UTF8_ELLIPSIS);
id = R_MoveStatusBitmap;
break;
case kCreateLinkState:
caption = "Preparing to create links" B_UTF8_ELLIPSIS;
caption = B_TRANSLATE("Preparing to create links" B_UTF8_ELLIPSIS);
id = R_MoveStatusBitmap;
break;
case kTrashState:
caption = "Preparing to empty Trash" B_UTF8_ELLIPSIS;
caption = B_TRANSLATE("Preparing to empty Trash" B_UTF8_ELLIPSIS);
id = R_TrashStatusBitmap;
break;
case kVolumeState:
caption = "Searching for disks to mount" B_UTF8_ELLIPSIS;
caption = B_TRANSLATE("Searching for disks to mount" B_UTF8_ELLIPSIS);
break;
case kDeleteState:
caption = "Preparing to delete items" B_UTF8_ELLIPSIS;
caption = B_TRANSLATE("Preparing to delete items" B_UTF8_ELLIPSIS);
id = R_TrashStatusBitmap;
break;
case kRestoreFromTrashState:
caption = "Preparing to restore items" B_UTF8_ELLIPSIS;
caption = B_TRANSLATE("Preparing to restore items" B_UTF8_ELLIPSIS);
break;
default:
@ -488,8 +493,8 @@ BStatusView::BStatusView(BRect bounds, thread_id thread,
break;
}
if (caption != NULL) {
fStatusBar = new BStatusBar(rect, "StatusBar", caption);
if (caption.Length() != 0) {
fStatusBar = new BStatusBar(rect, "StatusBar", caption.String());
fStatusBar->SetBarHeight(12);
float width, height;
fStatusBar->GetPreferredSize(&width, &height);
@ -572,33 +577,37 @@ BStatusView::InitStatus(int32 totalItems, off_t totalSize,
}
BString buffer;
if (totalItems > 0)
buffer << "of " << totalItems;
if (totalItems > 0) {
char totalStr[32];
buffer.SetTo(B_TRANSLATE("of %items"));
snprintf(totalStr, sizeof(totalStr), "%ld", totalItems);
buffer.ReplaceFirst("%items", totalStr);
}
switch (fType) {
case kCopyState:
fStatusBar->Reset("Copying: ", buffer.String());
fStatusBar->Reset(B_TRANSLATE("Copying: "), buffer.String());
break;
case kCreateLinkState:
fStatusBar->Reset("Creating links: ", buffer.String());
fStatusBar->Reset(B_TRANSLATE("Creating links: "), buffer.String());
break;
case kMoveState:
fStatusBar->Reset("Moving: ", buffer.String());
fStatusBar->Reset(B_TRANSLATE("Moving: "), buffer.String());
break;
case kTrashState:
fStatusBar->Reset("Emptying Trash" B_UTF8_ELLIPSIS " ",
fStatusBar->Reset(B_TRANSLATE("Emptying Trash" B_UTF8_ELLIPSIS " "),
buffer.String());
break;
case kDeleteState:
fStatusBar->Reset("Deleting: ", buffer.String());
fStatusBar->Reset(B_TRANSLATE("Deleting: "), buffer.String());
break;
case kRestoreFromTrashState:
fStatusBar->Reset("Restoring: ", buffer.String());
fStatusBar->Reset(B_TRANSLATE("Restoring: "), buffer.String());
break;
default:
@ -650,7 +659,7 @@ BStatusView::Draw(BRect updateRect)
tp.y += ceilf(fh.leading) + ceilf(fh.ascent);
if (IsPaused())
DrawString("Paused: click to resume or stop", tp);
DrawString(B_TRANSLATE("Paused: click to resume or stop"), tp);
else if (fDestDir.Length()) {
BString buffer;
buffer << "To: " << fDestDir;
@ -714,40 +723,48 @@ BStatusView::Draw(BRect updateRect)
// TODO: Localization of time string...
if (now < finishTime - secondsPerDay) {
// process is going to take more than a day!
sprintf(timeText, "%0*d:%0*d %0*d/%0*d/%ld",
snprintf(timeText, sizeof(timeText), "%0*d:%0*d %0*d/%0*d/%ld",
2, time->tm_hour, 2, time->tm_min,
2, time->tm_mon + 1, 2, time->tm_mday, year);
} else {
sprintf(timeText, "%0*d:%0*d",
snprintf(timeText, sizeof(timeText), "%0*d:%0*d",
2, time->tm_hour, 2, time->tm_min);
}
BString buffer1("Finish: ");
buffer1 << timeText;
finishTime -= now;
time = gmtime(&finishTime);
char finishStr[32];
BString buffer2;
if (finishTime > secondsPerDay)
buffer2 << "Over " << finishTime / secondsPerDay << " days";
else if (finishTime > 60 * 60)
buffer2 << "Over " << finishTime / (60 * 60) << " hours";
else if (finishTime > 60)
buffer2 << finishTime / 60 << " minutes";
else
buffer2 << finishTime << " seconds";
if (finishTime > secondsPerDay) {
buffer.SetTo(B_TRANSLATE("(Finish: %time - Over %finishtime "
"days left)"));
snprintf(finishStr, sizeof(finishStr), "%ld",
finishTime / secondsPerDay);
} else if (finishTime > 60 * 60) {
buffer.SetTo(B_TRANSLATE("(Finish: %time - Over %finishtime "
"hours left)"));
snprintf(finishStr, sizeof(finishStr), "%ld",
finishTime / (60 * 60));
} else if (finishTime > 60) {
buffer.SetTo(B_TRANSLATE("(Finish: %time - %finishtime minutes "
"left)"));
snprintf(finishStr, sizeof(finishStr), "%ld", finishTime / 60);
} else {
buffer.SetTo(B_TRANSLATE("(Finish: %time - %finishtime seconds "
"left)"));
snprintf(finishStr, sizeof(finishStr), "%ld", finishTime);
}
buffer2 << " left";
buffer.ReplaceFirst("%time", timeText);
buffer.ReplaceFirst("%finishtime", finishStr);
buffer = "(";
buffer << buffer1 << " - " << buffer2 << ")";
tp.x = fStatusBar->Frame().right - StringWidth(buffer.String());
if (tp.x > rightDivider)
DrawString(buffer.String(), tp);
else {
// complete string too wide, try with shorter version
buffer = "(";
buffer << buffer1 << ")";
buffer.SetTo(B_TRANSLATE("(Finish: %time)"));
buffer.ReplaceFirst("%time", timeText);
tp.x = fStatusBar->Frame().right - StringWidth(buffer.String());
if (tp.x > rightDivider)
DrawString(buffer.String(), tp);

View File

@ -33,9 +33,11 @@ All rights reserved.
*/
#include <Application.h>
#include <Catalog.h>
#include <FindDirectory.h>
#include <Directory.h>
#include <NodeInfo.h>
#include <Locale.h>
#include <Mime.h>
#include <Message.h>
#include <Path.h>
@ -50,12 +52,15 @@ All rights reserved.
#include "IconMenuItem.h"
#include "MimeTypes.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
namespace BPrivate {
const char *kTemplatesDirectory = "Tracker/Tracker New Templates";
const char *kTemplatesMenuName = "New";
static const char *kOpenTemplatesMenuName = "Edit templates"B_UTF8_ELLIPSIS;
}
@ -112,8 +117,8 @@ TemplatesMenu::BuildMenu(bool addItems)
delete RemoveItem(0L);
// Add the Folder
IconMenuItem *menuItem = new IconMenuItem("New folder", new BMessage(kNewFolder),
B_DIR_MIMETYPE,B_MINI_ICON);
IconMenuItem* menuItem = new IconMenuItem(B_TRANSLATE("New folder"),
new BMessage(kNewFolder), B_DIR_MIMETYPE, B_MINI_ICON);
AddItem(menuItem);
menuItem->SetShortcut('N', 0);
@ -172,7 +177,8 @@ TemplatesMenu::BuildMenu(bool addItems)
message->AddRef("refs", &dirRef);
// Add item to show templates folder.
fOpenItem = new BMenuItem(kOpenTemplatesMenuName, message);
fOpenItem = new BMenuItem(B_TRANSLATE("Edit templates" B_UTF8_ELLIPSIS),
message);
AddItem(fOpenItem);
if (dirRef == entry_ref())
fOpenItem->SetEnabled(false);

View File

@ -46,7 +46,7 @@ extern const char* kTemplatesMenuName;
class TemplatesMenu : public BMenu {
public:
TemplatesMenu(const BMessenger &target,
const char *label = kTemplatesMenuName);
const char *label);
virtual ~TemplatesMenu();

View File

@ -40,11 +40,13 @@ All rights reserved.
#include <Alert.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Debug.h>
#include <FindDirectory.h>
#include <fs_attr.h>
#include <fs_info.h>
#include <image.h>
#include <Locale.h>
#include <MenuItem.h>
#include <NodeInfo.h>
#include <NodeMonitor.h>
@ -206,6 +208,9 @@ GetVolumeFlags(Model *model)
// #pragma mark -
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
TTracker::TTracker()
: BApplication(kTrackerSignature),
fSettingsWindow(NULL)
@ -663,9 +668,9 @@ TTracker::OpenRef(const entry_ref *ref, const node_ref *nodeToClose,
if (!brokenLinkWithSpecificHandler) {
delete model;
BAlert *alert = new BAlert("",
"There was an error resolving the link.",
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("There was an error resolving the link."),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return result;

View File

@ -37,8 +37,10 @@ All rights reserved.
// important sniffer rules
#include <Alert.h>
#include <Catalog.h>
#include <Directory.h>
#include <InterfaceDefs.h>
#include <Locale.h>
#include <Message.h>
#include <Node.h>
#include <Path.h>
@ -330,6 +332,9 @@ AddTemporaryBackgroundImages(BMessage *message, const char *imagePath,
// #pragma mark -
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
bool
TTracker::InstallMimeIfNeeded(const char *type, int32 bitsID,
const char *shortDescription, const char *longDescription,
@ -592,12 +597,13 @@ TTracker::InstallTemporaryBackgroundImages()
BPath path;
status_t status = find_directory(B_SYSTEM_DATA_DIRECTORY, &path);
if (status < B_OK) {
BString errorMessage;
errorMessage << "At " << __PRETTY_FUNCTION__ << "\n";
errorMessage << "find_directory() failed. \nReason: ";
errorMessage << strerror(status);
(new BAlert("AlertError", errorMessage.String(), "OK", NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
// TODO: this error shouldn't be shown to the regular user
BString errorMessage(B_TRANSLATE("At %func \nfind_directory() failed. "
"\nReason: %error"));
errorMessage.ReplaceFirst("%func", __PRETTY_FUNCTION__);
errorMessage.ReplaceFirst("%error", strerror(status));
(new BAlert("AlertError", errorMessage.String(), B_TRANSLATE("OK"),
NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
return;
}
path.Append("artwork");

View File

@ -32,6 +32,8 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#include <Catalog.h>
#include <Locale.h>
#include "SettingsViews.h"
#include "TrackerSettings.h"
@ -63,10 +65,15 @@ const uint32 kDefaultsButtonPressed = 'Apbp';
const uint32 kRevertButtonPressed = 'Rebp';
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
TrackerSettingsWindow::TrackerSettingsWindow()
: BWindow(BRect(80, 80, 450, 350), "Tracker preferences", B_TITLED_WINDOW,
B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_NO_WORKSPACE_ACTIVATION
| B_NOT_ANCHORED_ON_ACTIVATE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
:
BWindow(BRect(80, 80, 450, 350), B_TRANSLATE("Tracker preferences"),
B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
| B_NO_WORKSPACE_ACTIVATION | B_NOT_ANCHORED_ON_ACTIVATE
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
{
BRect rect = Bounds();
BView *topView = new BView(rect, "Background", B_FOLLOW_ALL, 0);
@ -74,8 +81,8 @@ TrackerSettingsWindow::TrackerSettingsWindow()
AddChild(topView);
rect.InsetBy(10, 10);
rect.right = rect.left + be_plain_font->StringWidth("Volume Icons")
+ (float)B_V_SCROLL_BAR_WIDTH + 40.0f;
rect.right = be_plain_font->StringWidth(B_TRANSLATE("Volume Icons"))
+ rect.left + (float)B_V_SCROLL_BAR_WIDTH + 40.0f;
fSettingsTypeListView = new BListView(rect, "List View", B_SINGLE_SELECTION_LIST,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM);
BScrollView* scrollView = new BScrollView("scrollview", fSettingsTypeListView,
@ -85,7 +92,7 @@ TrackerSettingsWindow::TrackerSettingsWindow()
rect = scrollView->Frame();
rect.left = rect.right + 10;
rect.top = rect.bottom;
fDefaultsButton = new BButton(rect, "Defaults", "Defaults",
fDefaultsButton = new BButton(rect, "Defaults", B_TRANSLATE("Defaults"),
new BMessage(kDefaultsButtonPressed), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fDefaultsButton->ResizeToPreferred();
fDefaultsButton->SetEnabled(false);
@ -93,7 +100,7 @@ TrackerSettingsWindow::TrackerSettingsWindow()
rect = fDefaultsButton->Frame();
rect.left = rect.right + 10;
fRevertButton = new BButton(rect, "Revert", "Revert",
fRevertButton = new BButton(rect, "Revert", B_TRANSLATE("Revert"),
new BMessage(kRevertButtonPressed), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fRevertButton->SetEnabled(false);
fRevertButton->ResizeToPreferred();
@ -109,15 +116,15 @@ TrackerSettingsWindow::TrackerSettingsWindow()
rect = _SettingsFrame();
fSettingsTypeListView->AddItem(new SettingsItem("Desktop",
fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Desktop"),
new DesktopSettingsView(rect)));
fSettingsTypeListView->AddItem(new SettingsItem("Windows",
fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Windows"),
new WindowsSettingsView(rect)));
fSettingsTypeListView->AddItem(new SettingsItem("Date & Time",
fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Date & Time"),
new TimeFormatSettingsView(rect)));
fSettingsTypeListView->AddItem(new SettingsItem("Trash",
fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Trash"),
new TrashSettingsView(rect)));
fSettingsTypeListView->AddItem(new SettingsItem("Volume icons",
fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Volume icons"),
new SpaceBarSettingsView(rect)));
// compute preferred view size

View File

@ -32,7 +32,9 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#include <Catalog.h>
#include <Debug.h>
#include <Locale.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuItem.h>
@ -47,6 +49,10 @@ All rights reserved.
#include "MountMenu.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
BVolumeWindow::BVolumeWindow(LockingList<BWindow> *windowList, uint32 openFlags)
: BContainerWindow(windowList, openFlags)
{
@ -79,7 +85,7 @@ BVolumeWindow::MenusBeginning()
}
}
BMenuItem *item = fMenuBar->FindItem("Unmount");
BMenuItem* item = fMenuBar->FindItem(B_TRANSLATE("Unmount"));
if (item)
item->SetEnabled(ejectableVolumeSelected);
}
@ -88,23 +94,27 @@ BVolumeWindow::MenusBeginning()
void
BVolumeWindow::AddFileMenu(BMenu *menu)
{
menu->AddItem(new BMenuItem("Find"B_UTF8_ELLIPSIS,
menu->AddItem(new BMenuItem(B_TRANSLATE("Find"B_UTF8_ELLIPSIS),
new BMessage(kFindButton), 'F'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem("Get info", new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem("Edit name", new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Open"),
new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"),
new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
BMenuItem *item = new BMenuItem("Unmount", new BMessage(kUnmountVolume), 'U');
BMenuItem* item = new BMenuItem(B_TRANSLATE("Unmount"),
new BMessage(kUnmountVolume), 'U');
item->SetEnabled(false);
menu->AddItem(item);
menu->AddItem(new BMenuItem("Mount settings" B_UTF8_ELLIPSIS,
menu->AddItem(new BMenuItem(B_TRANSLATE("Mount settings" B_UTF8_ELLIPSIS),
new BMessage(kRunAutomounterSettings)));
menu->AddSeparatorItem();
menu->AddItem(new BMenu(kAddOnsMenuName));
menu->AddItem(new BMenu(B_TRANSLATE("Add-ons")));
menu->SetTargetForItems(PoseView());
}
@ -118,26 +128,35 @@ BVolumeWindow::AddWindowContextMenus(BMenu *menu)
return;
}
menu->AddItem(new BMenuItem("Icon view", new BMessage(kIconMode)));
menu->AddItem(new BMenuItem("Mini icon view", new BMessage(kMiniIconMode)));
menu->AddItem(new BMenuItem("List view", new BMessage(kListMode)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Icon view"),
new BMessage(kIconMode)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Mini icon view"),
new BMessage(kMiniIconMode)));
menu->AddItem(new BMenuItem(B_TRANSLATE("List view"),
new BMessage(kListMode)));
menu->AddSeparatorItem();
BMenuItem *resizeItem = new BMenuItem("Resize to fit",new BMessage(kResizeToFit), 'Y');
BMenuItem* resizeItem = new BMenuItem(B_TRANSLATE("Resize to fit"),
new BMessage(kResizeToFit), 'Y');
menu->AddItem(resizeItem);
menu->AddItem(new BMenuItem("Clean up", new BMessage(kCleanup), 'K'));
menu->AddItem(new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
menu->AddItem(new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
menu->AddItem(new BMenuItem("Invert selection", new BMessage(kInvertSelection), 'S'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Clean up"),
new BMessage(kCleanup), 'K'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select all"),
new BMessage(B_SELECT_ALL), 'A'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Invert selection"),
new BMessage(kInvertSelection), 'S'));
BMenuItem *closeItem = new BMenuItem("Close",new BMessage(B_QUIT_REQUESTED), 'W');
BMenuItem* closeItem = new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W');
menu->AddItem(closeItem);
menu->AddSeparatorItem();
menu->AddItem(new MountMenu("Mount"));
menu->AddItem(new MountMenu(B_TRANSLATE("Mount")));
menu->AddSeparatorItem();
menu->AddItem(new BMenu(kAddOnsMenuName));
menu->AddItem(new BMenu(B_TRANSLATE("Add-ons")));
// target items as needed
menu->SetTargetForItems(PoseView());

View File

@ -40,7 +40,9 @@ All rights reserved.
#include <Alert.h>
#include <AppFileInfo.h>
#include <Catalog.h>
#include <Debug.h>
#include <Locale.h>
#include <NodeInfo.h>
#include <Path.h>
#include <TextView.h>
@ -61,6 +63,11 @@ All rights reserved.
#include "WidgetAttributeText.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
const int32 kGenericReadBufferSize = 1024;
template <class View>
@ -208,6 +215,8 @@ TruncFileSizeBase(BString *result, int64 value, const View *view, float width)
// ToDo:
// if slow, replace float divisions with shifts
// if fast enough, try fitting more decimal places
// TODO: reuse libshared's string_for_size
// format file size value
char buffer[1024];
@ -215,24 +224,24 @@ TruncFileSizeBase(BString *result, int64 value, const View *view, float width)
*result = "-";
return view->StringWidth("-");
} else if (value < kKBSize) {
sprintf(buffer, "%Ld bytes", value);
sprintf(buffer, B_TRANSLATE("%Ld bytes"), value);
if (view->StringWidth(buffer) > width)
sprintf(buffer, "%Ld B", value);
sprintf(buffer, B_TRANSLATE("%Ld B"), value);
} else {
const char *suffix;
float floatValue;
if (value >= kTBSize) {
suffix = "TiB";
suffix = B_TRANSLATE("TiB");
floatValue = (float)value / kTBSize;
} else if (value >= kGBSize) {
suffix = "GiB";
suffix = B_TRANSLATE("GiB");
floatValue = (float)value / kGBSize;
} else if (value >= kMBSize) {
suffix = "MiB";
suffix = B_TRANSLATE("MiB");
floatValue = (float)value / kMBSize;
} else {
ASSERT(value >= kKBSize);
suffix = "KiB";
suffix = B_TRANSLATE("KiB");
floatValue = (float)value / kKBSize;
}
@ -751,7 +760,7 @@ KindAttributeText::ReadValue(BString *result)
// get the mime type
if (mime.SetType(fModel->MimeType()) != B_OK)
*result = "Unknown";
*result = B_TRANSLATE("Unknown");
// get the short mime type description
else if (mime.GetShortDescription(desc) == B_OK)
*result = desc;
@ -872,9 +881,12 @@ NameAttributeText::CommitEditedTextFlavor(BTextView *textView)
bool removeExisting = false;
if (parent.Contains(text)) {
BAlert *alert = new BAlert("", "That name is already taken. "
"Please type another one.", "Replace other file", "OK", NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("That name is already taken. "
"Please type another one."),
B_TRANSLATE("Replace other file"),
B_TRANSLATE("OK"),
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, 'r');
@ -1592,8 +1604,10 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView *textView)
&& type != B_DOUBLE_TYPE
&& type != B_CHAR_TYPE
&& type != B_BOOL_TYPE) {
BAlert *alert = new BAlert("", "Sorry, you cannot edit that attribute.",
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("Sorry, you cannot edit that attribute."),
B_TRANSLATE("Cancel"),
0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return false;
@ -1626,9 +1640,11 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView *textView)
sscanf(textView->Text(), "%c", &ch);
//Check if we read the start of a multi-byte glyph:
if (!isprint(ch)) {
BAlert *alert = new BAlert("", "Sorry, the 'Character' "
"attribute cannot store a multi-byte glyph.",
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("Sorry, the 'Character' "
"attribute cannot store a multi-byte glyph."),
B_TRANSLATE("Cancel"),
0, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return false;
@ -1727,9 +1743,10 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView *textView)
}
if (size < 0) {
BAlert *alert = new BAlert("",
"There was an error writing the attribute.",
"Cancel", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("There was an error writing the attribute."),
B_TRANSLATE("Cancel"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();

View File

@ -0,0 +1 @@
resource app_signature "application/x-vnd.Haiku-libtracker";