Author: pulkomandy Date: 2010-04-14 13:55:17 +0200 (Wed, 14 Apr 2010) New Revision: 36252 Changeset: http://dev.haiku-os.org/changeset/36252/haiku Modified: haiku/trunk/src/preferences/filetypes/ApplicationTypeWindow.cpp haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.cpp haiku/trunk/src/preferences/filetypes/AttributeWindow.cpp haiku/trunk/src/preferences/filetypes/ExtensionWindow.cpp haiku/trunk/src/preferences/filetypes/FileTypeWindow.cpp haiku/trunk/src/preferences/filetypes/FileTypes.cpp haiku/trunk/src/preferences/filetypes/FileTypesWindow.cpp haiku/trunk/src/preferences/filetypes/IconView.cpp haiku/trunk/src/preferences/filetypes/Jamfile haiku/trunk/src/preferences/filetypes/NewFileTypeWindow.cpp haiku/trunk/src/preferences/filetypes/PreferredAppMenu.cpp haiku/trunk/src/preferences/filetypes/TypeListWindow.cpp Log: Localize FileTypes. It does not use the layout kit yet, so the tranlation doesn't look perfect. Anyone willing to update it ? Modified: haiku/trunk/src/preferences/filetypes/ApplicationTypeWindow.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/ApplicationTypeWindow.cpp 2010-04-14 10:43:33 UTC (rev 36251) +++ haiku/trunk/src/preferences/filetypes/ApplicationTypeWindow.cpp 2010-04-14 11:55:17 UTC (rev 36252) @@ -16,8 +16,10 @@ #include <Bitmap.h> #include <Box.h> #include <Button.h> +#include <Catalog.h> #include <CheckBox.h> #include <File.h> +#include <Locale.h> #include <ListView.h> #include <MenuBar.h> #include <MenuField.h> @@ -36,6 +38,10 @@ #include <string.h> +#undef TR_CONTEXT +#define TR_CONTEXT "Application Type Window" + + const uint32 kMsgSave = 'save'; const uint32 kMsgSignatureChanged = 'sgch'; const uint32 kMsgToggleAppFlags = 'tglf'; @@ -229,7 +235,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entry) : BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position), - "Application Type", B_TITLED_WINDOW, + TR("Application Type"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS), fChangedProperties(0) { @@ -238,17 +244,17 @@ BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL); AddChild(menuBar); - BMenu* menu = new BMenu("File"); - fSaveMenuItem = new BMenuItem("Save", new BMessage(kMsgSave), 'S'); + BMenu* menu = new BMenu(TR("File")); + fSaveMenuItem = new BMenuItem(TR("Save"), new BMessage(kMsgSave), 'S'); fSaveMenuItem->SetEnabled(false); menu->AddItem(fSaveMenuItem); BMenuItem* item; - menu->AddItem(item = new BMenuItem("Save into resource file" B_UTF8_ELLIPSIS, - NULL)); + menu->AddItem(item = new BMenuItem( + TR("Save into resource file" B_UTF8_ELLIPSIS), NULL)); item->SetEnabled(false); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), + menu->AddItem(new BMenuItem(TR("Close"), new BMessage(B_QUIT_REQUESTED), 'W', B_COMMAND_KEY)); menuBar->AddItem(menu); @@ -261,7 +267,7 @@ AddChild(topView); rect = topView->Bounds().InsetByCopy(8.0f, 8.0f); - fSignatureControl = new BTextControl(rect, "signature", "Signature:", NULL, + fSignatureControl = new BTextControl(rect, "signature", TR("Signature:"), NULL, new BMessage(kMsgSignatureChanged), B_FOLLOW_LEFT_RIGHT); fSignatureControl->SetModificationMessage( new BMessage(kMsgSignatureChanged)); @@ -296,40 +302,40 @@ BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT); topView->AddChild(box); - fFlagsCheckBox = new BCheckBox(rect, "flags", "Application flags", + fFlagsCheckBox = new BCheckBox(rect, "flags", TR("Application flags"), new BMessage(kMsgToggleAppFlags)); fFlagsCheckBox->SetValue(B_CONTROL_ON); fFlagsCheckBox->ResizeToPreferred(); box->SetLabel(fFlagsCheckBox); rect.top = fFlagsCheckBox->Bounds().Height() + 4.0f; - fSingleLaunchButton = new BRadioButton(rect, "single", "Single launch", + fSingleLaunchButton = new BRadioButton(rect, "single", TR("Single launch"), new BMessage(kMsgAppFlagsChanged)); fSingleLaunchButton->ResizeToPreferred(); box->AddChild(fSingleLaunchButton); rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f); fMultipleLaunchButton = new BRadioButton(rect, "multiple", - "Multiple launch", new BMessage(kMsgAppFlagsChanged)); + TR("Multiple launch"), new BMessage(kMsgAppFlagsChanged)); fMultipleLaunchButton->ResizeToPreferred(); box->AddChild(fMultipleLaunchButton); rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f); fExclusiveLaunchButton = new BRadioButton(rect, "exclusive", - "Exclusive launch", new BMessage(kMsgAppFlagsChanged)); + TR("Exclusive launch"), new BMessage(kMsgAppFlagsChanged)); fExclusiveLaunchButton->ResizeToPreferred(); box->AddChild(fExclusiveLaunchButton); rect.top = fSingleLaunchButton->Frame().top; rect.left = fExclusiveLaunchButton->Frame().right + 4.0f; - fArgsOnlyCheckBox = new BCheckBox(rect, "args only", "Args only", + fArgsOnlyCheckBox = new BCheckBox(rect, "args only", TR("Args only"), new BMessage(kMsgAppFlagsChanged)); fArgsOnlyCheckBox->ResizeToPreferred(); box->AddChild(fArgsOnlyCheckBox); rect.top += fArgsOnlyCheckBox->Bounds().Height(); fBackgroundAppCheckBox = new BCheckBox(rect, "background", - "Background app", new BMessage(kMsgAppFlagsChanged)); + TR("Background app"), new BMessage(kMsgAppFlagsChanged)); fBackgroundAppCheckBox->ResizeToPreferred(); box->AddChild(fBackgroundAppCheckBox); @@ -373,12 +379,12 @@ rect.left = 8.0f; rect.right = Bounds().Width() - 8.0f; BBox* typeBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT); - typeBox->SetLabel("Supported types"); + typeBox->SetLabel(TR("Supported types")); topView->AddChild(typeBox); rect = typeBox->Bounds().InsetByCopy(8.0f, 6.0f); rect.top += ceilf(fontHeight.ascent); - fAddTypeButton = new BButton(rect, "add type", "Add" B_UTF8_ELLIPSIS, + fAddTypeButton = new BButton(rect, "add type", TR("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddType), B_FOLLOW_RIGHT); fAddTypeButton->ResizeToPreferred(); fAddTypeButton->MoveBy(rect.right - fAddTypeButton->Bounds().Width() @@ -387,7 +393,7 @@ rect = fAddTypeButton->Frame(); rect.OffsetBy(0, rect.Height() + 4.0f); - fRemoveTypeButton = new BButton(rect, "remove type", "Remove", + fRemoveTypeButton = new BButton(rect, "remove type", TR("Remove"), new BMessage(kMsgRemoveType), B_FOLLOW_RIGHT); typeBox->AddChild(fRemoveTypeButton); @@ -426,7 +432,7 @@ rect.right = Bounds().Width() - 8.0f; box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT); // the resizing mode will later also be set to B_FOLLOW_BOTTOM - box->SetLabel("Version info"); + box->SetLabel(TR("Version info")); topView->AddChild(box); BMenuField* menuField; @@ -446,7 +452,7 @@ rect.top = 4.0f + ceilf(fontHeight.ascent + fontHeight.descent); rect.bottom = rect.top + height; - fMajorVersionControl = new BTextControl(rect, "major", "Version:", NULL, + fMajorVersionControl = new BTextControl(rect, "major", TR("Version:"), NULL, NULL); fMajorVersionControl->SetDivider(fMajorVersionControl->StringWidth( fMajorVersionControl->Label()) + 4.0f); @@ -475,13 +481,13 @@ box->AddChild(fMinorVersionControl); fVarietyMenu = new BPopUpMenu("variety", true, true); - fVarietyMenu->AddItem(new BMenuItem("Development", NULL)); - fVarietyMenu->AddItem(new BMenuItem("Alpha", NULL)); - fVarietyMenu->AddItem(new BMenuItem("Beta", NULL)); - fVarietyMenu->AddItem(new BMenuItem("Gamma", NULL)); - fVarietyMenu->AddItem(item = new BMenuItem("Golden master", NULL)); + 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)); + fVarietyMenu->AddItem(item = new BMenuItem(TR("Golden master"), NULL)); item->SetMarked(true); - fVarietyMenu->AddItem(new BMenuItem("Final", NULL)); + fVarietyMenu->AddItem(new BMenuItem(TR("Final"), NULL)); rect.top--; // BMenuField oddity @@ -503,7 +509,7 @@ rect = box->Bounds().InsetByCopy(8.0f, 0.0f); rect.top = fInternalVersionControl->Frame().bottom + 8.0f; - fShortDescriptionControl = new BTextControl(rect, "short desc", "Short description:", + fShortDescriptionControl = new BTextControl(rect, "short desc", TR("Short description:"), NULL, NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); float labelWidth = fShortDescriptionControl->StringWidth( fShortDescriptionControl->Label()) + 4.0f; @@ -518,7 +524,7 @@ rect.OffsetBy(0.0f, fShortDescriptionControl->Bounds().Height() + 5.0f); rect.right = rect.left + labelWidth; - StringView* label = new StringView(rect, NULL, "Long description:", NULL); + StringView* label = new StringView(rect, NULL, TR("Long description:"), NULL); label->SetDivider(labelWidth); box->AddChild(label); @@ -1088,9 +1094,9 @@ ApplicationTypeWindow::QuitRequested() { if (_NeedsSaving(CHECK_ALL) != 0) { - BAlert* alert = new BAlert("Save request", "Do you want to save " - "the changes?", "Quit, don't save", "Cancel", "Save", - B_WIDTH_AS_USUAL, B_WARNING_ALERT); + 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); int32 choice = alert->Go(); switch (choice) { case 0: Modified: haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.cpp 2010-04-14 10:43:33 UTC (rev 36251) +++ haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.cpp 2010-04-14 11:55:17 UTC (rev 36252) @@ -16,6 +16,8 @@ #include <Bitmap.h> #include <Box.h> #include <Button.h> +#include <Catalog.h> +#include <Locale.h> #include <MenuField.h> #include <MenuItem.h> #include <Mime.h> @@ -35,6 +37,10 @@ #include <stdio.h> +#undef TR_CONTEXT +#define TR_CONTEXT "Application Types Window" + + class ProgressWindow : public BWindow { public: ProgressWindow(const char* message, int32 max, volatile bool* signalQuit); @@ -68,17 +74,17 @@ switch (variety) { case B_DEVELOPMENT_VERSION: - return "Development"; + return TR("Development"); case B_ALPHA_VERSION: - return "Alpha"; + return TR("Alpha"); case B_BETA_VERSION: - return "Beta"; + return TR("Beta"); case B_GAMMA_VERSION: - return "Gamma"; + return TR("Gamma"); case B_GOLDEN_MASTER_VERSION: - return "Golden master"; + return TR("Golden master"); case B_FINAL_VERSION: - return "Final"; + return TR("Final"); } return "-"; @@ -89,7 +95,7 @@ ProgressWindow::ProgressWindow(const char* message, int32 max, volatile bool* signalQuit) - : BWindow(BRect(0, 0, 300, 200), "Progress", B_MODAL_WINDOW_LOOK, + : BWindow(BRect(0, 0, 300, 200), TR("Progress"), B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE), fQuitListener(signalQuit) { @@ -109,7 +115,7 @@ fStatusBar->ResizeTo(rect.Width(), height); topView->AddChild(fStatusBar); - fAbortButton = new BButton(rect, "abort", "Abort", new BMessage(B_CANCEL), + fAbortButton = new BButton(rect, "abort", TR("Abort"), new BMessage(B_CANCEL), B_FOLLOW_H_CENTER | B_FOLLOW_TOP); fAbortButton->ResizeToPreferred(); fAbortButton->MoveTo((Bounds().Width() - fAbortButton->Bounds().Width()) / 2, @@ -160,7 +166,7 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage &settings) - : BWindow(_Frame(settings), "Application types", B_TITLED_WINDOW, + : BWindow(_Frame(settings), TR("Application types"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) { // Application list @@ -170,7 +176,7 @@ topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(topView); - BButton* button = new BButton(rect, "remove", "Remove uninstalled", + BButton* button = new BButton(rect, "remove", TR("Remove uninstalled"), new BMessage(kMsgRemoveUninstalled), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); button->ResizeToPreferred(); button->MoveTo(8.0f, rect.bottom - 8.0f - button->Bounds().Height()); @@ -201,15 +207,15 @@ rect.right = topView->Bounds().Width() - 8.0f; rect.bottom = rect.top + ceilf(fontHeight.ascent) + 24.0f; BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT); - box->SetLabel("Information"); + box->SetLabel(TR("Information")); topView->AddChild(box); BRect innerRect = box->Bounds().InsetByCopy(8.0f, 6.0f); - float labelWidth = topView->StringWidth("Description:") + 4.0f; + float labelWidth = topView->StringWidth(TR("Description:")) + 4.0f; innerRect.right = box->Bounds().Width() - 8.0f; innerRect.top += ceilf(fontHeight.ascent); - fNameView = new StringView(innerRect, "name", "Name:", NULL, B_FOLLOW_LEFT_RIGHT); + fNameView = new StringView(innerRect, "name", TR("Name:"), NULL, B_FOLLOW_LEFT_RIGHT); fNameView->SetDivider(labelWidth); float width, height; fNameView->GetPreferredSize(&width, &height); @@ -219,13 +225,13 @@ innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f); innerRect.bottom = innerRect.top + height; - fSignatureView = new StringView(innerRect, "signature", "Signature:", NULL, + fSignatureView = new StringView(innerRect, "signature", TR("Signature:"), NULL, B_FOLLOW_LEFT_RIGHT); fSignatureView->SetDivider(labelWidth); box->AddChild(fSignatureView); innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f); - fPathView = new StringView(innerRect, "path", "Path:", NULL, + fPathView = new StringView(innerRect, "path", TR("Path:"), NULL, B_FOLLOW_LEFT_RIGHT); fPathView->SetDivider(labelWidth); box->AddChild(fPathView); @@ -236,18 +242,18 @@ rect.bottom = rect.top + ceilf(fontHeight.ascent) + fNameView->Bounds().Height() * 4.0f + 20.0f; box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT); - box->SetLabel("Version"); + box->SetLabel(TR("Version")); topView->AddChild(box); innerRect = fNameView->Frame(); - fVersionView = new StringView(innerRect, "version", "Version:", NULL, + fVersionView = new StringView(innerRect, "version", TR("Version:"), NULL, B_FOLLOW_LEFT_RIGHT); fVersionView->SetDivider(labelWidth); box->AddChild(fVersionView); innerRect.OffsetBy(0, fNameView->Bounds().Height() + 5.0f); innerRect.right = innerRect.left + labelWidth; - fDescriptionLabel = new StringView(innerRect, "description", "Description:", NULL); + fDescriptionLabel = new StringView(innerRect, "description", TR("Description:"), NULL); fDescriptionLabel->SetDivider(labelWidth); box->AddChild(fDescriptionLabel); @@ -268,20 +274,20 @@ rect = box->Frame(); rect.top = rect.bottom + 8.0f; rect.bottom = rect.top + 20.0f; - fTrackerButton = new BButton(rect, "tracker", "Show in Tracker" B_UTF8_ELLIPSIS, NULL, + fTrackerButton = new BButton(rect, "tracker", TR("Show in Tracker" B_UTF8_ELLIPSIS), NULL, B_FOLLOW_RIGHT); fTrackerButton->ResizeToPreferred(); fTrackerButton->MoveTo(rect.right - fTrackerButton->Bounds().Width(), rect.top); topView->AddChild(fTrackerButton); - fLaunchButton = new BButton(rect, "launch", "Launch", NULL, + fLaunchButton = new BButton(rect, "launch", TR("Launch"), NULL, B_FOLLOW_RIGHT); fLaunchButton->ResizeToPreferred(); fLaunchButton->MoveTo(fTrackerButton->Frame().left - 6.0f - fLaunchButton->Bounds().Width(), rect.top); topView->AddChild(fLaunchButton); - fEditButton = new BButton(rect, "edit", "Edit" B_UTF8_ELLIPSIS, new BMessage(kMsgEdit), + fEditButton = new BButton(rect, "edit", TR("Edit" B_UTF8_ELLIPSIS), new BMessage(kMsgEdit), B_FOLLOW_RIGHT); fEditButton->ResizeToPreferred(); fEditButton->MoveTo(fLaunchButton->Frame().left - 6.0f @@ -322,7 +328,7 @@ int32 removed = 0; volatile bool quit = false; - BWindow* progressWindow = new ProgressWindow("Removing uninstalled application types", + BWindow* progressWindow = new ProgressWindow(TR("Removing uninstalled application types"), fTypeListView->FullListCountItems(), &quit); progressWindow->AddToSubset(this); progressWindow->Show(); @@ -375,7 +381,8 @@ progressWindow->PostMessage(B_QUIT_REQUESTED); char message[512]; - snprintf(message, sizeof(message), "%ld Application type%s could be removed.", + // TODO : use ICU to properly format this + snprintf(message, sizeof(message), TR("%ld Application type%s could be removed."), removed, removed == 1 ? "" : "s"); error_alert(message, B_OK, B_INFO_ALERT); } Modified: haiku/trunk/src/preferences/filetypes/AttributeWindow.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/AttributeWindow.cpp 2010-04-14 10:43:33 UTC (rev 36251) +++ haiku/trunk/src/preferences/filetypes/AttributeWindow.cpp 2010-04-14 11:55:17 UTC (rev 36252) @@ -10,7 +10,9 @@ #include <Box.h> #include <Button.h> +#include <Catalog.h> #include <CheckBox.h> +#include <Locale.h> #include <MenuField.h> #include <MenuItem.h> #include <Mime.h> @@ -24,6 +26,10 @@ #include <string.h> +#undef TR_CONTEXT +#define TR_CONTEXT "Attribute Window" + + const uint32 kMsgAttributeUpdated = 'atup'; const uint32 kMsgTypeChosen = 'typc'; const uint32 kMsgDisplayAsChosen = 'dach'; @@ -85,7 +91,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType, AttributeItem* attributeItem) - : BWindow(BRect(100, 100, 350, 200), "Attribute", B_MODAL_WINDOW_LOOK, + : BWindow(BRect(100, 100, 350, 200), TR("Attribute"), B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE | B_ASYNCHRONOUS_CONTROLS), fTarget(target), @@ -100,7 +106,7 @@ AddChild(topView); rect.InsetBy(8.0f, 8.0f); - fPublicNameControl = new BTextControl(rect, "public", "Attribute name:", + fPublicNameControl = new BTextControl(rect, "public", TR("Attribute name:"), fAttribute.PublicName(), NULL, B_FOLLOW_LEFT_RIGHT); fPublicNameControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated)); @@ -115,7 +121,7 @@ rect = fPublicNameControl->Frame(); rect.OffsetBy(0.0f, rect.Height() + 5.0f); - fAttributeControl = new BTextControl(rect, "internal", "Internal name:", + fAttributeControl = new BTextControl(rect, "internal", TR("Internal name:"), fAttribute.Name(), NULL, B_FOLLOW_LEFT_RIGHT); fAttributeControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated)); fAttributeControl->SetDivider(labelWidth); @@ -145,7 +151,7 @@ rect.OffsetBy(0.0f, rect.Height() + 4.0f); BMenuField* menuField = new BMenuField(rect, "types", - "Type:", fTypeMenu); + TR("Type:"), fTypeMenu); menuField->SetDivider(labelWidth); menuField->SetAlignment(B_ALIGN_RIGHT); menuField->GetPreferredSize(&width, &height); @@ -157,7 +163,7 @@ BBox* box = new BBox(rect, "", B_FOLLOW_LEFT_RIGHT); topView->AddChild(box); - fVisibleCheckBox = new BCheckBox(rect, "visible", "Visible", + fVisibleCheckBox = new BCheckBox(rect, "visible", TR("Visible"), new BMessage(kMsgVisibilityChanged)); fVisibleCheckBox->SetValue(fAttribute.Visible()); fVisibleCheckBox->ResizeToPreferred(); @@ -185,13 +191,13 @@ rect.OffsetTo(8.0f, fVisibleCheckBox->Bounds().Height()); rect.right -= 18.0f; fDisplayAsMenuField = new BMenuField(rect, "display as", - "Display as:", menu); + TR("Display as:"), menu); fDisplayAsMenuField->SetDivider(labelWidth); fDisplayAsMenuField->SetAlignment(B_ALIGN_RIGHT); fDisplayAsMenuField->ResizeTo(rect.Width(), height); box->AddChild(fDisplayAsMenuField); - fEditableCheckBox = new BCheckBox(rect, "editable", "Editable", + fEditableCheckBox = new BCheckBox(rect, "editable", TR("Editable"), new BMessage(kMsgAttributeUpdated), B_FOLLOW_RIGHT); fEditableCheckBox->SetValue(fAttribute.Editable()); fEditableCheckBox->ResizeToPreferred(); @@ -202,7 +208,7 @@ rect.OffsetBy(0.0f, menuField->Bounds().Height() + 4.0f); rect.bottom = rect.top + fPublicNameControl->Bounds().Height(); - fSpecialControl = new BTextControl(rect, "special", "Special:", + fSpecialControl = new BTextControl(rect, "special", TR("Special:"), display_as_parameter(fAttribute.DisplayAs()), NULL, B_FOLLOW_LEFT_RIGHT); fSpecialControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated)); @@ -214,7 +220,7 @@ char text[64]; snprintf(text, sizeof(text), "%ld", fAttribute.Width()); rect.OffsetBy(0.0f, fSpecialControl->Bounds().Height() + 4.0f); - fWidthControl = new BTextControl(rect, "width", "Width:", + fWidthControl = new BTextControl(rect, "width", TR("Width:"), text, NULL, B_FOLLOW_LEFT_RIGHT); fWidthControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated)); fWidthControl->SetDivider(labelWidth); @@ -234,9 +240,9 @@ int32 alignment; const char* name; } kAlignmentMap[] = { - {B_ALIGN_LEFT, "Left"}, - {B_ALIGN_RIGHT, "Right"}, - {B_ALIGN_CENTER, "Center"}, + {B_ALIGN_LEFT, TR("Left")}, + {B_ALIGN_RIGHT, TR("Right")}, + {B_ALIGN_CENTER, TR("Center")}, {0, NULL} }; @@ -254,7 +260,7 @@ rect.OffsetBy(0.0f, menuField->Bounds().Height() + 1.0f); fAlignmentMenuField = new BMenuField(rect, "alignment", - "Alignment:", menu); + TR("Alignment:"), menu); fAlignmentMenuField->SetDivider(labelWidth); fAlignmentMenuField->SetAlignment(B_ALIGN_RIGHT); fAlignmentMenuField->ResizeTo(rect.Width(), height); @@ -262,7 +268,7 @@ box->ResizeBy(0.0f, fAlignmentMenuField->Bounds().Height() * 2.0f + fVisibleCheckBox->Bounds().Height()); - fAcceptButton = new BButton(rect, "add", item ? "Done" : "Add", + fAcceptButton = new BButton(rect, "add", item ? TR("Done") : TR("Add"), new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); fAcceptButton->ResizeToPreferred(); fAcceptButton->MoveTo(Bounds().Width() - 8.0f - fAcceptButton->Bounds().Width(), @@ -270,7 +276,7 @@ fAcceptButton->SetEnabled(false); topView->AddChild(fAcceptButton); - BButton* button = new BButton(rect, "cancel", "Cancel", + BButton* button = new BButton(rect, "cancel", TR("Cancel"), new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); button->ResizeToPreferred(); button->MoveTo(fAcceptButton->Frame().left - 10.0f - button->Bounds().Width(), @@ -489,7 +495,7 @@ } if (status != B_OK) - error_alert("Could not change attributes", status); + error_alert(TR("Could not change attributes"), status); PostMessage(B_QUIT_REQUESTED); break; Modified: haiku/trunk/src/preferences/filetypes/ExtensionWindow.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/ExtensionWindow.cpp 2010-04-14 10:43:33 UTC (rev 36251) +++ haiku/trunk/src/preferences/filetypes/ExtensionWindow.cpp 2010-04-14 11:55:17 UTC (rev 36252) @@ -9,6 +9,8 @@ #include "FileTypesWindow.h" #include <Button.h> +#include <Catalog.h> +#include <Locale.h> #include <MenuField.h> #include <MenuItem.h> #include <Mime.h> @@ -19,6 +21,10 @@ #include <string.h> +#undef TR_CONTEXT +#define TR_CONTEXT "Extension Window" + + const uint32 kMsgExtensionUpdated = 'exup'; const uint32 kMsgAccept = 'acpt'; @@ -103,7 +109,7 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type, const char* extension) - : BWindow(BRect(100, 100, 350, 200), "Extension", B_MODAL_WINDOW_LOOK, + : BWindow(BRect(100, 100, 350, 200), TR("Extension"), B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE | B_ASYNCHRONOUS_CONTROLS), fTarget(target), @@ -116,7 +122,7 @@ AddChild(topView); rect.InsetBy(8.0f, 8.0f); - fExtensionControl = new BTextControl(rect, "extension", "Extension:", extension, + fExtensionControl = new BTextControl(rect, "extension", TR("Extension:"), extension, NULL, B_FOLLOW_LEFT_RIGHT); float labelWidth = fExtensionControl->StringWidth(fExtensionControl->Label()) + 2.0f; @@ -136,7 +142,7 @@ fExtensionControl->ResizeTo(rect.Width(), height); topView->AddChild(fExtensionControl); - fAcceptButton = new BButton(rect, "add", extension ? "Done" : "Add", + fAcceptButton = new BButton(rect, "add", extension ? TR("Done") : TR("Add"), new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); fAcceptButton->ResizeToPreferred(); fAcceptButton->MoveTo(Bounds().Width() - 8.0f - fAcceptButton->Bounds().Width(), @@ -144,7 +150,7 @@ fAcceptButton->SetEnabled(false); topView->AddChild(fAcceptButton); - BButton* button = new BButton(rect, "cancel", "Cancel", + BButton* button = new BButton(rect, "cancel", TR("Cancel"), new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); button->ResizeToPreferred(); button->MoveTo(fAcceptButton->Frame().left - 10.0f - button->Bounds().Width(), @@ -202,7 +208,7 @@ status_t status = replace_extension(fMimeType, newExtension, fExtension.String()); if (status != B_OK) - error_alert("Could not change file extensions", status); + error_alert(TR("Could not change file extensions"), status); PostMessage(B_QUIT_REQUESTED); break; @@ -213,4 +219,3 @@ break; } } - Modified: haiku/trunk/src/preferences/filetypes/FileTypeWindow.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/FileTypeWindow.cpp 2010-04-14 10:43:33 UTC (rev 36251) +++ haiku/trunk/src/preferences/filetypes/FileTypeWindow.cpp 2010-04-14 11:55:17 UTC (rev 36252) @@ -14,7 +14,9 @@ #include <Bitmap.h> #include <Box.h> #include <Button.h> +#include <Catalog.h> #include <File.h> +#include <Locale.h> #include <MenuField.h> #include <MenuItem.h> #include <Mime.h> @@ -25,6 +27,10 @@ #include <stdio.h> +#undef TR_CONTEXT +#define TR_CONTEXT "FileType Window" + + const uint32 kMsgTypeEntered = 'type'; const uint32 kMsgSelectType = 'sltp'; const uint32 kMsgTypeSelected = 'tpsd'; @@ -40,7 +46,7 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs) : BWindow(BRect(0.0f, 0.0f, 200.0f, 200.0f).OffsetBySelf(position), - "File type", B_TITLED_WINDOW, + TR("File type"), B_TITLED_WINDOW, B_NOT_V_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) { BRect rect = Bounds(); @@ -56,7 +62,7 @@ rect.InsetBy(8.0f, 8.0f); BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT); - box->SetLabel("File type"); + box->SetLabel(TR("File type")); topView->AddChild(box); rect = box->Bounds(); @@ -77,13 +83,15 @@ } rect.OffsetBy(0.0f, fTypeControl->Bounds().Height() + 5.0f); - fSelectTypeButton = new BButton(rect, "select type", "Select" B_UTF8_ELLIPSIS, + fSelectTypeButton = new BButton(rect, "select type", + TR("Select" B_UTF8_ELLIPSIS), new BMessage(kMsgSelectType), B_FOLLOW_LEFT | B_FOLLOW_TOP); fSelectTypeButton->ResizeToPreferred(); box->AddChild(fSelectTypeButton); rect.OffsetBy(fSelectTypeButton->Bounds().Width() + 8.0f, 0.0f); - fSameTypeAsButton = new BButton(rect, "same type as", "Same as" B_UTF8_ELLIPSIS, + fSameTypeAsButton = new BButton(rect, "same type as", + TR("Same as" B_UTF8_ELLIPSIS), new BMessage(kMsgSameTypeAs), B_FOLLOW_LEFT | B_FOLLOW_TOP); fSameTypeAsButton->ResizeToPreferred(); box->AddChild(fSameTypeAsButton); @@ -121,12 +129,12 @@ rect.left = 8.0f; rect.right = Bounds().Width() - 8.0f; box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT); - box->SetLabel("Preferred application"); + box->SetLabel(TR("Preferred application")); topView->AddChild(box); BMenu* menu = new BPopUpMenu("preferred"); BMenuItem* item; - menu->AddItem(item = new BMenuItem("Default application", + menu->AddItem(item = new BMenuItem(TR("Default application"), new BMessage(kMsgPreferredAppChosen))); item->SetMarked(true); @@ -147,13 +155,15 @@ box->AddChild(constrainingView); rect.OffsetBy(0.0f, height + 5.0f); - fSelectAppButton = new BButton(rect, "select app", "Select" B_UTF8_ELLIPSIS, + fSelectAppButton = new BButton(rect, "select app", + TR("Select" B_UTF8_ELLIPSIS), new BMessage(kMsgSelectPreferredApp), B_FOLLOW_LEFT | B_FOLLOW_TOP); fSelectAppButton->ResizeToPreferred(); box->AddChild(fSelectAppButton); rect.OffsetBy(fSelectAppButton->Bounds().Width() + 8.0f, 0.0f); - fSameAppAsButton = new BButton(rect, "same app as", "Same as" B_UTF8_ELLIPSIS, + fSameAppAsButton = new BButton(rect, "same app as", + TR("Same as" B_UTF8_ELLIPSIS), new BMessage(kMsgSamePreferredAppAs), B_FOLLOW_LEFT | B_FOLLOW_TOP); fSameAppAsButton->ResizeToPreferred(); box->AddChild(fSameAppAsButton); @@ -203,11 +213,11 @@ char name[B_FILE_NAME_LENGTH]; if (same && parent.GetName(name) == B_OK) { - title = "Multiple files from \""; + title = TR("Multiple files from \""); title.Append(name); title.Append("\""); } else - title = "[Multiple files]"; + title = TR("[Multiple files]"); } else if (refs.FindRef("refs", 0, &ref) == B_OK) title = ref.name; @@ -294,7 +304,7 @@ } if (status != B_OK) { - error_alert("Could not open file", status); + error_alert(TR("Could not open file"), status); return; } @@ -391,7 +401,7 @@ case kMsgSameTypeAs: { BMessage panel(kMsgOpenFilePanel); - panel.AddString("title", "Select same type as"); + panel.AddString("title", TR("Select same type as")); panel.AddInt32("message", kMsgSameTypeAsOpened); panel.AddMessenger("target", this); @@ -419,7 +429,7 @@ case kMsgSelectPreferredApp: { BMessage panel(kMsgOpenFilePanel); - panel.AddString("title", "Select preferred application"); + panel.AddString("title", TR("Select preferred application")); panel.AddInt32("message", kMsgPreferredAppOpened); panel.AddMessenger("target", this); @@ -433,7 +443,7 @@ case kMsgSamePreferredAppAs: { BMessage panel(kMsgOpenFilePanel); - panel.AddString("title", "Select same preferred application as"); + panel.AddString("title", TR("Select same preferred application as")); panel.AddInt32("message", kMsgSamePreferredAppAsOpened); panel.AddMessenger("target", this); Modified: haiku/trunk/src/preferences/filetypes/FileTypes.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/FileTypes.cpp 2010-04-14 10:43:33 UTC (rev 36251) +++ haiku/trunk/src/preferences/filetypes/FileTypes.cpp 2010-04-14 11:55:17 UTC (rev 36252) @@ -13,6 +13,8 @@ #include <AppFileInfo.h> #include <Application.h> #include <Alert.h> +#include <Catalog.h> +#include <Locale.h> #include <TextView.h> #include <FilePanel.h> #include <FindDirectory.h> @@ -24,6 +26,10 @@ #include <string.h> +#undef TR_CONTEXT +#define TR_CONTEXT "FileTypes" + + const char *kSignature = "application/x-vnd.Haiku-FileTypes"; static const uint32 kMsgFileTypesSettings = 'FTst'; @@ -70,6 +76,8 @@ BWindow *fApplicationTypesWindow; uint32 fWindowCount; uint32 fTypeWindowCount; + + BCatalog fCatalog; }; @@ -163,6 +171,7 @@ fWindowCount(0), fTypeWindowCount(0) { + be_locale->GetAppCatalog(&fCatalog); fFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false); } @@ -207,11 +216,11 @@ char buffer[1024]; snprintf(buffer, sizeof(buffer), - "Could not open \"%s\":\n" - "%s", + TR("Could not open \"%s\":\n" + "%s"), ref.name, strerror(status)); - (new BAlert("FileTypes request", + (new BAlert(TR("FileTypes request"), buffer, "Ok", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); @@ -278,7 +287,7 @@ if ((status = entry.SetTo(path.Path(), false)) != B_OK || (status = entry.GetRef(&ref)) != B_OK) { - fprintf(stderr, "Could not open file \"%s\": %s\n", + fprintf(stderr, TR("Could not open file \"%s\": %s\n"), path.Path(), strerror(status)); continue; } @@ -347,7 +356,7 @@ // the open file panel sends us a message when it's done const char* subTitle; if (message->FindString("title", &subTitle) != B_OK) - subTitle = "Open File"; + subTitle = TR("Open File"); int32 what; if (message->FindInt32("message", &what) != B_OK) @@ -398,9 +407,9 @@ void FileTypes::AboutRequested() { - BAlert *alert = new BAlert("about", "FileTypes\n" + BAlert *alert = new BAlert("about", TR("FileTypes\n" "\twritten by Axel Dörfler\n" - "\tCopyright 2006-2007, Haiku.\n", "Ok"); + "\tCopyright 2006-2007, Haiku.\n"), TR("Ok")); BTextView *view = alert->TextView(); BFont font; @@ -448,7 +457,7 @@ if (status != B_OK) snprintf(warning, sizeof(warning), "%s:\n\t%s\n", message, strerror(status)); - (new BAlert("FileTypes Request", + (new BAlert(TR("FileTypes Request"), status == B_OK ? message : warning, "Ok", NULL, NULL, B_WIDTH_AS_USUAL, type))->Go(); } Modified: haiku/trunk/src/preferences/filetypes/FileTypesWindow.cpp =================================================================== --- haiku/trunk/src/preferences/filetypes/FileTypesWindow.cpp 2010-04-14 10:43:33 UTC (rev 36251) +++ haiku/trunk/src/preferences/filetypes/FileTypesWindow.cpp 2010-04-14 11:55:17 UTC (rev 36252) @@ -21,7 +21,9 @@ #include <Bitmap.h> #include <Box.h> #include <Button.h> +#include <Catalog.h> #include <ListView.h> +#include <Locale.h> #include <MenuBar.h> #include <MenuField.h> #include <MenuItem.h> @@ -39,6 +41,10 @@ #include <stdlib.h> +#undef TR_CONTEXT +#define TR_CONTEXT "FileType Window" + + const uint32 kMsgTypeSelected = 'typs'; const uint32 kMsgAddType = 'atyp'; const uint32 kMsgRemoveType = 'rtyp'; @@ -125,13 +131,13 @@ switch (IconSource()) { case kNoIcon: - text = "no icon"; + text = TR("no icon"); break; case kApplicationIcon: - text = "(from application)"; + text = TR("(from application)"); break; case kSupertypeIcon: - text = "(from super type)"; + text = TR("(from super type)"); break; default: @@ -160,8 +166,8 @@ TypeIconView::GetPreferredSize(float* _width, float* _height) { if (_width) { - float a = StringWidth("(from application)"); - float b = StringWidth("(from super type)"); + float a = StringWidth(TR("(from application)")); + float b = StringWidth(TR("(from super type)")); float width = max_c(a, b); if (width < IconSize()) width = IconSize(); @@ -186,7 +192,7 @@ font_height fontHeight; GetFontHeight(&fontHeight); - float width = StringWidth("no icon") + 8.0f; + float width = StringWidth(TR("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) / 2.0f) - 3.0f; @@ -287,37 +293,38 @@ BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL); AddChild(menuBar); - BMenu* menu = new BMenu("File"); + BMenu* menu = new BMenu(TR("File")); BMenuItem* item; - menu->AddItem(item = new BMenuItem("New resource file" B_UTF8_ELLIPSIS, + menu->AddItem(item = new BMenuItem(TR("New resource file" B_UTF8_ELLIPSIS), NULL, 'N', B_COMMAND_KEY)); item->SetEnabled(false); - BMenu* recentsMenu = BRecentFilesList::NewFileListMenu("Open" B_UTF8_ELLIPSIS, + BMenu* recentsMenu = BRecentFilesList::NewFileListMenu( + TR("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("Application types" B_UTF8_ELLIPSIS, + menu->AddItem(new BMenuItem(TR("Application types" B_UTF8_ELLIPSIS), new BMessage(kMsgOpenApplicationTypesWindow))); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("About FileTypes" B_UTF8_ELLIPSIS, + menu->AddItem(new BMenuItem(TR("About FileTypes" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED))); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), + menu->AddItem(new BMenuItem(TR("Quit"), new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY)); menu->SetTargetForItems(be_app); menuBar->AddItem(menu); - menu = new BMenu("Settings"); - item = new BMenuItem("Show icons in list", new BMessage(kMsgToggleIcons)); + menu = new BMenu(TR("Settings")); + item = new BMenuItem(TR("Show icons in list"), new BMessage(kMsgToggleIcons)); item->SetMarked(showIcons); item->SetTarget(this); menu->AddItem(item); - item = new BMenuItem("Show recognition rule", new BMessage(kMsgToggleRule)); + item = new BMenuItem(TR("Show recognition rule"), new BMessage(kMsgToggleRule)); item->SetMarked(showRule); item->SetTarget(this); menu->AddItem(item); @@ -331,7 +338,7 @@ topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(topView); - BButton* button = new BButton(rect, "add", "Add" B_UTF8_ELLIPSIS, + BButton* button = new BButton(rect, "add", TR("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddType), B_FOLLOW_BOTTOM); button->ResizeToPreferred(); button->MoveTo(8.0f, topView->Bounds().bottom - 8.0f - button->Bounds().Height()); @@ -339,7 +346,7 @@ rect = button->Frame(); rect.OffsetBy(rect.Width() + 8.0f, 0.0f); - fRemoveTypeButton = new BButton(rect, "remove", "Remove", + fRemoveTypeButton = new BButton(rect, "remove", TR("Remove"), new BMessage(kMsgRemoveType), B_FOLLOW_BOTTOM); fRemoveTypeButton->ResizeToPreferred(); topView->AddChild(fRemoveTypeButton); @@ -367,7 +374,7 @@ + plainHeight.leading) + 2.0f; BFont font(be_bold_font); - float labelWidth = font.StringWidth("Icon"); + float labelWidth = font.StringWidth(TR("Icon")); font_height boldHeight; font.GetHeight(&boldHeight); [... truncated: 522 lines follow ...]