Ticket #1711: action_dialogs.diff

File action_dialogs.diff, 2.9 KB (added by dmartina, 15 years ago)

i18n and improvements in prompt building

  • src/file.c

    old new panel_compute_totals (WPanel *panel, con 
    16271627 * This array introduced to avoid translation problems. The former (op_names) 
    16281628 * is assumed to be nouns, suitable in dialog box titles; this one should 
    16291629 * contain whatever is used in prompt itself (i.e. in russian, it's verb). 
    1630  * Notice first symbol - it is to fool gettext and force these strings to 
    1631  * be different for it. First symbol is skipped while building a prompt. 
    16321630 * (I don't use spaces around the words, because someday they could be 
    16331631 * dropped, when widgets get smarter) 
    16341632 */ 
    1635 static const char *op_names1[] = { N_("1Copy"), N_("1Move"), N_("1Delete") }; 
     1633 
     1634/* TRANSLATORS: no need to translate 'action', it's just a context prefix  */ 
     1635static const char *op_names1[] = { N_("action|Copy"), N_("action|Move"), N_("action|Delete") }; 
    16361636#define FMD_XLEN 64 
    16371637 
    16381638int fmd_xlen = FMD_XLEN; 
    static const char *prompt_parts[] = { 
    16541654    N_("file"), N_("files"), N_("directory"), N_("directories"), 
    16551655    N_("files/directories"), N_(" with source mask:"), N_(" to:") 
    16561656}; 
     1657static const char *question_format = N_("%s?"); 
    16571658 
    16581659/* 
    16591660 * Generate user prompt for panel operation. 
    panel_operate_generate_prompt (const WPa 
    16701671    register int i; 
    16711672    char format_string[BUF_MEDIUM]; 
    16721673    char *dp = format_string; 
     1674    gboolean build_question=FALSE; 
    16731675 
    16741676#ifdef ENABLE_NLS 
    16751677    static int i18n_flag = 0; 
    16761678    if (!i18n_flag) { 
    16771679        for (i = sizeof (op_names1) / sizeof (op_names1[0]); i--;) 
    1678             op_names1[i] = _(op_names1[i]); 
     1680            op_names1[i] = Q_(op_names1[i]); 
    16791681 
    16801682        for (i = sizeof (prompt_parts) / sizeof (prompt_parts[0]); i--;) 
    16811683            prompt_parts[i] = _(prompt_parts[i]); 
    16821684 
    16831685        one_format = _(one_format); 
    16841686        many_format = _(many_format); 
     1687        question_format = _(question_format); 
    16851688        i18n_flag = 1; 
    16861689    } 
    16871690#endif                          /* ENABLE_NLS */ 
    panel_operate_generate_prompt (const WPa 
    16941697            cp = NULL; 
    16951698            switch (sp[1]) { 
    16961699            case 'o': 
    1697                 cp = op_names1[operation] + 1; 
     1700                cp = op_names1[operation]; 
    16981701                break; 
    16991702            case 'm': 
    1700                 cp = operation == OP_DELETE ? "?" : prompt_parts[5]; 
     1703                if (operation == OP_DELETE) { 
     1704                    build_question=TRUE; 
     1705                    cp=""; 
     1706                } else { 
     1707                    cp = prompt_parts[5]; 
     1708                } 
    17011709                break; 
    17021710            case 'e': 
    1703                 cp = operation == OP_DELETE ? "?" : prompt_parts[6]; 
     1711                if (operation == OP_DELETE) { 
     1712                    build_question=TRUE; 
     1713                    cp=""; 
     1714                } else { 
     1715                    cp = prompt_parts[6]; 
     1716                } 
    17041717                break; 
    17051718            case 'f': 
    17061719                if (single_source) { 
    panel_operate_generate_prompt (const WPa 
    17291742    } 
    17301743    *dp = '\0'; 
    17311744 
     1745    if (build_question) { 
     1746        g_snprintf (format_string, sizeof (format_string), 
     1747                   question_format, g_strdup(format_string)); 
     1748    } 
     1749 
    17321750    if (single_source) { 
    17331751        i = fmd_xlen - str_term_width1 (format_string) - 4; 
    17341752        g_snprintf (cmd_buf, sizeof (cmd_buf), format_string,