Ticket #7767: Tracker_alert_label_to_verb_4.diff

File Tracker_alert_label_to_verb_4.diff, 9.2 KB (added by jscipione, 12 years ago)

Update ConfirmChangeIfWellKnownDirectory to take 3 string arguments instead of 2, the extra one is accept verb translations in languages (like German) where there is a different word for the verb in different contexts. Also add German examples to help translators. I had some help from DeadYak to get these translation examples right but they could still be off a bit, I have no way to know since I don't speak German.

  • src/kits/tracker/FSUtils.cpp

    diff --git src/kits/tracker/FSUtils.cpp src/kits/tracker/FSUtils.cpp
    index 1af1220..9058c7e 100644
    bool DirectoryMatches(const BEntry *, const char *additionalPath,  
    135135
    136136status_t empty_trash(void *);
    137137
    138 #ifdef __HAIKU__
    139     #define OS_NAME "Haiku"
    140 #else
    141     #define OS_NAME "BeOS"
    142 #endif
    143 
    144138
    145139static const char* kDeleteConfirmationStr =
    146140    B_TRANSLATE_MARK("Are you sure you want to delete the "
    enum {  
    612606
    613607
    614608bool
    615 ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction,
    616     const char *toDoAction, bool dontAsk, int32 *confirmedAlready)
     609ConfirmChangeIfWellKnownDirectory(const BEntry *entry,
     610    const char *ifYouDoAction, const char *toDoAction,
     611    const char *toConfirmAction, bool dontAsk, int32 *confirmedAlready)
    617612{
    618613    // Don't let the user casually move/change important files/folders
    619614    //
    ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction  
    638633    if (DirectoryMatchesOrContains(entry, B_SYSTEM_DIRECTORY)) {
    639634        warning.SetTo(
    640635            B_TRANSLATE("If you %ifYouDoAction the system folder or its "
    641             "contents, you won't be able to boot " OS_NAME "! Are you sure you "
    642             "want to do this? To %toDoAction the system folder or its contents "
    643             "anyway, hold down the Shift key and click \"Do it\"."));
     636            "contents, you won't be able to boot Haiku! Are you sure you "
     637            "want to do this? To %toDoAction the system folder or its "
     638            "contents anyway, hold down the Shift key and click "
     639            "\"%toConfirmAction\"."));
    644640    } else if (DirectoryMatches(entry, B_COMMON_DIRECTORY)) {
    645641        warning.SetTo(
    646             B_TRANSLATE("If you %ifYouDoAction the common folder, " OS_NAME
    647             " may not behave properly! Are you sure you want to do this? "
     642            B_TRANSLATE("If you %ifYouDoAction the common folder, Haiku "
     643            "may not behave properly! Are you sure you want to do this? "
    648644            "To %toDoAction the common folder anyway, hold down the "
    649             "Shift key and click \"Do it\"."));
     645            "Shift key and click \"%toConfirmAction\"."));
    650646    } else if (DirectoryMatches(entry, B_USER_DIRECTORY)) {
    651647        warning .SetTo(
    652             B_TRANSLATE("If you %ifYouDoAction the home folder, " OS_NAME
    653             " may not behave properly! Are you sure you want to do this? "
     648            B_TRANSLATE("If you %ifYouDoAction the home folder, Haiku "
     649            "may not behave properly! Are you sure you want to do this? "
    654650            "To %toDoAction the home folder anyway, hold down the "
    655             "Shift key and click \"Do it\"."));
     651            "Shift key and click \"%toConfirmAction\"."));
    656652    } else if (DirectoryMatchesOrContains(entry, B_USER_CONFIG_DIRECTORY)
    657653        || DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) {
    658654
    ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction  
    661657            || DirectoryMatchesOrContains(entry, "beos_mime",
    662658                B_COMMON_SETTINGS_DIRECTORY)) {
    663659            warning.SetTo(
    664                 B_TRANSLATE("If you %ifYouDoAction the mime settings, " OS_NAME
    665                 " may not behave properly! Are you sure you want to do this? "
    666                 "To %toDoAction the mime settings anyway, click \"Do it\"."));
     660                B_TRANSLATE("If you %ifYouDoAction the mime settings, Haiku "
     661                "may not behave properly! Are you sure you want to do this? "
     662                "To %toDoAction the mime settings anyway, click "
     663                "\"%toConfirmAction\"."));
    667664            requireOverride = false;
    668665        } else if (DirectoryMatches(entry, B_USER_CONFIG_DIRECTORY)) {
    669666            warning.SetTo(
    670                 B_TRANSLATE("If you %ifYouDoAction the config folder, " OS_NAME
    671                 " may not behave properly! Are you sure you want to do this? "
    672                 "To %toDoAction the config folder anyway, click \"Do it\"."));
     667                B_TRANSLATE("If you %ifYouDoAction the config folder, Haiku "
     668                "may not behave properly! Are you sure you want to do this? "
     669                "To %toDoAction the config folder anyway, click "
     670                "\"%toConfirmAction\"."));
    673671            requireOverride = false;
    674672        } else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY)
    675673            || DirectoryMatches(entry, B_COMMON_SETTINGS_DIRECTORY)) {
    676674            warning.SetTo(
    677                 B_TRANSLATE("If you %ifYouDoAction the settings folder, " OS_NAME
    678                 " may not behave properly! Are you sure you want to do this? "
    679                 "To %toDoAction the settings folder anyway, click \"Do it\"."));
     675                B_TRANSLATE("If you %ifYouDoAction the settings folder, Haiku "
     676                "may not behave properly! Are you sure you want to do this? "
     677                "To %toDoAction the settings folder anyway, click "
     678                "\"%toConfirmAction\"."));
    680679            requireOverride = false;
    681680        }
    682681    }
    ConfirmChangeIfWellKnownDirectory(const BEntry *entry, const char *ifYouDoAction  
    694693
    695694    warning.ReplaceFirst("%ifYouDoAction", ifYouDoAction);
    696695    warning.ReplaceFirst("%toDoAction", toDoAction);
     696    warning.ReplaceFirst("%toConfirmAction", toConfirmAction);
     697    warning.ReplaceLast("%toConfirmAction",
     698        BString(toConfirmAction).Capitalize().String());
     699
     700    BString buttonLabel(B_TRANSLATE_COMMENT("%toConfirmAction",
     701        "Action label for the button, e.g. Rename"));
     702    buttonLabel.ReplaceFirst("%toConfirmAction",
     703        BString(toConfirmAction).Capitalize().String());
    697704
    698705    OverrideAlert *alert = new OverrideAlert("", warning.String(),
    699         B_TRANSLATE("Do it"), (requireOverride ? B_SHIFT_KEY : 0),
     706        buttonLabel.String(), (requireOverride ? B_SHIFT_KEY : 0),
    700707        B_TRANSLATE("Cancel"), 0, NULL, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    701708    alert->SetShortcut(1, B_ESCAPE);
    702709    if (alert->Go() == 1) {
    InitCopy(CopyLoopControl* loopControl, uint32 moveMode,  
    756763        }
    757764        if (moveMode == kMoveSelectionTo
    758765            && !ConfirmChangeIfWellKnownDirectory(&entry,
    759                 B_TRANSLATE_COMMENT("move", "As in 'If you move ...'"),
    760                 B_TRANSLATE_COMMENT("move", "As in 'To move ...'"),
     766                B_TRANSLATE_COMMENT("move",
     767                    "As in 'if you move this folder...' (en) \
     768                    'Wenn Sie dieses Ordner verschieben...' (de)"),
     769                B_TRANSLATE_COMMENT("move",
     770                    "As in 'to move this folder...' (en) \
     771                    'in diesen Ordner verschieben...' (de)"),
     772                B_TRANSLATE_COMMENT("move",
     773                    "Button label, 'Move' (en) 'Verschieben' (de)"),
    761774                false, &askOnceOnly)) {
    762775            return B_ERROR;
    763776        }
  • src/kits/tracker/FSUtils.h

    diff --git src/kits/tracker/FSUtils.h src/kits/tracker/FSUtils.h
    index eb35902..d033e0b 100644
    bool FSIsDeskDir(const BEntry *);  
    247247// the second one in the "To do action" sentence.
    248248bool ConfirmChangeIfWellKnownDirectory(const BEntry *entry,
    249249    const char *ifYouDoAction, const char *toDoAction,
    250     bool dontAsk = false, int32 *confirmedAlready = NULL);
     250    const char *toConfirmAction, bool dontAsk = false,
     251    int32 *confirmedAlready = NULL);
    251252
    252253bool CheckDevicesEqual(const entry_ref *entry, const Model *targetModel);
    253254
  • src/kits/tracker/InfoWindow.cpp

    diff --git src/kits/tracker/InfoWindow.cpp src/kits/tracker/InfoWindow.cpp
    index ade064c..063a00e 100644
    BInfoWindow::MessageReceived(BMessage *message)  
    433433            BEntry entry(fModel->EntryRef());
    434434            if (!fModel->HasLocalizedName()
    435435                && ConfirmChangeIfWellKnownDirectory(&entry,
    436                 B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"),
    437                 B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'")))
     436                B_TRANSLATE_COMMENT("rename",
     437                    "As in 'if you rename this folder...' (en) \
     438                    'Wenn Sie dieses Ordner umbenannt...' (de)"),
     439                B_TRANSLATE_COMMENT("rename",
     440                    "As in 'to rename this folder...' (en) \
     441                    'in diesen Ordner umzubenennen...' (de)"),
     442                B_TRANSLATE_COMMENT("rename",
     443                    "Button label, 'Rename' (en) 'Umbenennen' (de)")));
    438444                fAttributeView->BeginEditingTitle();
    439445            break;
    440446        }
    AttributeView::MouseDown(BPoint point)  
    12231229    } else if (fTitleRect.Contains(point)) {
    12241230        if (!fModel->HasLocalizedName()
    12251231            && ConfirmChangeIfWellKnownDirectory(&entry,
    1226                 B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"),
    1227                 B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'"), true)
    1228             && fTitleEditView == 0)
     1232                B_TRANSLATE_COMMENT("rename",
     1233                    "As in 'if you rename this folder...' (en) \
     1234                    'Wenn Sie dieses Ordner umbenannt...' (de)"),
     1235                B_TRANSLATE_COMMENT("rename",
     1236                    "As in 'to rename this folder...' (en) \
     1237                    'in diesen Ordner umzubenennen...' (de)"),
     1238                B_TRANSLATE_COMMENT("rename",
     1239                    "Button label, 'Rename' (en) 'Umbenennen' (de)"), true)
     1240            && fTitleEditView == 0);
    12291241            BeginEditingTitle();
    12301242    } else if (fTitleEditView) {
    12311243        FinishEditingTitle(true);
  • src/kits/tracker/TextWidget.cpp

    diff --git src/kits/tracker/TextWidget.cpp src/kits/tracker/TextWidget.cpp
    index 8a47fcf..6a9309a 100644
    BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose)  
    324324    BEntry entry(pose->TargetModel()->EntryRef());
    325325    if (entry.InitCheck() == B_OK
    326326        && !ConfirmChangeIfWellKnownDirectory(&entry,
    327                 B_TRANSLATE_COMMENT("rename", "As in 'If you rename ...'"),
    328                 B_TRANSLATE_COMMENT("rename", "As in 'To rename ...'")))
     327            B_TRANSLATE_COMMENT("rename",
     328                "As in 'if you rename this folder...' (en) \
     329                'Wenn Sie dieses Ordner umbenannt...' (de)"),
     330            B_TRANSLATE_COMMENT("rename",
     331                "As in 'to rename this folder...' (en) \
     332                'in diesen Ordner umzubenennen...' (de)"),
     333            B_TRANSLATE_COMMENT("rename",
     334                "Button label, 'Rename' (en) 'Umbenennen' (de)")))
    329335        return;
    330336
    331337    // get bounds with full text length