Re: [L10N] Kickoff of translation for Git 2.14.0 round 1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2017-07-18 0:06 GMT+08:00 Johannes Schindelin <Johannes.Schindelin@xxxxxx>:
> Hi,
>
> On Mon, 17 Jul 2017, Jiang Xin wrote:
>
>> 2017-07-16 3:30 GMT+08:00 Jean-Noël Avila <jn.avila@xxxxxxx>:
>> >
>> >
>> > A few remarks on i18n:
>> >
>> >  * commit cb71f8bdb5 ("PRItime: introduce a new "printf format" for
>> > timestamps") does not play well with i18n framework. The static string
>> > concatenation cannot be correctly interpreted by msgmerge. I don't know
>> > how we can combine variable format indicators with translatable strings.
>> >
>>
>> We can add a new wrapper for raw timestamp like:
>>
>>     +const char *format_raw_time(timestamp_t time)
>>     +{
>>     +       static struct strbuf time_buf = STRBUF_INIT;
>>     +
>>     +       strbuf_reset(&time_buf);
>>     +       strbuf_addf(&time_buf, "%"PRItime, time);
>>     +       return time_buf.buf;
>>     +}
>>
>>
>> , and replace macro PRItime in i18n messages with format_raw_time
>> wrapper, like this:
>>
>>     -                       strbuf_addf(&sb, Q_("%"PRItime" year",
>> "%"PRItime" years", years), years);
>>     +                       strbuf_addf(&sb, Q_("%s year", "%s years",
>> years), format_raw_time(years));
>
> That would come at the price of complexifying the code just to accommodate
> a translation tool.
>
> How do you gentle people deal with PRIuMAX?

Can we just use PRIuMAX instead of the macro PRItime?  PRIuMAX can be
handled properly by gettext utilities, while PRItime not.

If replace PRItime to PRIuMAX like this:

    -                        Q_("%"PRItime" second ago", "%"PRItime"
seconds ago", diff), diff);
    +                        Q_("%"PRIuMAX" second ago", "%"PRIuMAX"
seconds ago", diff), diff);

The above l10n message can be extracted properly by running `make pot`:

    #: date.c:122
    #, c-format
    msgid "%<PRIuMAX> second ago"
    msgid_plural "%<PRIuMAX> seconds ago"
    msgstr[0] ""
    msgstr[1] ""

> Ciao,
> Dscho



-- 
Jiang Xin




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux