diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp index 66d09814a6..892176eefd 100644 --- a/src/apps/mail/MailWindow.cpp +++ b/src/apps/mail/MailWindow.cpp @@ -1602,10 +1602,10 @@ TMailWindow::MessageReceived(BMessage *msg) if (showAlert) { // just some patience before Tracker pops up the folder snooze(250000); - BAlert* alert = new BAlert("helpful message", - "Put your favorite e-mail queries and query " - "templates in this folder.", - "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_IDEA_ALERT); + BAlert* alert = new BAlert(B_TRANSLATE("helpful message"), + B_TRANSLATE("Put your favorite e-mail queries and query " + "templates in this folder."), B_TRANSLATE("OK"), NULL, NULL, + B_WIDTH_AS_USUAL, B_IDEA_ALERT); alert->Go(NULL); } diff --git a/src/apps/mediaplayer/InfoWin.cpp b/src/apps/mediaplayer/InfoWin.cpp index 0e7747d96a..800c72f136 100644 --- a/src/apps/mediaplayer/InfoWin.cpp +++ b/src/apps/mediaplayer/InfoWin.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -50,6 +51,8 @@ const rgb_color kBlue = { 0, 0, 220, 255 }; const rgb_color kGreen = { 171, 221, 161, 255 }; const rgb_color kBlack = { 0, 0, 0, 255 }; +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "MediaPlayer-InfoWin" // should later draw an icon class InfoView : public BView { @@ -159,7 +162,7 @@ InfoView::SetGenericIcon() InfoWin::InfoWin(BPoint leftTop, Controller* controller) : BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1, - leftTop.y + 300), NAME, B_TITLED_WINDOW, + leftTop.y + 300), B_TRANSLATE(NAME), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE), fController(controller), fControllerObserver(new ControllerObserver(this, diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index b0c8dc8666..ef90f15743 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -166,13 +166,15 @@ static const char* kRatingAttrName = "Media:Rating"; static const char* kDisabledSeekMessage = B_TRANSLATE("Drop files to play"); +static const char* kApplicationName = B_TRANSLATE(NAME); + //#define printf(a...) MainWin::MainWin(bool isFirstWindow, BMessage* message) : - BWindow(BRect(100, 100, 400, 300), NAME, B_TITLED_WINDOW, + BWindow(BRect(100, 100, 400, 300), kApplicationName, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */), fCreationTime(system_time()), fInfoWin(NULL), @@ -1346,7 +1348,7 @@ MainWin::_PlaylistItemOpened(const PlaylistItemRef& item, status_t result) fHasFile = false; fHasVideo = false; fHasAudio = false; - SetTitle(NAME); + SetTitle(kApplicationName); } else { fHasFile = true; fHasVideo = fController->VideoTrackCount() != 0; @@ -1418,7 +1420,7 @@ MainWin::_SetupWindow() void MainWin::_CreateMenu() { - fFileMenu = new BMenu(NAME); + fFileMenu = new BMenu(kApplicationName); fPlaylistMenu = new BMenu(B_TRANSLATE("Playlist"B_UTF8_ELLIPSIS)); fAudioMenu = new BMenu(B_TRANSLATE("Audio")); fVideoMenu = new BMenu(B_TRANSLATE("Video")); diff --git a/src/apps/networkstatus/NetworkStatusView.cpp b/src/apps/networkstatus/NetworkStatusView.cpp index 2f04490310..f4499dc4b9 100644 --- a/src/apps/networkstatus/NetworkStatusView.cpp +++ b/src/apps/networkstatus/NetworkStatusView.cpp @@ -53,11 +53,11 @@ static const char *kStatusDescriptions[] = { - B_TRANSLATE_MARK("Unknown"), - B_TRANSLATE_MARK("No link"), - B_TRANSLATE_MARK("No stateful configuration"), - B_TRANSLATE_MARK("Configuring"), - B_TRANSLATE_MARK("Ready") + B_TRANSLATE("Unknown"), + B_TRANSLATE("No link"), + B_TRANSLATE("No stateful configuration"), + B_TRANSLATE("Configuring"), + B_TRANSLATE("Ready") }; extern "C" _EXPORT BView *instantiate_deskbar_item(void); @@ -329,9 +329,9 @@ NetworkStatusView::_ShowConfiguration(BMessage* message) const char* label; int32 control; } kInformationEntries[] = { - { "Address", SIOCGIFADDR }, - { "Broadcast", SIOCGIFBRDADDR }, - { "Netmask", SIOCGIFNETMASK }, + { B_TRANSLATE("Address"), SIOCGIFADDR }, + { B_TRANSLATE("Broadcast"), SIOCGIFBRDADDR }, + { B_TRANSLATE("Netmask"), SIOCGIFNETMASK }, { NULL } }; @@ -347,15 +347,8 @@ NetworkStatusView::_ShowConfiguration(BMessage* message) if (!_PrepareRequest(request, name)) return; - BString text = NULL; - if (strncmp("Address", name, strlen(name)) == 0) - text = B_TRANSLATE("Address information:\n"); - - if (strncmp("Broadcast", name, strlen(name)) == 0) - text = B_TRANSLATE("Broadcast information:\n"); - - if (strncmp("Netmask", name, strlen(name)) == 0) - text = B_TRANSLATE("Netmask information:\n"); + BString text(B_TRANSLATE("%ifaceName information:\n")); + text.ReplaceFirst("%ifaceName", name); size_t boldLength = text.Length(); @@ -381,22 +374,7 @@ NetworkStatusView::_ShowConfiguration(BMessage* message) return; } - text += "\n"; - - if (strncmp("Address", kInformationEntries[i].label, - strlen(kInformationEntries[i].label)) == 0) - text += B_TRANSLATE("Address"); - - if (strncmp("Broadcast", kInformationEntries[i].label, - strlen(kInformationEntries[i].label)) == 0) - text += B_TRANSLATE("Broadcast"); - - if (strncmp("Netmask", kInformationEntries[i].label, - strlen(kInformationEntries[i].label)) == 0) - text += B_TRANSLATE("Netmask"); - - text += ": "; - text += address; + text << "\n" << kInformationEntries[i].label << ": " << address; } BAlert* alert = new BAlert(name, text.String(), B_TRANSLATE("OK")); diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index ea85acdf5e..327b099213 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -1648,7 +1648,7 @@ StyledEditWindow::_UpdateCleanUndoRedoSaveRevert() fRedoCleans = false; fRevertItem->SetEnabled(fSaveMessage != NULL); fSaveItem->SetEnabled(true); - fUndoItem->SetLabel(B_TRANSLATE("Can't Undo")); + fUndoItem->SetLabel(B_TRANSLATE("Can't undo")); fUndoItem->SetEnabled(false); fCanUndo = false; fCanRedo = false; diff --git a/src/apps/tv/MainWin.cpp b/src/apps/tv/MainWin.cpp index 1bb534c0d8..afd03a95df 100644 --- a/src/apps/tv/MainWin.cpp +++ b/src/apps/tv/MainWin.cpp @@ -85,7 +85,7 @@ enum MainWin::MainWin(BRect frame_rect) - : BWindow(frame_rect, NAME, B_TITLED_WINDOW, + : BWindow(frame_rect, B_TRANSLATE(NAME), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */) , fController(new Controller) , fIsFullscreen(false) @@ -162,7 +162,7 @@ MainWin::~MainWin() void MainWin::CreateMenu() { - fFileMenu = new BMenu(NAME); + fFileMenu = new BMenu(B_TRANSLATE(NAME)); fChannelMenu = new BMenu(B_TRANSLATE("Channel")); fInterfaceMenu = new BMenu(B_TRANSLATE("Interface")); fSettingsMenu = new BMenu(B_TRANSLATE("Settings")); @@ -704,8 +704,8 @@ void MainWin::UpdateWindowTitle() { char buf[100]; - sprintf(buf, "%s - %d x %d, %.3f:%.3f => %.0f x %.0f", NAME, fSourceWidth, - fSourceHeight, fWidthScale, fHeightScale, + sprintf(buf, "%s - %d x %d, %.3f:%.3f => %.0f x %.0f", B_TRANSLATE(NAME), + fSourceWidth, fSourceHeight, fWidthScale, fHeightScale, fVideoView->Bounds().Width() + 1, fVideoView->Bounds().Height() + 1); SetTitle(buf); } diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp index ff1b5786dd..c5725fa68c 100644 --- a/src/kits/tracker/FSUtils.cpp +++ b/src/kits/tracker/FSUtils.cpp @@ -612,8 +612,8 @@ enum { bool -ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *action, - bool dontAsk, int32 *confirmedAlready) +ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction, + const char *toDoAction, bool dontAsk, int32 *confirmedAlready) { // Don't let the user casually move/change important files/folders // @@ -633,15 +633,15 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *action, if (DirectoryMatchesOrContains(entry, B_BEOS_DIRECTORY)) { 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 %action the system folder or its contents anyway, hold down " - "the Shift key and click \"Do it\".")); + B_TRANSLATE("If you %ifYouDoAction the system folder or its " + "contents, you won't be able to boot " OS_NAME "! Are you sure you " + "want to do this? To %toDoAction the system folder or its contents " + "anyway, hold down the Shift key and click \"Do it\".")); } else if (DirectoryMatches(entry, B_USER_DIRECTORY)) { 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 %action the home anyway, click \"Do it\".")); + B_TRANSLATE("If you %ifYouDoAction the home folder, " OS_NAME + " may not behave properly! Are you sure you want to do this? " + "To %toDoAction the home anyway, click \"Do it\".")); requireOverride = false; } else if (DirectoryMatchesOrContains(entry, B_USER_CONFIG_DIRECTORY) || DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) { @@ -651,22 +651,22 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *action, || DirectoryMatchesOrContains(entry, "beos_mime", B_COMMON_SETTINGS_DIRECTORY)) { warning.SetTo( - B_TRANSLATE("If you %action the mime settings, " OS_NAME + B_TRANSLATE("If you %ifYouDoAction 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\".")); + "To %toDoAction the mime settings anyway, click \"Do it\".")); requireOverride = false; } else if (DirectoryMatches(entry, B_USER_CONFIG_DIRECTORY)) { warning.SetTo( - B_TRANSLATE("If you %action the config folder, " OS_NAME + B_TRANSLATE("If you %ifYouDoAction 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\".")); + "To %toDoAction the config folder anyway, click \"Do it\".")); requireOverride = false; } else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY) || DirectoryMatches(entry, B_COMMON_SETTINGS_DIRECTORY)) { warning.SetTo( - B_TRANSLATE("If you %action the settings folder, " OS_NAME + B_TRANSLATE("If you %ifYouDoAction 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\".")); + "To %toDoAction the settings folder anyway, click \"Do it\".")); requireOverride = false; } } @@ -682,7 +682,8 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *action, // we already warned about moving home this time around return true; - warning.ReplaceAll("%action", action); + warning.ReplaceFirst("%ifYouDoAction", ifYouDoAction); + warning.ReplaceFirst("%toDoAction", toDoAction); if ((new OverrideAlert("", warning.String(), B_TRANSLATE("Do it"), (requireOverride ? B_SHIFT_KEY : 0), B_TRANSLATE("Cancel"), 0, NULL, @@ -742,7 +743,9 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode, return B_ERROR; } if (moveMode == kMoveSelectionTo - && !ConfirmChangeIfWellKnownDirectory(&entry, B_TRANSLATE("move"), + && !ConfirmChangeIfWellKnownDirectory(&entry, + B_TRANSLATE_COMMENT("move", "As in 'If you move ...'"), + B_TRANSLATE_COMMENT("move", "As in 'To move ...'"), false, &askOnceOnly)) { return B_ERROR; } diff --git a/src/kits/tracker/FSUtils.h b/src/kits/tracker/FSUtils.h index 56c76a2ff2..e434f3a35b 100644 --- a/src/kits/tracker/FSUtils.h +++ b/src/kits/tracker/FSUtils.h @@ -241,7 +241,11 @@ status_t FSFindTrackerSettingsDir(BPath *, bool autoCreate = true); bool FSIsDeskDir(const BEntry *); -bool ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *action, +// two separate ifYouDoAction and toDoAction versions are needed for localization +// purposes. The first one is used in "If you do action ..." sentence, +// the second one in the "To do action" sentence. +bool ConfirmChangeIfWellKnownDirectory(const BEntry *entry, + const char *ifYouDoAction, const char *toDoAction, bool dontAsk = false, int32 *confirmedAlready = NULL); bool CheckDevicesEqual(const entry_ref *entry, const Model *targetModel); diff --git a/src/kits/tracker/InfoWindow.cpp b/src/kits/tracker/InfoWindow.cpp index 25feb314aa..ca1f3270c5 100644 --- a/src/kits/tracker/InfoWindow.cpp +++ b/src/kits/tracker/InfoWindow.cpp @@ -432,7 +432,8 @@ BInfoWindow::MessageReceived(BMessage *message) { BEntry entry(fModel->EntryRef()); if (ConfirmChangeIfWellKnownDirectory(&entry, - B_TRANSLATE("rename"))) + B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), + B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'"))) fAttributeView->BeginEditingTitle(); break; } @@ -1222,7 +1223,8 @@ AttributeView::MouseDown(BPoint point) // You can't change the name of the trash if (!fModel->IsTrash() && ConfirmChangeIfWellKnownDirectory(&entry, - B_TRANSLATE("rename"), true) + B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), + B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'"), true) && fTitleEditView == 0) BeginEditingTitle(); } else if (fTitleEditView) { diff --git a/src/kits/tracker/TextWidget.cpp b/src/kits/tracker/TextWidget.cpp index 20b9801967..9a1f327017 100644 --- a/src/kits/tracker/TextWidget.cpp +++ b/src/kits/tracker/TextWidget.cpp @@ -331,7 +331,9 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose) BEntry entry(pose->TargetModel()->EntryRef()); if (entry.InitCheck() == B_OK - && !ConfirmChangeIfWellKnownDirectory(&entry, B_TRANSLATE("rename"))) + && !ConfirmChangeIfWellKnownDirectory(&entry, + B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), + B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'"))) return; // get bounds with full text length diff --git a/src/preferences/filetypes/FileTypeWindow.cpp b/src/preferences/filetypes/FileTypeWindow.cpp index 8b3d42e0c2..c44cd032f3 100644 --- a/src/preferences/filetypes/FileTypeWindow.cpp +++ b/src/preferences/filetypes/FileTypeWindow.cpp @@ -76,7 +76,8 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs) B_TRANSLATE("Select" B_UTF8_ELLIPSIS), new BMessage(kMsgSelectType)); fSameTypeAsButton = new BButton("same type as", - B_TRANSLATE("Same as" B_UTF8_ELLIPSIS), new BMessage(kMsgSameTypeAs)); + B_TRANSLATE_COMMENT("Same as" B_UTF8_ELLIPSIS, + "The same TYPE as" B_UTF8_ELLIPSIS), new BMessage(kMsgSameTypeAs)); fileTypeBox->AddChild(BGridLayoutBuilder(padding, padding) .Add(fTypeControl, 0, 0, 2, 1) @@ -113,8 +114,9 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs) new BMessage(kMsgSelectPreferredApp)); fSameAppAsButton = new BButton("same app as", - B_TRANSLATE("Same as" B_UTF8_ELLIPSIS), - new BMessage(kMsgSamePreferredAppAs)); + B_TRANSLATE_COMMENT("Same as" B_UTF8_ELLIPSIS, + "The same APPLICATION as" B_UTF8_ELLIPSIS), + new BMessage(kMsgSamePreferredAppAs)); preferredBox->AddChild(BGridLayoutBuilder(padding, padding) .Add(fPreferredField, 0, 0, 2, 1)