Thread (6 messages) flat view 6 messages, 2 authors, 2016-06-16

Re: [PATCH v3][Outreachy] branch -D: allow - as abbreviation of @{-1}

From: elena petrashen <hidden>
Date: 2016-06-16 02:18:40

On Tue, Apr 5, 2016 at 12:53 AM, Remi Galan Alfonso
[off-list ref] wrote:
elena petrashen [off-list ref] wrote:
quoted
On Thu, Mar 31, 2016 at 6:31 PM, Remi Galan Alfonso
[off-list ref] wrote:
quoted
Elena Petrashen [off-list ref] wrote:
quoted
+void delete_branch_advice(const char *name, const char *ref)
+{
+        const char fmt[] =
+        "\nNote: to restore the deleted branch:\n\ngit branch %s %s\n";
Shouldn't that be marked for translation, like is done with the other
strings?

Thanks,
Rémi
Thank you for letting me know about that! Could you please
help me out and explain how do I mark it for translation? I tried
to do it the same way as with the other strings but evidently
didn't quite succeed.
I am not sure.
I tried to grep similar cases, it seems that you can do the following:

        const char fmt[] = N_("\nNote: to restore [...] \ngit branch %s %s\n");
        fprintf(stderr, _(fmt), name, ref);

Some similar example in builtin/add.c:

        static const char ignore_error[] =
        N_("The following paths are ignored by one of your .gitignore files:\n");
        [...]
                        fprintf(stderr, _(ignore_error));

Or you can define fmt as a 'const char *' and in that case do the
following:

        const char *fmt = _("\nNote: to restore [...] \n git branch %s %s\n");
        fprintf(stderr, fmt, name, ref);


In builtin/am.c:
                const char *invalid_line = _("Malformed input line: '%s'.");
        [...]
                                ret = error(invalid_line, sb.buf);

I don't know which one is the best way to go though.

Thanks,
Rémi
Thank you! I'm a bit confused though as the previous implemented advice function
in advice.c (the one I used for reference) doesn't seem to employ this... does
this mean it's also not marked for translation?

void detach_advice(const char *new_name)
{
const char fmt[] =
"Note: checking out '%s'.\n\n"
"You are in 'detached HEAD' state. <.........>Example:\n\n"
"  git checkout -b <new-branch-name>\n\n";

fprintf(stderr, fmt, new_name);
}

Cheers,
Elena
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help