cc'in Matthieu since he wrote the patch.

On Sat, Nov 19, 2016 at 4:16 AM, Jakub Narębski <jna...@gmail.com> wrote:
> W dniu 08.11.2016 o 21:12, Karthik Nayak pisze:
>> From: Karthik Nayak <karthik....@gmail.com>
>>
>> Introduce setup_ref_filter_porcelain_msg() so that the messages used in
>> the atom %(upstream:track) can be translated if needed. This is needed
>> as we port branch.c to use ref-filter's printing API's.
>>
>> Written-by: Matthieu Moy <matthieu....@grenoble-inp.fr>
>> Mentored-by: Christian Couder <christian.cou...@gmail.com>
>> Mentored-by: Matthieu Moy <matthieu....@grenoble-inp.fr>
>> Signed-off-by: Karthik Nayak <karthik....@gmail.com>
>> ---
>>  ref-filter.c | 28 ++++++++++++++++++++++++----
>>  ref-filter.h |  2 ++
>>  2 files changed, 26 insertions(+), 4 deletions(-)
>>
>> diff --git a/ref-filter.c b/ref-filter.c
>> index b47b900..944671a 100644
>> --- a/ref-filter.c
>> +++ b/ref-filter.c
>> @@ -15,6 +15,26 @@
>>  #include "version.h"
>>  #include "wt-status.h"
>>
>> +static struct ref_msg {
>> +     const char *gone;
>> +     const char *ahead;
>> +     const char *behind;
>> +     const char *ahead_behind;
>> +} msgs = {
>> +     "gone",
>> +     "ahead %d",
>> +     "behind %d",
>> +     "ahead %d, behind %d"
>> +};
>> +
>> +void setup_ref_filter_porcelain_msg(void)
>> +{
>> +     msgs.gone = _("gone");
>> +     msgs.ahead = _("ahead %d");
>> +     msgs.behind = _("behind %d");
>> +     msgs.ahead_behind = _("ahead %d, behind %d");
>> +}
>
> Do I understand it correctly that this mechanism is here to avoid
> repeated calls into gettext, as those messages would get repeated
> over and over; otherwise one would use foo = N_("...") and _(foo),
> isn't it?
>
> I wonder if there is some way to avoid duplication here, but I don't
> see anything easy and safe (e.g. against running setup_*() twice).
>

That is the intention.

-- 
Regards,
Karthik Nayak

Reply via email to