Author: jscipione Date: 2011-11-04 06:22:05 +0100 (Fri, 04 Nov 2011) New Revision: 43175 Changeset: https://dev.haiku-os.org/changeset/43175 Ticket: https://dev.haiku-os.org/ticket/7767 Modified: haiku/trunk/src/kits/tracker/FSUtils.cpp haiku/trunk/src/kits/tracker/FSUtils.h haiku/trunk/src/kits/tracker/InfoWindow.cpp haiku/trunk/src/kits/tracker/TextWidget.cpp Log: Change the text and button label of the activate button on Tracker dialogs that appear when you try to rename or move an important system folder such as 'system' or 'config' from the generic (and a little non-standard) 'Do It' to a proper verb such as 'Rename' or 'Move'. I take localization into account, there are now 3 different variables that need to be translated, first is %ifYouDoAction which is the action verb in one form, second is %toDoAction which is the action verb but in a different form, and third is %toConfirmAction which is the text that appears on the button label itself. Although in English there is no distinction between %ifYouDoAction and %toDoAction (both use the same verb e.g. rename) there is a distinction in other languages such as German. Comments are provided in English and German using B_TRANSLATE_COMMENT as a help for translators. I had some help from DeadYak and Humdinger getting the German translations right since I only speak English (thanks guys). Humdinger also directed me to the verb form translation issue in the first place. I also removed the OSNAME macro and just use 'Haiku' instead since we aren't maintaining an OpenTracker port for BeOS anymore. Ingo aka bonefish indicated that this change could be a bit of a problem for distributions (were there any) but if we actually wanted to support distributions we'd want to use a global OSNAME macro somewhere else as I am sure the word 'Haiku' must appear in the source in other places. Closes #7767 Modified: haiku/trunk/src/kits/tracker/FSUtils.cpp =================================================================== --- haiku/trunk/src/kits/tracker/FSUtils.cpp 2011-11-03 22:28:19 UTC (rev 43174) +++ haiku/trunk/src/kits/tracker/FSUtils.cpp 2011-11-04 05:22:05 UTC (rev 43175) @@ -135,13 +135,7 @@ status_t empty_trash(void *); -#ifdef __HAIKU__ - #define OS_NAME "Haiku" -#else - #define OS_NAME "BeOS" -#endif - static const char* kDeleteConfirmationStr = B_TRANSLATE_MARK("Are you sure you want to delete the " "selected item(s)? This operation cannot be reverted."); @@ -612,8 +606,9 @@ bool -ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction, - const char *toDoAction, bool dontAsk, int32 *confirmedAlready) +ConfirmChangeIfWellKnownDirectory(const BEntry *entry, + const char *ifYouDoAction, const char *toDoAction, + const char *toConfirmAction, bool dontAsk, int32 *confirmedAlready) { // Don't let the user casually move/change important files/folders // @@ -638,21 +633,22 @@ if (DirectoryMatchesOrContains(entry, B_SYSTEM_DIRECTORY)) { warning.SetTo( 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\".")); + "contents, you won't be able to boot Haiku! Are you sure you " + "want to do this? To %toDoAction the system folder or its " + "contents anyway, hold down the Shift key and click " + "\"%toConfirmAction\".")); } else if (DirectoryMatches(entry, B_COMMON_DIRECTORY)) { warning.SetTo( - B_TRANSLATE("If you %ifYouDoAction the common folder, " OS_NAME - " may not behave properly! Are you sure you want to do this? " + B_TRANSLATE("If you %ifYouDoAction the common folder, Haiku " + "may not behave properly! Are you sure you want to do this? " "To %toDoAction the common folder anyway, hold down the " - "Shift key and click \"Do it\".")); + "Shift key and click \"%toConfirmAction\".")); } else if (DirectoryMatches(entry, B_USER_DIRECTORY)) { warning .SetTo( - B_TRANSLATE("If you %ifYouDoAction the home folder, " OS_NAME - " may not behave properly! Are you sure you want to do this? " + B_TRANSLATE("If you %ifYouDoAction the home folder, Haiku " + "may not behave properly! Are you sure you want to do this? " "To %toDoAction the home folder anyway, hold down the " - "Shift key and click \"Do it\".")); + "Shift key and click \"%toConfirmAction\".")); } else if (DirectoryMatchesOrContains(entry, B_USER_CONFIG_DIRECTORY) || DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) { @@ -661,22 +657,25 @@ || DirectoryMatchesOrContains(entry, "beos_mime", B_COMMON_SETTINGS_DIRECTORY)) { warning.SetTo( - B_TRANSLATE("If you %ifYouDoAction the mime settings, " OS_NAME - " may not behave properly! Are you sure you want to do this? " - "To %toDoAction the mime settings anyway, click \"Do it\".")); + B_TRANSLATE("If you %ifYouDoAction the mime settings, Haiku " + "may not behave properly! Are you sure you want to do this? " + "To %toDoAction the mime settings anyway, click " + "\"%toConfirmAction\".")); requireOverride = false; } else if (DirectoryMatches(entry, B_USER_CONFIG_DIRECTORY)) { warning.SetTo( - B_TRANSLATE("If you %ifYouDoAction the config folder, " OS_NAME - " may not behave properly! Are you sure you want to do this? " - "To %toDoAction the config folder anyway, click \"Do it\".")); + B_TRANSLATE("If you %ifYouDoAction the config folder, Haiku " + "may not behave properly! Are you sure you want to do this? " + "To %toDoAction the config folder anyway, click " + "\"%toConfirmAction\".")); requireOverride = false; } else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY) || DirectoryMatches(entry, B_COMMON_SETTINGS_DIRECTORY)) { warning.SetTo( - B_TRANSLATE("If you %ifYouDoAction the settings folder, " OS_NAME - " may not behave properly! Are you sure you want to do this? " - "To %toDoAction the settings folder anyway, click \"Do it\".")); + B_TRANSLATE("If you %ifYouDoAction the settings folder, Haiku " + "may not behave properly! Are you sure you want to do this? " + "To %toDoAction the settings folder anyway, click " + "\"%toConfirmAction\".")); requireOverride = false; } } @@ -694,9 +693,18 @@ warning.ReplaceFirst("%ifYouDoAction", ifYouDoAction); warning.ReplaceFirst("%toDoAction", toDoAction); + warning.ReplaceFirst("%toConfirmAction", + BString(toConfirmAction).Capitalize().String()); + warning.ReplaceLast("%toConfirmAction", + BString(toConfirmAction).Capitalize().String()); + BString buttonLabel(B_TRANSLATE_COMMENT("%toConfirmAction", + "Action label for the button, e.g. Rename")); + buttonLabel.ReplaceFirst("%toConfirmAction", + BString(toConfirmAction).Capitalize().String()); + OverrideAlert *alert = new OverrideAlert("", warning.String(), - B_TRANSLATE("Do it"), (requireOverride ? B_SHIFT_KEY : 0), + buttonLabel.String(), (requireOverride ? B_SHIFT_KEY : 0), B_TRANSLATE("Cancel"), 0, NULL, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(1, B_ESCAPE); if (alert->Go() == 1) { @@ -756,8 +764,14 @@ } if (moveMode == kMoveSelectionTo && !ConfirmChangeIfWellKnownDirectory(&entry, - B_TRANSLATE_COMMENT("move", "As in 'If you move ...'"), - B_TRANSLATE_COMMENT("move", "As in 'To move ...'"), + B_TRANSLATE_COMMENT("move", + "As in 'if you move this folder...' (en) " + "'Wird dieser Ordner verschoben...' (de)"), + B_TRANSLATE_COMMENT("move", + "As in 'to move this folder...' (en) " + "Um diesen Ordner zu verschieben...' (de)"), + B_TRANSLATE_COMMENT("move", + "Button label, 'Move' (en), 'Verschieben' (de)"), false, &askOnceOnly)) { return B_ERROR; } Modified: haiku/trunk/src/kits/tracker/FSUtils.h =================================================================== --- haiku/trunk/src/kits/tracker/FSUtils.h 2011-11-03 22:28:19 UTC (rev 43174) +++ haiku/trunk/src/kits/tracker/FSUtils.h 2011-11-04 05:22:05 UTC (rev 43175) @@ -247,7 +247,8 @@ // 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); + const char *toConfirmAction, bool dontAsk = false, + int32 *confirmedAlready = NULL); bool CheckDevicesEqual(const entry_ref *entry, const Model *targetModel); Modified: haiku/trunk/src/kits/tracker/InfoWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/InfoWindow.cpp 2011-11-03 22:28:19 UTC (rev 43174) +++ haiku/trunk/src/kits/tracker/InfoWindow.cpp 2011-11-04 05:22:05 UTC (rev 43175) @@ -433,8 +433,14 @@ BEntry entry(fModel->EntryRef()); if (!fModel->HasLocalizedName() && ConfirmChangeIfWellKnownDirectory(&entry, - B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), - B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'"))) + B_TRANSLATE_COMMENT("rename", + "As in 'if you rename this folder...' (en) " + "'Wird dieser Ordner umbenannt...' (de)"), + B_TRANSLATE_COMMENT("rename", + "As in 'to rename this folder...' (en) " + "'Um diesen Ordner umzubenennen...' (de)"), + B_TRANSLATE_COMMENT("rename", + "Button label, 'Rename' (en), 'Umbenennen' (de)"))); fAttributeView->BeginEditingTitle(); break; } @@ -799,7 +805,8 @@ if (fFilePanel != NULL) { fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Select")); fFilePanel->Window()->ResizeTo(500, 300); - BString title(B_TRANSLATE_COMMENT("Link \"%name\" to:", "File dialog title for new sym link")); + BString title(B_TRANSLATE_COMMENT("Link \"%name\" to:", + "File dialog title for new sym link")); title.ReplaceFirst("%name", fModel->Name()); fFilePanel->Window()->SetTitle(title.String()); fFilePanel->Show(); @@ -1223,9 +1230,15 @@ } else if (fTitleRect.Contains(point)) { if (!fModel->HasLocalizedName() && ConfirmChangeIfWellKnownDirectory(&entry, - B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), - B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'"), true) - && fTitleEditView == 0) + B_TRANSLATE_COMMENT("rename", + "As in 'if you rename this folder...' (en) " + "'Wird dieser Ordner umbenannt...' (de)"), + B_TRANSLATE_COMMENT("rename", + "As in 'to rename this folder...' (en) " + "'Um diesen Ordner umzubenennen...' (de)"), + B_TRANSLATE_COMMENT("rename", + "Button label, 'Rename' (en), 'Umbenennen' (de)"), true) + && fTitleEditView == 0); BeginEditingTitle(); } else if (fTitleEditView) { FinishEditingTitle(true); Modified: haiku/trunk/src/kits/tracker/TextWidget.cpp =================================================================== --- haiku/trunk/src/kits/tracker/TextWidget.cpp 2011-11-03 22:28:19 UTC (rev 43174) +++ haiku/trunk/src/kits/tracker/TextWidget.cpp 2011-11-04 05:22:05 UTC (rev 43175) @@ -324,8 +324,14 @@ BEntry entry(pose->TargetModel()->EntryRef()); if (entry.InitCheck() == B_OK && !ConfirmChangeIfWellKnownDirectory(&entry, - B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), - B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'"))) + B_TRANSLATE_COMMENT("rename", + "As in 'if you rename this folder...' (en) " + "'Wird dieser Ordner umbenannt...' (de)"), + B_TRANSLATE_COMMENT("rename", + "As in 'to rename this folder...' (en) " + "'Um diesen Ordner umzubenennen...' (de)"), + B_TRANSLATE_COMMENT("rename", + "Button label, 'Rename' (en), 'Umbenennen' (de)"))) return; // get bounds with full text length