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

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43175 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
John Scipione
2011-11-04 05:22:05 +00:00
parent da3e694679
commit 504f70a6e1
4 changed files with 72 additions and 38 deletions
+43 -29
View File
@@ -135,12 +135,6 @@ bool DirectoryMatches(const BEntry *, const char *additionalPath,
status_t empty_trash(void *); status_t empty_trash(void *);
#ifdef __HAIKU__
#define OS_NAME "Haiku"
#else
#define OS_NAME "BeOS"
#endif
static const char* kDeleteConfirmationStr = static const char* kDeleteConfirmationStr =
B_TRANSLATE_MARK("Are you sure you want to delete the " B_TRANSLATE_MARK("Are you sure you want to delete the "
@@ -612,8 +606,9 @@ enum {
bool bool
ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction, ConfirmChangeIfWellKnownDirectory(const BEntry *entry,
const char *toDoAction, bool dontAsk, int32 *confirmedAlready) const char *ifYouDoAction, const char *toDoAction,
const char *toConfirmAction, bool dontAsk, int32 *confirmedAlready)
{ {
// Don't let the user casually move/change important files/folders // Don't let the user casually move/change important files/folders
// //
@@ -638,21 +633,22 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction
if (DirectoryMatchesOrContains(entry, B_SYSTEM_DIRECTORY)) { if (DirectoryMatchesOrContains(entry, B_SYSTEM_DIRECTORY)) {
warning.SetTo( warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the system folder or its " B_TRANSLATE("If you %ifYouDoAction the system folder or its "
"contents, you won't be able to boot " OS_NAME "! Are you sure you " "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 " "want to do this? To %toDoAction the system folder or its "
"anyway, hold down the Shift key and click \"Do it\".")); "contents anyway, hold down the Shift key and click "
"\"%toConfirmAction\"."));
} else if (DirectoryMatches(entry, B_COMMON_DIRECTORY)) { } else if (DirectoryMatches(entry, B_COMMON_DIRECTORY)) {
warning.SetTo( warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the common folder, " OS_NAME B_TRANSLATE("If you %ifYouDoAction the common folder, Haiku "
" may not behave properly! Are you sure you want to do this? " "may not behave properly! Are you sure you want to do this? "
"To %toDoAction the common folder anyway, hold down the " "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)) { } else if (DirectoryMatches(entry, B_USER_DIRECTORY)) {
warning .SetTo( warning .SetTo(
B_TRANSLATE("If you %ifYouDoAction the home folder, " OS_NAME B_TRANSLATE("If you %ifYouDoAction the home folder, Haiku "
" may not behave properly! Are you sure you want to do this? " "may not behave properly! Are you sure you want to do this? "
"To %toDoAction the home folder anyway, hold down the " "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) } else if (DirectoryMatchesOrContains(entry, B_USER_CONFIG_DIRECTORY)
|| DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) { || DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) {
@@ -661,22 +657,25 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction
|| DirectoryMatchesOrContains(entry, "beos_mime", || DirectoryMatchesOrContains(entry, "beos_mime",
B_COMMON_SETTINGS_DIRECTORY)) { B_COMMON_SETTINGS_DIRECTORY)) {
warning.SetTo( warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the mime settings, " OS_NAME B_TRANSLATE("If you %ifYouDoAction the mime settings, Haiku "
" may not behave properly! Are you sure you want to do this? " "may not behave properly! Are you sure you want to do this? "
"To %toDoAction the mime settings anyway, click \"Do it\".")); "To %toDoAction the mime settings anyway, click "
"\"%toConfirmAction\"."));
requireOverride = false; requireOverride = false;
} else if (DirectoryMatches(entry, B_USER_CONFIG_DIRECTORY)) { } else if (DirectoryMatches(entry, B_USER_CONFIG_DIRECTORY)) {
warning.SetTo( warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the config folder, " OS_NAME B_TRANSLATE("If you %ifYouDoAction the config folder, Haiku "
" may not behave properly! Are you sure you want to do this? " "may not behave properly! Are you sure you want to do this? "
"To %toDoAction the config folder anyway, click \"Do it\".")); "To %toDoAction the config folder anyway, click "
"\"%toConfirmAction\"."));
requireOverride = false; requireOverride = false;
} else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY) } else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY)
|| DirectoryMatches(entry, B_COMMON_SETTINGS_DIRECTORY)) { || DirectoryMatches(entry, B_COMMON_SETTINGS_DIRECTORY)) {
warning.SetTo( warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the settings folder, " OS_NAME B_TRANSLATE("If you %ifYouDoAction the settings folder, Haiku "
" may not behave properly! Are you sure you want to do this? " "may not behave properly! Are you sure you want to do this? "
"To %toDoAction the settings folder anyway, click \"Do it\".")); "To %toDoAction the settings folder anyway, click "
"\"%toConfirmAction\"."));
requireOverride = false; requireOverride = false;
} }
} }
@@ -694,9 +693,18 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction
warning.ReplaceFirst("%ifYouDoAction", ifYouDoAction); warning.ReplaceFirst("%ifYouDoAction", ifYouDoAction);
warning.ReplaceFirst("%toDoAction", toDoAction); 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(), 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); B_TRANSLATE("Cancel"), 0, NULL, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(1, B_ESCAPE); alert->SetShortcut(1, B_ESCAPE);
if (alert->Go() == 1) { if (alert->Go() == 1) {
@@ -756,8 +764,14 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode,
} }
if (moveMode == kMoveSelectionTo if (moveMode == kMoveSelectionTo
&& !ConfirmChangeIfWellKnownDirectory(&entry, && !ConfirmChangeIfWellKnownDirectory(&entry,
B_TRANSLATE_COMMENT("move", "As in 'If you move ...'"), B_TRANSLATE_COMMENT("move",
B_TRANSLATE_COMMENT("move", "As in 'To 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)) { false, &askOnceOnly)) {
return B_ERROR; return B_ERROR;
} }
+2 -1
View File
@@ -247,7 +247,8 @@ bool FSIsDeskDir(const BEntry *);
// the second one in the "To do action" sentence. // the second one in the "To do action" sentence.
bool ConfirmChangeIfWellKnownDirectory(const BEntry *entry, bool ConfirmChangeIfWellKnownDirectory(const BEntry *entry,
const char *ifYouDoAction, const char *toDoAction, 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); bool CheckDevicesEqual(const entry_ref *entry, const Model *targetModel);
+19 -6
View File
@@ -433,8 +433,14 @@ BInfoWindow::MessageReceived(BMessage *message)
BEntry entry(fModel->EntryRef()); BEntry entry(fModel->EntryRef());
if (!fModel->HasLocalizedName() if (!fModel->HasLocalizedName()
&& ConfirmChangeIfWellKnownDirectory(&entry, && ConfirmChangeIfWellKnownDirectory(&entry,
B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), B_TRANSLATE_COMMENT("rename",
B_TRANSLATE_COMMENT("rename", "As in 'To 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(); fAttributeView->BeginEditingTitle();
break; break;
} }
@@ -799,7 +805,8 @@ BInfoWindow::OpenFilePanel(const entry_ref *ref)
if (fFilePanel != NULL) { if (fFilePanel != NULL) {
fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Select")); fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Select"));
fFilePanel->Window()->ResizeTo(500, 300); 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()); title.ReplaceFirst("%name", fModel->Name());
fFilePanel->Window()->SetTitle(title.String()); fFilePanel->Window()->SetTitle(title.String());
fFilePanel->Show(); fFilePanel->Show();
@@ -1223,9 +1230,15 @@ AttributeView::MouseDown(BPoint point)
} else if (fTitleRect.Contains(point)) { } else if (fTitleRect.Contains(point)) {
if (!fModel->HasLocalizedName() if (!fModel->HasLocalizedName()
&& ConfirmChangeIfWellKnownDirectory(&entry, && ConfirmChangeIfWellKnownDirectory(&entry,
B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), B_TRANSLATE_COMMENT("rename",
B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'"), true) "As in 'if you rename this folder...' (en) "
&& fTitleEditView == 0) "'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(); BeginEditingTitle();
} else if (fTitleEditView) { } else if (fTitleEditView) {
FinishEditingTitle(true); FinishEditingTitle(true);
+8 -2
View File
@@ -324,8 +324,14 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose)
BEntry entry(pose->TargetModel()->EntryRef()); BEntry entry(pose->TargetModel()->EntryRef());
if (entry.InitCheck() == B_OK if (entry.InitCheck() == B_OK
&& !ConfirmChangeIfWellKnownDirectory(&entry, && !ConfirmChangeIfWellKnownDirectory(&entry,
B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"), B_TRANSLATE_COMMENT("rename",
B_TRANSLATE_COMMENT("rename", "As in 'To 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; return;
// get bounds with full text length // get bounds with full text length