Updated to use B_TRANSLATE* macros. relates to #5408.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36684 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-05-06 23:40:10 +00:00
parent 05f7d43e06
commit b1c66135aa
11 changed files with 313 additions and 276 deletions
@@ -62,7 +62,7 @@ const uint32 kMsgRemoveType = 'rmtp';
const uint32 kMsgTypeRemoved = 'tprm';
// TextView that filters the tab key to be able to tab-navigate while editing
// TextView that filters the tab key to be able to tab-navigate while editing
class TabFilteringTextView : public BTextView {
public:
TabFilteringTextView(const char* name);
@@ -161,11 +161,11 @@ SupportedTypeItem::Compare(const void* _a, const void* _b)
{
const SupportedTypeItem* a = *(const SupportedTypeItem**)_a;
const SupportedTypeItem* b = *(const SupportedTypeItem**)_b;
int compare = strcasecmp(a->Text(), b->Text());
if (compare != 0)
return compare;
return strcasecmp(a->Type(), b->Type());
}
@@ -197,12 +197,12 @@ SupportedTypeListView::MessageReceived(BMessage* message)
BNodeInfo info(&node);
if (node.InitCheck() != B_OK || info.InitCheck() != B_OK)
continue;
// TODO: we could identify the file in case it doesn't have a type...
char type[B_MIME_TYPE_LENGTH];
if (info.GetType(type) != B_OK)
continue;
// check if that type is already in our list
bool found = false;
for (int32 i = CountItems(); i-- > 0;) {
@@ -212,13 +212,13 @@ SupportedTypeListView::MessageReceived(BMessage* message)
break;
}
}
if (!found) {
// add type
AddItem(new SupportedTypeItem(type));
}
}
SortItems(&SupportedTypeItem::Compare);
} else
DropTargetListView::MessageReceived(message);
@@ -236,12 +236,12 @@ SupportedTypeListView::AcceptsDrag(const BMessage* message)
// #pragma mark -
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
const BEntry& entry)
:
BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
TR("Application type"), B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |
B_TRANSLATE("Application type"), B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |
B_FRAME_EVENTS | B_AUTO_UPDATE_SIZE_LIMITS),
fChangedProperties(0)
{
@@ -252,32 +252,33 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
// seems too big
labelAlignment = be_control_look->DefaultLabelAlignment();
}
BMenuBar* menuBar = new BMenuBar((char*)NULL);
menuBar->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
BMenu* menu = new BMenu(TR("File"));
fSaveMenuItem = new BMenuItem(TR("Save"), new BMessage(kMsgSave), 'S');
BMenu* menu = new BMenu(B_TRANSLATE("File"));
fSaveMenuItem = new BMenuItem(B_TRANSLATE("Save"),
new BMessage(kMsgSave), 'S');
fSaveMenuItem->SetEnabled(false);
menu->AddItem(fSaveMenuItem);
BMenuItem* item;
menu->AddItem(item = new BMenuItem(
TR("Save into resource file" B_UTF8_ELLIPSIS), NULL));
B_TRANSLATE("Save into resource file" B_UTF8_ELLIPSIS), NULL));
item->SetEnabled(false);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(TR("Close"), new BMessage(B_QUIT_REQUESTED),
'W', B_COMMAND_KEY));
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W', B_COMMAND_KEY));
menuBar->AddItem(menu);
// Signature
fSignatureControl = new BTextControl(TR("Signature:"), NULL,
fSignatureControl = new BTextControl(B_TRANSLATE("Signature:"), NULL,
new BMessage(kMsgSignatureChanged));
fSignatureControl->SetModificationMessage(
fSignatureControl->SetModificationMessage(
new BMessage(kMsgSignatureChanged));
// filter out invalid characters that can't be part of a MIME type name
BTextView* textView = fSignatureControl->TextView();
textView->SetMaxBytes(B_MIME_TYPE_LENGTH);
@@ -285,41 +286,41 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
for (int32 i = 0; disallowedCharacters[i]; i++) {
textView->DisallowChar(disallowedCharacters[i]);
}
// "Application Flags" group
BBox* flagsBox = new BBox("flagsBox");
fFlagsCheckBox = new BCheckBox("flags", TR("Application flags"),
fFlagsCheckBox = new BCheckBox("flags", B_TRANSLATE("Application flags"),
new BMessage(kMsgToggleAppFlags));
fFlagsCheckBox->SetValue(B_CONTROL_ON);
fSingleLaunchButton = new BRadioButton("single", TR("Single launch"),
new BMessage(kMsgAppFlagsChanged));
fSingleLaunchButton = new BRadioButton("single",
B_TRANSLATE("Single launch"), new BMessage(kMsgAppFlagsChanged));
fMultipleLaunchButton = new BRadioButton("multiple",
TR("Multiple launch"), new BMessage(kMsgAppFlagsChanged));
B_TRANSLATE("Multiple launch"), new BMessage(kMsgAppFlagsChanged));
fExclusiveLaunchButton = new BRadioButton("exclusive",
TR("Exclusive launch"), new BMessage(kMsgAppFlagsChanged));
fArgsOnlyCheckBox = new BCheckBox("args only", TR("Args only"),
B_TRANSLATE("Exclusive launch"), new BMessage(kMsgAppFlagsChanged));
fArgsOnlyCheckBox = new BCheckBox("args only", B_TRANSLATE("Args only"),
new BMessage(kMsgAppFlagsChanged));
fBackgroundAppCheckBox = new BCheckBox("background",
TR("Background app"), new BMessage(kMsgAppFlagsChanged));
B_TRANSLATE("Background app"), new BMessage(kMsgAppFlagsChanged));
flagsBox->AddChild(BGridLayoutBuilder(padding, padding)
.Add(fSingleLaunchButton, 0, 0).Add(fArgsOnlyCheckBox, 1, 0)
.Add(fMultipleLaunchButton, 0, 1).Add(fBackgroundAppCheckBox, 1, 1)
.Add(fExclusiveLaunchButton, 0, 2)
.SetInsets(padding, padding, padding, padding));
flagsBox->SetLabel(fFlagsCheckBox);
// "Icon" group
BBox* iconBox = new BBox("IconBox");
iconBox->SetLabel(TR("Icon"));
iconBox->SetLabel(B_TRANSLATE("Icon"));
fIconView = new IconView("icon");
fIconView->SetModificationMessage(new BMessage(kMsgIconChanged));
iconBox->AddChild(
@@ -327,29 +328,29 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
.Add(fIconView)
.SetInsets(padding, padding, padding, padding)
);
// "Supported Types" group
BBox* typeBox = new BBox("typesBox");
typeBox->SetLabel(TR("Supported types"));
fTypeListView = new SupportedTypeListView("Suppported Types",
typeBox->SetLabel(B_TRANSLATE("Supported types"));
fTypeListView = new SupportedTypeListView("Suppported Types",
B_SINGLE_SELECTION_LIST);
fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));
BScrollView* scrollView = new BScrollView("type scrollview", fTypeListView,
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
fAddTypeButton = new BButton("add type", TR("Add" B_UTF8_ELLIPSIS),
new BMessage(kMsgAddType));
fRemoveTypeButton = new BButton("remove type", TR("Remove"),
fAddTypeButton = new BButton("add type",
B_TRANSLATE("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddType));
fRemoveTypeButton = new BButton("remove type", B_TRANSLATE("Remove"),
new BMessage(kMsgRemoveType));
fTypeIconView = new IconView("type icon");
BView* iconHolder = BGroupLayoutBuilder(B_HORIZONTAL).Add(fTypeIconView);
fTypeIconView->SetModificationMessage(new BMessage(kMsgTypeIconsChanged));
typeBox->AddChild(BGridLayoutBuilder(padding, padding)
.Add(scrollView, 0, 0, 1, 4)
.Add(fAddTypeButton, 1, 0, 1, 2)
@@ -361,46 +362,48 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
.SetColumnWeight(2, 1)
);
iconHolder->SetExplicitAlignment(BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
// "Version Info" group
BBox* versionBox = new BBox("versionBox");
versionBox->SetLabel(TR("Version info"));
fMajorVersionControl = new BTextControl(TR("Version:"), NULL, NULL);
versionBox->SetLabel(B_TRANSLATE("Version info"));
fMajorVersionControl = new BTextControl(B_TRANSLATE("Version:"),
NULL, NULL);
_MakeNumberTextControl(fMajorVersionControl);
fMiddleVersionControl = new BTextControl(".", NULL, NULL);
_MakeNumberTextControl(fMiddleVersionControl);
fMinorVersionControl = new BTextControl(".", NULL, NULL);
_MakeNumberTextControl(fMinorVersionControl);
fVarietyMenu = new BPopUpMenu("variety", true, true);
fVarietyMenu->AddItem(new BMenuItem(TR("Development"), NULL));
fVarietyMenu->AddItem(new BMenuItem(TR("Alpha"), NULL));
fVarietyMenu->AddItem(new BMenuItem(TR("Beta"), NULL));
fVarietyMenu->AddItem(new BMenuItem(TR("Gamma"), NULL));
item = new BMenuItem(TR("Golden master"), NULL);
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Development"), NULL));
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Alpha"), NULL));
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Beta"), NULL));
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Gamma"), NULL));
item = new BMenuItem(B_TRANSLATE("Golden master"), NULL);
fVarietyMenu->AddItem(item);
item->SetMarked(true);
fVarietyMenu->AddItem(new BMenuItem(TR("Final"), NULL));
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Final"), NULL));
BMenuField* varietyField = new BMenuField("", fVarietyMenu);
fInternalVersionControl = new BTextControl("/", NULL, NULL);
fShortDescriptionControl =
new BTextControl(TR("Short description:"), NULL, NULL);
fShortDescriptionControl =
new BTextControl(B_TRANSLATE("Short description:"), NULL, NULL);
// TODO: workaround for a GCC 4.1.0 bug? Or is that really what the standard says?
version_info versionInfo;
fShortDescriptionControl->TextView()->SetMaxBytes(
sizeof(versionInfo.short_info));
BStringView* longLabel = new BStringView(NULL, TR("Long description:"));
BStringView* longLabel = new BStringView(NULL,
B_TRANSLATE("Long description:"));
longLabel->SetExplicitAlignment(labelAlignment);
fLongDescriptionView = new TabFilteringTextView("long desc");
fLongDescriptionView->SetMaxBytes(sizeof(versionInfo.long_info));
scrollView = new BScrollView("desc scrollview", fLongDescriptionView,
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
@@ -408,7 +411,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
BSize minScrollSize = scrollView->ScrollBar(B_VERTICAL)->MinSize();
minScrollSize.width+=fLongDescriptionView->MinSize().width;
scrollView->SetExplicitMinSize(minScrollSize);
versionBox->AddChild(BGridLayoutBuilder(padding, padding)
.Add(fMajorVersionControl->CreateLabelLayoutItem(), 0, 0)
.Add(fMajorVersionControl->CreateTextViewLayoutItem(), 1, 0)
@@ -566,7 +569,7 @@ ApplicationTypeWindow::_SetTo(const BEntry& entry)
fRemoveTypeButton->SetEnabled(false);
// version info
char text[256];
snprintf(text, sizeof(text), "%ld", versionInfo.major);
fMajorVersionControl->SetText(text);
@@ -979,9 +982,10 @@ bool
ApplicationTypeWindow::QuitRequested()
{
if (_NeedsSaving(CHECK_ALL) != 0) {
BAlert* alert = new BAlert(TR("Save request"), TR("Do you want to "
"save the changes?"), TR("Quit, don't save"), TR("Cancel"),
TR("Save"), B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert(B_TRANSLATE("Save request"),
B_TRANSLATE("Do you want to save the changes?"),
B_TRANSLATE("Quit, don't save"), B_TRANSLATE("Cancel"),
B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_WARNING_ALERT);
int32 choice = alert->Go();
switch (choice) {
case 0:
@@ -63,7 +63,7 @@ const uint32 kMsgRemoveUninstalled = 'runs';
const uint32 kMsgEdit = 'edit';
const char*
const char*
variety_to_text(uint32 variety)
{
#if defined(HAIKU_TARGET_PLATFORM_BEOS) || defined(HAIKU_TARGET_PLATFORM_BONE)
@@ -77,17 +77,17 @@ variety_to_text(uint32 variety)
switch (variety) {
case B_DEVELOPMENT_VERSION:
return TR("Development");
return B_TRANSLATE("Development");
case B_ALPHA_VERSION:
return TR("Alpha");
return B_TRANSLATE("Alpha");
case B_BETA_VERSION:
return TR("Beta");
return B_TRANSLATE("Beta");
case B_GAMMA_VERSION:
return TR("Gamma");
return B_TRANSLATE("Gamma");
case B_GOLDEN_MASTER_VERSION:
return TR("Golden master");
return B_TRANSLATE("Golden master");
case B_FINAL_VERSION:
return TR("Final");
return B_TRANSLATE("Final");
}
return "-";
@@ -100,8 +100,8 @@ variety_to_text(uint32 variety)
ProgressWindow::ProgressWindow(const char* message,
int32 max, volatile bool* signalQuit)
:
BWindow(BRect(0, 0, 300, 200), TR("Progress"), B_MODAL_WINDOW_LOOK,
B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS |
BWindow(BRect(0, 0, 300, 200), B_TRANSLATE("Progress"), B_MODAL_WINDOW_LOOK,
B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS |
B_NOT_V_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fQuitListener(signalQuit)
{
@@ -110,8 +110,9 @@ ProgressWindow::ProgressWindow(const char* message,
fStatusBar = new BStatusBar("status", message, count);
fStatusBar->SetMaxValue(max);
fAbortButton = new BButton("abort", TR("Abort"), new BMessage(B_CANCEL));
fAbortButton = new BButton("abort", B_TRANSLATE("Abort"),
new BMessage(B_CANCEL));
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 3.0f)
.Add(fStatusBar)
@@ -121,7 +122,7 @@ ProgressWindow::ProgressWindow(const char* message,
// center on screen
BScreen screen(this);
MoveTo(screen.Frame().left + (screen.Frame().Width()
MoveTo(screen.Frame().left + (screen.Frame().Width()
- Bounds().Width()) / 2.0f,
screen.Frame().top + (screen.Frame().Height()
- Bounds().Height()) / 2.0f);
@@ -161,13 +162,14 @@ ProgressWindow::MessageReceived(BMessage* message)
ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
: BWindow(_Frame(settings), TR("Application types"), B_TITLED_WINDOW,
: BWindow(_Frame(settings), B_TRANSLATE("Application types"),
B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
float padding = 3.0f;
BAlignment labelAlignment = BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP);
BAlignment fullWidthTopAlignment =
BAlignment fullWidthTopAlignment =
BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP);
if (be_control_look) {
// padding = be_control_look->DefaultItemSpacing();
@@ -185,7 +187,7 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
BScrollView* scrollView = new BScrollView("scrollview", fTypeListView,
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
BButton* button = new BButton("remove", TR("Remove uninstalled"),
BButton* button = new BButton("remove", B_TRANSLATE("Remove uninstalled"),
new BMessage(kMsgRemoveUninstalled));
SetLayout(BGroupLayoutBuilder(B_HORIZONTAL));
@@ -193,16 +195,16 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
// "Information" group
BBox* infoBox = new BBox((char*)NULL);
infoBox->SetLabel(TR("Information"));
infoBox->SetLabel(B_TRANSLATE("Information"));
infoBox->SetExplicitAlignment(fullWidthTopAlignment);
fNameView = new StringView(TR("Name:"), NULL);
fNameView = new StringView(B_TRANSLATE("Name:"), NULL);
fNameView->TextView()->SetExplicitAlignment(labelAlignment);
fNameView->LabelView()->SetExplicitAlignment(labelAlignment);
fSignatureView = new StringView(TR("Signature:"), NULL);
fSignatureView = new StringView(B_TRANSLATE("Signature:"), NULL);
fSignatureView->TextView()->SetExplicitAlignment(labelAlignment);
fSignatureView->LabelView()->SetExplicitAlignment(labelAlignment);
fPathView = new StringView(TR("Path:"), NULL);
fPathView = new StringView(B_TRANSLATE("Path:"), NULL);
fPathView->TextView()->SetExplicitAlignment(labelAlignment);
fPathView->LabelView()->SetExplicitAlignment(labelAlignment);
@@ -220,20 +222,20 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
// "Version" group
BBox* versionBox = new BBox("");
versionBox->SetLabel(TR("Version"));
versionBox->SetLabel(B_TRANSLATE("Version"));
versionBox->SetExplicitAlignment(fullWidthTopAlignment);
fVersionView = new StringView(TR("Version:"), NULL);
fVersionView = new StringView(B_TRANSLATE("Version:"), NULL);
fVersionView->TextView()->SetExplicitAlignment(labelAlignment);
fVersionView->LabelView()->SetExplicitAlignment(labelAlignment);
fDescriptionLabel = new StringView(TR("Description:"), NULL);
fDescriptionLabel = new StringView(B_TRANSLATE("Description:"), NULL);
fDescriptionLabel->LabelView()->SetExplicitAlignment(labelAlignment);
fDescriptionView = new BTextView("description");
fDescriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fDescriptionView->SetLowColor(fDescriptionView->ViewColor());
fDescriptionView->MakeEditable(false);
versionBox->AddChild(currentView =
versionBox->AddChild(currentView =
BGridLayoutBuilder(padding, padding)
.Add(fVersionView->LabelView(), 0, 0)
.Add(fVersionView->TextView(), 1, 0)
@@ -245,10 +247,12 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
// Launch and Tracker buttons
fEditButton = new BButton(TR("Edit" B_UTF8_ELLIPSIS), new BMessage(kMsgEdit));
fEditButton = new BButton(B_TRANSLATE("Edit" B_UTF8_ELLIPSIS),
new BMessage(kMsgEdit));
// launch and tracker buttons get messages in _SetType()
fLaunchButton = new BButton(TR("Launch"));
fTrackerButton = new BButton(TR("Show in Tracker" B_UTF8_ELLIPSIS));
fLaunchButton = new BButton(B_TRANSLATE("Launch"));
fTrackerButton = new BButton(
B_TRANSLATE("Show in Tracker" B_UTF8_ELLIPSIS));
AddChild(BGroupLayoutBuilder(B_HORIZONTAL, padding)
.Add(BGroupLayoutBuilder(B_VERTICAL, padding)
@@ -300,8 +304,9 @@ ApplicationTypesWindow::_RemoveUninstalled()
int32 removed = 0;
volatile bool quit = false;
BWindow* progressWindow =
new ProgressWindow(TR("Removing uninstalled application types"),
BWindow* progressWindow =
new ProgressWindow(
B_TRANSLATE("Removing uninstalled application types"),
fTypeListView->FullListCountItems(), &quit);
progressWindow->AddToSubset(this);
progressWindow->Show();
@@ -356,8 +361,9 @@ ApplicationTypesWindow::_RemoveUninstalled()
char message[512];
// TODO: Use ICU to properly format this.
snprintf(message, sizeof(message), TR("%ld Application type%s could be "
"removed."), removed, removed == 1 ? "" : "s");
snprintf(message, sizeof(message),
B_TRANSLATE("%ld Application type%s could be removed."),
removed, removed == 1 ? "" : "s");
error_alert(message, B_OK, B_INFO_ALERT);
}
@@ -394,7 +400,7 @@ ApplicationTypesWindow::_SetType(BMimeType* type, int32 forceUpdate)
if ((forceUpdate & B_APP_HINT_CHANGED) != 0
&& be_roster->FindApp(fCurrentType.Type(), &ref) == B_OK) {
// Set launch message
BMessenger tracker("application/x-vnd.Be-TRAK");
BMessenger tracker("application/x-vnd.Be-TRAK");
BMessage* message = new BMessage(B_REFS_RECEIVED);
message->AddRef("refs", &ref);
@@ -410,7 +416,7 @@ ApplicationTypesWindow::_SetType(BMimeType* type, int32 forceUpdate)
BEntry entry(path.Path());
entry_ref directoryRef;
if (entry.GetRef(&directoryRef) == B_OK) {
BMessenger tracker("application/x-vnd.Be-TRAK");
BMessenger tracker("application/x-vnd.Be-TRAK");
message = new BMessage(B_REFS_RECEIVED);
message->AddRef("refs", &directoryRef);
@@ -458,7 +464,7 @@ ApplicationTypesWindow::_SetType(BMimeType* type, int32 forceUpdate)
fNameView->SetEnabled(enabled);
fSignatureView->SetEnabled(enabled);
fPathView->SetEnabled(enabled);
fVersionView->SetEnabled(enabled);
fDescriptionLabel->SetEnabled(enabled);
@@ -504,11 +510,11 @@ ApplicationTypesWindow::MessageReceived(BMessage* message)
}
break;
}
case kMsgEdit:
fTypeListView->Invoke();
break;
case kMsgRemoveUninstalled:
_RemoveUninstalled();
break;
+30 -26
View File
@@ -96,9 +96,9 @@ display_as_parameter(const char* special)
AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
AttributeItem* attributeItem)
:
BWindow(BRect(100, 100, 350, 200), TR("Attribute"), B_MODAL_WINDOW_LOOK,
B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS
| B_ASYNCHRONOUS_CONTROLS),
BWindow(BRect(100, 100, 350, 200), B_TRANSLATE("Attribute"),
B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS),
fTarget(target),
fMimeType(mimeType.Type())
{
@@ -109,13 +109,13 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
if (attributeItem != NULL)
fAttribute = *attributeItem;
fPublicNameControl = new BTextControl(TR("Attribute name:"),
fPublicNameControl = new BTextControl(B_TRANSLATE("Attribute name:"),
fAttribute.PublicName(), NULL);
fPublicNameControl->SetModificationMessage(
new BMessage(kMsgAttributeUpdated));
fPublicNameControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
fAttributeControl = new BTextControl(TR("Internal name:"),
fAttributeControl = new BTextControl(B_TRANSLATE("Internal name:"),
fAttribute.Name(), NULL);
fAttributeControl->SetModificationMessage(
new BMessage(kMsgAttributeUpdated));
@@ -141,11 +141,11 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
item->SetMarked(true);
}
BMenuField* typeMenuField = new BMenuField("types" , TR("Type:"),
BMenuField* typeMenuField = new BMenuField("types" , B_TRANSLATE("Type:"),
fTypeMenu);
typeMenuField->SetAlignment(B_ALIGN_RIGHT);
fVisibleCheckBox = new BCheckBox("visible", TR("Visible"),
fVisibleCheckBox = new BCheckBox("visible", B_TRANSLATE("Visible"),
new BMessage(kMsgVisibilityChanged));
fVisibleCheckBox->SetValue(fAttribute.Visible());
@@ -167,16 +167,17 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
}
fDisplayAsMenuField = new BMenuField("display as",
TR_CMT("Display as:", "Tracker offers different display modes for "
"attributes."), menu);
B_TRANSLATE_COMMENT("Display as:",
"Tracker offers different display modes for attributes."), menu);
fDisplayAsMenuField->SetAlignment(B_ALIGN_RIGHT);
fEditableCheckBox = new BCheckBox("editable", TR_CMT("Editable",
"If Tracker allows to edit this attribute."),
fEditableCheckBox = new BCheckBox("editable",
B_TRANSLATE_COMMENT("Editable",
"If Tracker allows to edit this attribute."),
new BMessage(kMsgAttributeUpdated));
fEditableCheckBox->SetValue(fAttribute.Editable());
fSpecialControl = new BTextControl(TR("Special:"),
fSpecialControl = new BTextControl(B_TRANSLATE("Special:"),
display_as_parameter(fAttribute.DisplayAs()), NULL);
fSpecialControl->SetModificationMessage(
new BMessage(kMsgAttributeUpdated));
@@ -185,8 +186,9 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
char text[64];
snprintf(text, sizeof(text), "%ld", fAttribute.Width());
fWidthControl = new BTextControl(TR_CMT("Width:",
"Default column width in Tracker for this attribute."), text, NULL);
fWidthControl = new BTextControl(B_TRANSLATE_COMMENT("Width:",
"Default column width in Tracker for this attribute."),
text, NULL);
fWidthControl->SetModificationMessage(
new BMessage(kMsgAttributeUpdated));
fWidthControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
@@ -203,12 +205,12 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
int32 alignment;
const char* name;
} kAlignmentMap[] = {
{B_ALIGN_LEFT, TR_CMT("Left", "Attribute column alignment in "
"Tracker")},
{B_ALIGN_RIGHT, TR_CMT("Right", "Attribute column alignment in "
"Tracker")},
{B_ALIGN_CENTER, TR_CMT("Center", "Attribute column alignment in "
"Tracker")},
{B_ALIGN_LEFT, B_TRANSLATE_COMMENT("Left",
"Attribute column alignment in Tracker")},
{B_ALIGN_RIGHT, B_TRANSLATE_COMMENT("Right",
"Attribute column alignment in Tracker")},
{B_ALIGN_CENTER, B_TRANSLATE_COMMENT("Center",
"Attribute column alignment in Tracker")},
{0, NULL}
};
@@ -225,14 +227,15 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
}
fAlignmentMenuField = new BMenuField("alignment",
TR("Alignment:"), menu);
B_TRANSLATE("Alignment:"), menu);
fAlignmentMenuField->SetAlignment(B_ALIGN_RIGHT);
fAcceptButton = new BButton("add", item ? TR("Done") : TR("Add"),
fAcceptButton = new BButton("add", item
? B_TRANSLATE("Done") : B_TRANSLATE("Add"),
new BMessage(kMsgAccept));
fAcceptButton->SetEnabled(false);
BButton* cancelButton = new BButton("cancel", TR("Cancel"),
BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(B_QUIT_REQUESTED));
BBox* visibleBox;
@@ -247,7 +250,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
.Add(typeMenuField->CreateLabelLayoutItem(), 0, 2)
.Add(typeMenuField->CreateMenuBarLayoutItem(), 1, 2)
)
.Add(visibleBox = new BBox(B_FANCY_BORDER,
.Add(visibleBox = new BBox(B_FANCY_BORDER,
BGridLayoutBuilder(padding, padding)
.Add(fDisplayAsMenuField->CreateLabelLayoutItem(), 0, 0)
.Add(fDisplayAsMenuField->CreateMenuBarLayoutItem(), 1, 0)
@@ -467,7 +470,7 @@ AttributeWindow::MessageReceived(BMessage* message)
newAttributes.AddInt32("attr:width", item->Width());
newAttributes.AddBool("attr:viewable", item->Visible());
newAttributes.AddBool("attr:editable", item->Editable());
delete item;
}
@@ -475,7 +478,8 @@ AttributeWindow::MessageReceived(BMessage* message)
}
if (status != B_OK)
error_alert(TR("Could not change attributes"), status);
error_alert(B_TRANSLATE("Could not change attributes"),
status);
PostMessage(B_QUIT_REQUESTED);
break;
+11 -7
View File
@@ -112,8 +112,9 @@ replace_extension(BMimeType& type, const char* newExtension,
ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
const char* extension)
: BWindow(BRect(100, 100, 350, 200), TR("Extension"), B_MODAL_WINDOW_LOOK,
B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_RESIZABLE
: BWindow(BRect(100, 100, 350, 200), B_TRANSLATE("Extension"),
B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
fTarget(target),
fMimeType(type.Type()),
@@ -125,8 +126,9 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
//if (be_control_look)
// padding = be_control_look->DefaultItemSpacing();
// this seems to be very large!
fExtensionControl = new BTextControl(TR("Extension:"), extension, NULL);
fExtensionControl = new BTextControl(B_TRANSLATE("Extension:"),
extension, NULL);
fExtensionControl->SetModificationMessage(
new BMessage(kMsgExtensionUpdated));
fExtensionControl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_LEFT);
@@ -138,11 +140,12 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
textView->DisallowChar(disallowedCharacters[i]);
}
fAcceptButton = new BButton(extension ? TR("Done") : TR("Add"),
fAcceptButton = new BButton(extension
? B_TRANSLATE("Done") : B_TRANSLATE("Add"),
new BMessage(kMsgAccept));
fAcceptButton->SetEnabled(false);
BButton* button = new BButton(TR("Cancel"),
BButton* button = new BButton(B_TRANSLATE("Cancel"),
new BMessage(B_QUIT_REQUESTED));
AddChild(BGridLayoutBuilder(padding, padding)
@@ -199,7 +202,8 @@ ExtensionWindow::MessageReceived(BMessage* message)
status_t status = replace_extension(fMimeType, newExtension,
fExtension.String());
if (status != B_OK)
error_alert(TR("Could not change file extensions"), status);
error_alert(B_TRANSLATE("Could not change file extensions"),
status);
PostMessage(B_QUIT_REQUESTED);
break;
+21 -18
View File
@@ -51,9 +51,9 @@ const uint32 kMsgSamePreferredAppAsOpened = 'spaO';
FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
:
BWindow(BRect(0.0f, 0.0f, 200.0f, 200.0f).OffsetBySelf(position),
TR("File type"), B_TITLED_WINDOW,
B_NOT_V_RESIZABLE | B_NOT_ZOOMABLE |
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
B_TRANSLATE("File type"), B_TITLED_WINDOW,
B_NOT_V_RESIZABLE | B_NOT_ZOOMABLE
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
float padding = 3.0f;
// if (be_control_look)
@@ -62,7 +62,7 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
// "File Type" group
BBox* fileTypeBox = new BBox("file type BBox");
fileTypeBox->SetLabel(TR("File type"));
fileTypeBox->SetLabel(B_TRANSLATE("File type"));
fTypeControl = new BTextControl("type", NULL, "Type Control",
new BMessage(kMsgTypeEntered));
@@ -75,10 +75,10 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
}
fSelectTypeButton = new BButton("select type",
TR("Select" B_UTF8_ELLIPSIS), new BMessage(kMsgSelectType));
B_TRANSLATE("Select" B_UTF8_ELLIPSIS), new BMessage(kMsgSelectType));
fSameTypeAsButton = new BButton("same type as",
TR("Same as" B_UTF8_ELLIPSIS), new BMessage(kMsgSameTypeAs));
B_TRANSLATE("Same as" B_UTF8_ELLIPSIS), new BMessage(kMsgSameTypeAs));
fileTypeBox->AddChild(BGridLayoutBuilder(padding, padding)
.Add(fTypeControl, 0, 0, 2, 1)
@@ -90,7 +90,7 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
// "Icon" group
BBox* iconBox = new BBox("icon BBox");
iconBox->SetLabel(TR("Icon"));
iconBox->SetLabel(B_TRANSLATE("Icon"));
fIconView = new IconView("icon");
iconBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
.Add(fIconView)
@@ -99,20 +99,22 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
// "Preferred Application" group
BBox* preferredBox = new BBox("preferred BBox");
preferredBox->SetLabel(TR("Preferred application"));
preferredBox->SetLabel(B_TRANSLATE("Preferred application"));
BMenu* menu = new BPopUpMenu("preferred");
BMenuItem* item;
menu->AddItem(item = new BMenuItem(TR("Default application"),
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Default application"),
new BMessage(kMsgPreferredAppChosen)));
item->SetMarked(true);
fPreferredField = new BMenuField("preferred", NULL, menu);
fSelectAppButton = new BButton("select app", TR("Select" B_UTF8_ELLIPSIS),
fSelectAppButton = new BButton("select app",
B_TRANSLATE("Select" B_UTF8_ELLIPSIS),
new BMessage(kMsgSelectPreferredApp));
fSameAppAsButton = new BButton("same app as", TR("Same as" B_UTF8_ELLIPSIS),
fSameAppAsButton = new BButton("same app as",
B_TRANSLATE("Same as" B_UTF8_ELLIPSIS),
new BMessage(kMsgSamePreferredAppAs));
preferredBox->AddChild(BGridLayoutBuilder(padding, padding)
@@ -173,13 +175,13 @@ FileTypeWindow::_Title(const BMessage& refs)
if (same && parent.GetName(name) == B_OK) {
char buffer[512];
snprintf(buffer, sizeof(buffer),
TR("Multiple files from \"%s\" file type"), name);
B_TRANSLATE("Multiple files from \"%s\" file type"), name);
title = buffer;
} else
title = TR("[Multiple files] file types");
title = B_TRANSLATE("[Multiple files] file types");
} else if (refs.FindRef("refs", 0, &ref) == B_OK) {
char buffer[512];
snprintf(buffer, sizeof(buffer), TR("%s file type"), ref.name);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("%s file type"), ref.name);
title = buffer;
}
@@ -265,7 +267,7 @@ FileTypeWindow::_AdoptType(BMessage* message)
}
if (status != B_OK) {
error_alert(TR("Could not open file"), status);
error_alert(B_TRANSLATE("Could not open file"), status);
return;
}
@@ -362,7 +364,7 @@ FileTypeWindow::MessageReceived(BMessage* message)
case kMsgSameTypeAs:
{
BMessage panel(kMsgOpenFilePanel);
panel.AddString("title", TR("Select same type as"));
panel.AddString("title", B_TRANSLATE("Select same type as"));
panel.AddInt32("message", kMsgSameTypeAsOpened);
panel.AddMessenger("target", this);
@@ -390,7 +392,8 @@ FileTypeWindow::MessageReceived(BMessage* message)
case kMsgSelectPreferredApp:
{
BMessage panel(kMsgOpenFilePanel);
panel.AddString("title", TR("Select preferred application"));
panel.AddString("title",
B_TRANSLATE("Select preferred application"));
panel.AddInt32("message", kMsgPreferredAppOpened);
panel.AddMessenger("target", this);
@@ -405,7 +408,7 @@ FileTypeWindow::MessageReceived(BMessage* message)
{
BMessage panel(kMsgOpenFilePanel);
panel.AddString("title",
TR("Select same preferred application as"));
B_TRANSLATE("Select same preferred application as"));
panel.AddInt32("message", kMsgSamePreferredAppAsOpened);
panel.AddMessenger("target", this);
+13 -13
View File
@@ -139,7 +139,7 @@ Settings::_Open(BFile *file, int32 mode)
}
void
void
Settings::UpdateFrom(BMessage *message)
{
BRect frame;
@@ -216,12 +216,12 @@ FileTypes::RefsReceived(BMessage *message)
char buffer[1024];
snprintf(buffer, sizeof(buffer),
TR("Could not open \"%s\":\n"
B_TRANSLATE("Could not open \"%s\":\n"
"%s"),
ref.name, strerror(status));
(new BAlert(TR("FileTypes request"),
buffer, TR("OK"), NULL, NULL,
(new BAlert(B_TRANSLATE("FileTypes request"),
buffer, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
message->RemoveData("refs", --index);
@@ -282,7 +282,7 @@ FileTypes::ArgvReceived(int32 argc, char **argv)
path.SetTo(&currentDirectory, argv[i]);
status_t status;
entry_ref ref;
entry_ref ref;
BEntry entry;
if ((status = entry.SetTo(path.Path(), false)) != B_OK
@@ -356,7 +356,7 @@ FileTypes::MessageReceived(BMessage *message)
// the open file panel sends us a message when it's done
const char* subTitle;
if (message->FindString("title", &subTitle) != B_OK)
subTitle = TR("Open file");
subTitle = B_TRANSLATE("Open file");
int32 what;
if (message->FindInt32("message", &what) != B_OK)
@@ -366,7 +366,7 @@ FileTypes::MessageReceived(BMessage *message)
if (message->FindMessenger("target", &target) != B_OK)
target = be_app_messenger;
BString title = TR("FileTypes");
BString title = B_TRANSLATE("FileTypes");
if (subTitle != NULL && subTitle[0]) {
title.Append(": ");
title.Append(subTitle);
@@ -407,12 +407,12 @@ FileTypes::MessageReceived(BMessage *message)
void
FileTypes::AboutRequested()
{
BString aboutText(TR("FileTypes"));
BString aboutText(B_TRANSLATE("FileTypes"));
int32 titleLength = aboutText.Length();
aboutText << "\n";
aboutText << TR("\twritten by Axel Dörfler\n"
aboutText << B_TRANSLATE("\twritten by Axel Dörfler\n"
"\tCopyright 2006-2007, Haiku.\n");
BAlert *alert = new BAlert("about", aboutText.String(), TR("OK"));
BAlert *alert = new BAlert("about", aboutText.String(), B_TRANSLATE("OK"));
BTextView *view = alert->TextView();
BFont font;
@@ -420,7 +420,7 @@ FileTypes::AboutRequested()
view->GetFont(&font);
font.SetSize(18);
font.SetFace(B_BOLD_FACE);
font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, titleLength, &font);
alert->Go();
@@ -462,9 +462,9 @@ error_alert(const char* message, status_t status, alert_type type)
strerror(status));
}
(new BAlert(TR("FileTypes request"),
(new BAlert(B_TRANSLATE("FileTypes request"),
status == B_OK ? message : warning,
TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, type))->Go();
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, type))->Go();
}
+67 -59
View File
@@ -137,13 +137,13 @@ TypeIconView::Draw(BRect updateRect)
switch (IconSource()) {
case kNoIcon:
text = TR("no icon");
text = B_TRANSLATE("no icon");
break;
case kApplicationIcon:
text = TR("(from application)");
text = B_TRANSLATE("(from application)");
break;
case kSupertypeIcon:
text = TR("(from super type)");
text = B_TRANSLATE("(from super type)");
break;
default:
@@ -172,8 +172,8 @@ void
TypeIconView::GetPreferredSize(float* _width, float* _height)
{
if (_width) {
float a = StringWidth(TR("(from application)"));
float b = StringWidth(TR("(from super type)"));
float a = StringWidth(B_TRANSLATE("(from application)"));
float b = StringWidth(B_TRANSLATE("(from super type)"));
float width = max_c(a, b);
if (width < IconSize())
width = IconSize();
@@ -199,7 +199,7 @@ TypeIconView::BitmapRect() const
font_height fontHeight;
GetFontHeight(&fontHeight);
float width = StringWidth(TR("no icon")) + 8.0f;
float width = StringWidth(B_TRANSLATE("no icon")) + 8.0f;
float height = ceilf(fontHeight.ascent + fontHeight.descent) + 6.0f;
float x = (Bounds().Width() - width) / 2.0f;
float y = ceilf((IconSize() - fontHeight.ascent - fontHeight.descent)
@@ -286,7 +286,7 @@ ExtensionListView::SetType(BMimeType* type)
FileTypesWindow::FileTypesWindow(const BMessage& settings)
:
BWindow(_Frame(settings), TR("FileTypes"), B_TITLED_WINDOW,
BWindow(_Frame(settings), B_TRANSLATE("FileTypes"), B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
fNewTypeWindow(NULL)
{
@@ -305,46 +305,48 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
// this seems to be very large!
labelAlignment = be_control_look->DefaultLabelAlignment();
}
BAlignment fullAlignment =
BAlignment fullAlignment =
BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT);
// add the menu
BMenuBar* menuBar = new BMenuBar("");
BMenu* menu = new BMenu(TR("File"));
BMenu* menu = new BMenu(B_TRANSLATE("File"));
BMenuItem* item;
menu->AddItem(item = new BMenuItem(TR("New resource file" B_UTF8_ELLIPSIS),
menu->AddItem(item = new BMenuItem(
B_TRANSLATE("New resource file" B_UTF8_ELLIPSIS),
NULL, 'N', B_COMMAND_KEY));
item->SetEnabled(false);
BMenu* recentsMenu = BRecentFilesList::NewFileListMenu(
TR("Open" B_UTF8_ELLIPSIS), NULL, NULL, be_app, 10, false, NULL,
kSignature);
B_TRANSLATE("Open" B_UTF8_ELLIPSIS), NULL, NULL,
be_app, 10, false, NULL, kSignature);
item = new BMenuItem(recentsMenu, new BMessage(kMsgOpenFilePanel));
item->SetShortcut('O', B_COMMAND_KEY);
menu->AddItem(item);
menu->AddItem(new BMenuItem(TR("Application types" B_UTF8_ELLIPSIS),
menu->AddItem(new BMenuItem(
B_TRANSLATE("Application types" B_UTF8_ELLIPSIS),
new BMessage(kMsgOpenApplicationTypesWindow)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(TR("About FileTypes" B_UTF8_ELLIPSIS),
menu->AddItem(new BMenuItem(B_TRANSLATE("About FileTypes" B_UTF8_ELLIPSIS),
new BMessage(B_ABOUT_REQUESTED)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(TR("Quit"), new BMessage(B_QUIT_REQUESTED),
'Q', B_COMMAND_KEY));
menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY));
menu->SetTargetForItems(be_app);
menuBar->AddItem(menu);
menu = new BMenu(TR("Settings"));
item = new BMenuItem(TR("Show icons in list"),
menu = new BMenu(B_TRANSLATE("Settings"));
item = new BMenuItem(B_TRANSLATE("Show icons in list"),
new BMessage(kMsgToggleIcons));
item->SetMarked(showIcons);
item->SetTarget(this);
menu->AddItem(item);
item = new BMenuItem(TR("Show recognition rule"),
item = new BMenuItem(B_TRANSLATE("Show recognition rule"),
new BMessage(kMsgToggleRule));
item->SetMarked(showRule);
item->SetTarget(this);
@@ -355,10 +357,10 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
menuBar->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
// MIME Types list
BButton* addTypeButton = new BButton("add", TR("Add" B_UTF8_ELLIPSIS),
new BMessage(kMsgAddType));
BButton* addTypeButton = new BButton("add",
B_TRANSLATE("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddType));
fRemoveTypeButton = new BButton("remove", TR("Remove"),
fRemoveTypeButton = new BButton("remove", B_TRANSLATE("Remove"),
new BMessage(kMsgRemoveType) );
fTypeListView = new MimeTypeListView("typeview", NULL, showIcons, false);
@@ -371,7 +373,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
fIconView = new TypeIconView("icon");
fIconBox = new BBox("Icon BBox");
fIconBox->SetLabel(TR("Icon"));
fIconBox->SetLabel(B_TRANSLATE("Icon"));
fIconBox->AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
.Add(BSpaceLayoutItem::CreateGlue(), 1)
.Add(fIconView, 3)
@@ -382,16 +384,16 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
// "File Recognition" group
fRecognitionBox = new BBox("Recognition Box");
fRecognitionBox->SetLabel(TR("File recognition"));
fRecognitionBox->SetLabel(B_TRANSLATE("File recognition"));
fRecognitionBox->SetExplicitAlignment(fullAlignment);
fExtensionLabel = new StringView(TR("Extensions:"), NULL);
fExtensionLabel = new StringView(B_TRANSLATE("Extensions:"), NULL);
fExtensionLabel->LabelView()->SetExplicitAlignment(labelAlignment);
fAddExtensionButton = new BButton("add ext", TR("Add" B_UTF8_ELLIPSIS),
new BMessage(kMsgAddExtension));
fAddExtensionButton = new BButton("add ext",
B_TRANSLATE("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddExtension));
fRemoveExtensionButton = new BButton("remove ext", TR("Remove"),
fRemoveExtensionButton = new BButton("remove ext", B_TRANSLATE("Remove"),
new BMessage(kMsgRemoveExtension));
fExtensionListView = new ExtensionListView("listview ext",
@@ -401,15 +403,15 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
fExtensionListView->SetInvocationMessage(
new BMessage(kMsgExtensionInvoked));
BScrollView* scrollView = new BScrollView("scrollview ext",
BScrollView* scrollView = new BScrollView("scrollview ext",
fExtensionListView, B_FRAME_EVENTS | B_WILL_DRAW, false, true);
fRuleControl = new BTextControl("rule", TR("Rule:"), "",
fRuleControl = new BTextControl("rule", B_TRANSLATE("Rule:"), "",
new BMessage(kMsgRuleEntered));
fRuleControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
fRuleControl->Hide();
BView* recognitionBoxGrid =
BView* recognitionBoxGrid =
BGridLayoutBuilder(padding, padding)
.Add(fExtensionLabel->LabelView(), 0, 0)
.Add(scrollView, 0, 1, 2, 3)
@@ -424,15 +426,15 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
// "Description" group
fDescriptionBox = new BBox("description BBox");
fDescriptionBox->SetLabel(TR("Description"));
fDescriptionBox->SetLabel(B_TRANSLATE("Description"));
fDescriptionBox->SetExplicitAlignment(fullAlignment);
fInternalNameView = new StringView(TR("Internal name:"), NULL);
fInternalNameView = new StringView(B_TRANSLATE("Internal name:"), NULL);
fInternalNameView->SetEnabled(false);
fTypeNameControl = new BTextControl("type", TR("Type name:"), "",
fTypeNameControl = new BTextControl("type", B_TRANSLATE("Type name:"), "",
new BMessage(kMsgTypeEntered));
fDescriptionControl = new BTextControl("description", TR("Description:"),
"", new BMessage(kMsgDescriptionEntered));
fDescriptionControl = new BTextControl("description",
B_TRANSLATE("Description:"), "", new BMessage(kMsgDescriptionEntered));
fDescriptionBox->AddChild(BGridLayoutBuilder(padding, padding)
.Add(fInternalNameView->LabelView(), 0, 0)
@@ -448,18 +450,20 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
// "Preferred Application" group
fPreferredBox = new BBox("preferred BBox");
fPreferredBox->SetLabel(TR("Preferred application"));
fPreferredBox->SetLabel(B_TRANSLATE("Preferred application"));
menu = new BPopUpMenu("preferred");
menu->AddItem(item = new BMenuItem(TR("None"),
menu->AddItem(item = new BMenuItem(B_TRANSLATE("None"),
new BMessage(kMsgPreferredAppChosen)));
item->SetMarked(true);
fPreferredField = new BMenuField("preferred", (char*)NULL, menu);
fSelectButton = new BButton("select", TR("Select" B_UTF8_ELLIPSIS),
fSelectButton = new BButton("select",
B_TRANSLATE("Select" B_UTF8_ELLIPSIS),
new BMessage(kMsgSelectPreferredApp));
fSameAsButton = new BButton("same as", TR("Same as" B_UTF8_ELLIPSIS),
fSameAsButton = new BButton("same as",
B_TRANSLATE("Same as" B_UTF8_ELLIPSIS),
new BMessage(kMsgSamePreferredAppAs));
fPreferredBox->AddChild(
@@ -472,12 +476,12 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
// "Extra Attributes" group
fAttributeBox = new BBox("Attribute Box");
fAttributeBox->SetLabel(TR("Extra attributes"));
fAttributeBox->SetLabel(B_TRANSLATE("Extra attributes"));
fAddAttributeButton = new BButton("add attr",
"Add" B_UTF8_ELLIPSIS, new BMessage(kMsgAddAttribute));
fRemoveAttributeButton = new BButton("remove attr", TR("Remove"),
fRemoveAttributeButton = new BButton("remove attr", B_TRANSLATE("Remove"),
new BMessage(kMsgRemoveAttribute));
fAttributeListView = new AttributeListView("listview attr");
@@ -497,7 +501,7 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
);
BView* topView =
BView* topView =
BGroupLayoutBuilder(B_HORIZONTAL, padding)
.SetInsets(padding, padding, padding, padding)
.Add(BGroupLayoutBuilder(B_VERTICAL, padding)
@@ -568,7 +572,7 @@ FileTypesWindow::_UpdateExtensions(BMimeType* type)
fExtensionListView->MakeEmpty();
// fill it again
if (type == NULL)
return;
@@ -601,7 +605,8 @@ FileTypesWindow::_AdoptPreferredApplication(BMessage* message, bool sameAs)
status_t status = fCurrentType.SetPreferredApp(preferred.String());
if (status != B_OK)
error_alert(TR("Could not set preferred application"), status);
error_alert(B_TRANSLATE("Could not set preferred application"),
status);
}
@@ -800,28 +805,29 @@ FileTypesWindow::MessageReceived(BMessage* message)
BAlert* alert;
if (fCurrentType.IsSupertypeOnly()) {
alert = new BPrivate::OverrideAlert(TR("FileTypes request"),
TR("Removing a super type cannot be reverted.\n"
alert = new BPrivate::OverrideAlert(
B_TRANSLATE("FileTypes request"),
B_TRANSLATE("Removing a super type cannot be reverted.\n"
"All file types that belong to this super type "
"will be lost!\n\n"
"Are you sure you want to do this? To remove the whole "
"group, hold down the Shift key and press \"Remove\"."),
TR("Remove"), B_SHIFT_KEY, TR("Cancel"), 0, NULL, 0,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
B_TRANSLATE("Remove"), B_SHIFT_KEY, B_TRANSLATE("Cancel"),
0, NULL, 0, B_WIDTH_AS_USUAL, B_STOP_ALERT);
} else {
alert = new BAlert(TR("FileTypes request"),
TR("Removing a file type cannot be reverted.\n"
alert = new BAlert(B_TRANSLATE("FileTypes request"),
B_TRANSLATE("Removing a file type cannot be reverted.\n"
"Are you sure you want to remove it?"),
TR("Remove"), TR("Cancel"), NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
B_TRANSLATE("Remove"), B_TRANSLATE("Cancel"),
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
}
if (alert->Go())
break;
status_t status = fCurrentType.Delete();
if (status != B_OK) {
fprintf(stderr, TR("Could not remove file type: %s\n"),
strerror(status));
fprintf(stderr, B_TRANSLATE(
"Could not remove file type: %s\n"), strerror(status));
}
break;
}
@@ -896,7 +902,8 @@ FileTypesWindow::MessageReceived(BMessage* message)
BString parseError;
if (BMimeType::CheckSnifferRule(fRuleControl->Text(),
&parseError) != B_OK) {
parseError.Prepend(TR("Recognition rule is not valid:\n\n"));
parseError.Prepend(
B_TRANSLATE("Recognition rule is not valid:\n\n"));
error_alert(parseError.String());
} else
fCurrentType.SetSnifferRule(fRuleControl->Text());
@@ -932,7 +939,8 @@ FileTypesWindow::MessageReceived(BMessage* message)
case kMsgSelectPreferredApp:
{
BMessage panel(kMsgOpenFilePanel);
panel.AddString("title", TR("Select preferred application"));
panel.AddString("title",
B_TRANSLATE("Select preferred application"));
panel.AddInt32("message", kMsgPreferredAppOpened);
panel.AddMessenger("target", this);
@@ -946,8 +954,8 @@ FileTypesWindow::MessageReceived(BMessage* message)
case kMsgSamePreferredAppAs:
{
BMessage panel(kMsgOpenFilePanel);
panel.AddString("title", TR("Select same preferred application "
"as"));
panel.AddString("title",
B_TRANSLATE("Select same preferred application as"));
panel.AddInt32("message", kMsgSamePreferredAppAsOpened);
panel.AddMessenger("target", this);
+9 -7
View File
@@ -582,7 +582,7 @@ IconView::MessageReceived(BMessage* message)
if (message->FindRef("refs", &ref) == B_OK)
_SetIcon(&ref);
}
delete large;
delete mini;
@@ -634,11 +634,11 @@ IconView::MessageReceived(BMessage* message)
case B_MIME_TYPE_DELETED:
Unset();
break;
case B_ICON_CHANGED:
Update();
break;
default:
break;
}
@@ -819,15 +819,17 @@ IconView::MouseDown(BPoint where)
bool hasIcon = fHasType ? fSource == kOwnIcon : fIcon != NULL;
if (hasIcon) {
menu->AddItem(new BMenuItem(TR("Edit icon" B_UTF8_ELLIPSIS),
menu->AddItem(new BMenuItem(
B_TRANSLATE("Edit icon" B_UTF8_ELLIPSIS),
new BMessage(kMsgEditIcon)));
} else {
menu->AddItem(new BMenuItem(TR("Add icon" B_UTF8_ELLIPSIS),
menu->AddItem(new BMenuItem(
B_TRANSLATE("Add icon" B_UTF8_ELLIPSIS),
new BMessage(kMsgAddIcon)));
}
BMenuItem* item = new BMenuItem(TR("Remove icon"),
new BMessage(kMsgRemoveIcon));
BMenuItem* item = new BMenuItem(
B_TRANSLATE("Remove icon"), new BMessage(kMsgRemoveIcon));
if (!hasIcon)
item->SetEnabled(false);
+17 -14
View File
@@ -42,9 +42,9 @@ const uint32 kMsgAddType = 'atyp';
NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target,
const char* currentType)
:
BWindow(BRect(100, 100, 350, 200), TR("New file type"), B_MODAL_WINDOW,
B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE | B_ASYNCHRONOUS_CONTROLS
| B_AUTO_UPDATE_SIZE_LIMITS ),
BWindow(BRect(100, 100, 350, 200), B_TRANSLATE("New file type"),
B_MODAL_WINDOW, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS ),
fTarget(target)
{
fSupertypesMenu = new BPopUpMenu("supertypes");
@@ -69,17 +69,17 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target,
fSupertypesMenu->AddSeparatorItem();
}
fSupertypesMenu->AddItem(new BMenuItem(TR("Add new group"),
fSupertypesMenu->AddItem(new BMenuItem(B_TRANSLATE("Add new group"),
new BMessage(kMsgNewSupertypeChosen)));
BMenuField* typesMenuField = new BMenuField(NULL, fSupertypesMenu);
BStringView* typesMenuLabel = new BStringView(NULL, TR("Group:"));
BStringView* typesMenuLabel = new BStringView(NULL, B_TRANSLATE("Group:"));
// Create a separate label view, otherwise things don't line up right
typesMenuLabel->SetAlignment(B_ALIGN_LEFT);
typesMenuLabel->SetExplicitAlignment(
BAlignment(B_ALIGN_LEFT, B_ALIGN_USE_FULL_HEIGHT));
fNameControl = new BTextControl(TR("Internal name:"), "", NULL);
fNameControl = new BTextControl(B_TRANSLATE("Internal name:"), "", NULL);
fNameControl->SetModificationMessage(new BMessage(kMsgNameUpdated));
// filter out invalid characters that can't be part of a MIME type name
@@ -89,7 +89,8 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target,
nameControlTextView->DisallowChar(disallowedCharacters[i]);
}
fAddButton = new BButton(TR("Add type"), new BMessage(kMsgAddType));
fAddButton = new BButton(B_TRANSLATE("Add type"),
new BMessage(kMsgAddType));
float padding = 3.0f;
// if (be_control_look)
@@ -103,7 +104,8 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target,
.Add(fNameControl->CreateLabelLayoutItem(), 0, 1)
.Add(fNameControl->CreateTextViewLayoutItem(), 1, 1, 2)
.Add(BSpaceLayoutItem::CreateGlue(), 0, 2)
.Add(new BButton(TR("Cancel"), new BMessage(B_QUIT_REQUESTED)), 1, 2)
.Add(new BButton(B_TRANSLATE("Cancel"),
new BMessage(B_QUIT_REQUESTED)), 1, 2)
.Add(fAddButton, 2, 2)
.SetColumnWeight(0, 3)
);
@@ -134,15 +136,15 @@ NewFileTypeWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
case kMsgSupertypeChosen:
fAddButton->SetLabel(TR("Add type"));
fNameControl->SetLabel(TR("Internal name:"));
fAddButton->SetLabel(B_TRANSLATE("Add type"));
fNameControl->SetLabel(B_TRANSLATE("Internal name:"));
fNameControl->MakeFocus(true);
InvalidateLayout(true);
break;
case kMsgNewSupertypeChosen:
fAddButton->SetLabel(TR("Add group"));
fNameControl->SetLabel(TR("Group name:"));
fAddButton->SetLabel(B_TRANSLATE("Add group"));
fNameControl->SetLabel(B_TRANSLATE("Group name:"));
fNameControl->MakeFocus(true);
InvalidateLayout(true);
break;
@@ -173,13 +175,14 @@ NewFileTypeWindow::MessageReceived(BMessage* message)
BMimeType mimeType(type.String());
if (mimeType.IsInstalled()) {
error_alert(TR("This file type already exists"));
error_alert(B_TRANSLATE("This file type already exists"));
break;
}
status_t status = mimeType.Install();
if (status != B_OK)
error_alert(TR("Could not install file type"), status);
error_alert(B_TRANSLATE("Could not install file type"),
status);
else {
BMessage update(kMsgSelectNewType);
update.AddString("type", type.String());
+12 -10
View File
@@ -125,7 +125,7 @@ update_preferred_app_menu(BMenu* menu, BMimeType* type, uint32 what,
}
// sort lists
subList.SortItems(compare_menu_items);
superList.SortItems(compare_menu_items);
@@ -227,7 +227,7 @@ retrieve_preferred_app(BMessage* message, bool sameAs, const char* forType,
if (status == B_OK) {
if (nodeInfo.GetPreferredApp(preferred) != B_OK)
preferred[0] = '\0';
if (!preferred[0]) {
// get MIME type from file
char type[B_MIME_TYPE_LENGTH];
@@ -248,14 +248,16 @@ retrieve_preferred_app(BMessage* message, bool sameAs, const char* forType,
}
if (status != B_OK) {
error_alert(TR("File could not be opened"), status, B_STOP_ALERT);
error_alert(B_TRANSLATE("File could not be opened"),
status, B_STOP_ALERT);
return status;
}
if (!preferred[0]) {
error_alert(sameAs
? TR("Could not retrieve preferred application of this file")
: TR("Could not retrieve application signature"));
? B_TRANSLATE("Could not retrieve preferred application of this "
"file")
: B_TRANSLATE("Could not retrieve application signature"));
return B_ERROR;
}
@@ -283,14 +285,14 @@ retrieve_preferred_app(BMessage* message, bool sameAs, const char* forType,
description[0] = '\0';
char warning[512];
snprintf(warning, sizeof(warning), TR("The application \"%s\" does "
"not support this file type.\n"
snprintf(warning, sizeof(warning), B_TRANSLATE("The application "
"\"%s\" does not support this file type.\n"
"Are you sure you want to set it anyway?"),
description[0] ? description : preferred);
BAlert* alert = new BAlert(TR("FileTypes request"), warning,
TR("Set Preferred Application"), TR("Cancel"), NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert(B_TRANSLATE("FileTypes request"), warning,
B_TRANSLATE("Set Preferred Application"), B_TRANSLATE("Cancel"),
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go() == 1)
return B_ERROR;
}
+6 -5
View File
@@ -28,7 +28,8 @@ const uint32 kMsgSelected = 'seld';
TypeListWindow::TypeListWindow(const char* currentType,
uint32 what, BWindow* target)
:
BWindow(BRect(100, 100, 360, 440), TR("Choose type"), B_MODAL_WINDOW,
BWindow(BRect(100, 100, 360, 440), B_TRANSLATE("Choose type"),
B_MODAL_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
fTarget(target),
fWhat(what)
@@ -38,11 +39,11 @@ TypeListWindow::TypeListWindow(const char* currentType,
// padding = be_control_look->DefaultItemSpacing();
// seems too big
fSelectButton = new BButton("select", TR("Done"),
fSelectButton = new BButton("select", B_TRANSLATE("Done"),
new BMessage(kMsgSelected));
fSelectButton->SetEnabled(false);
BButton* button = new BButton("cancel", TR("Cancel"),
BButton* button = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(B_CANCEL));
fSelectButton->MakeDefault(true);
@@ -57,14 +58,14 @@ TypeListWindow::TypeListWindow(const char* currentType,
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
.Add(scrollView)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
.Add(button)
.Add(fSelectButton)
)
.SetInsets(padding, padding, padding, padding)
);
BAlignment buttonAlignment =
BAlignment buttonAlignment =
BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_VERTICAL_CENTER);
button->SetExplicitAlignment(buttonAlignment);
fSelectButton->SetExplicitAlignment(buttonAlignment);