Junio C Hamano <[email protected]> writes:
> Duy Nguyen <[email protected]> writes:
>
>> What can I say, gettext is smart. In gc.c we already have this
>>
>> die(_("gc is already running on machine '%s' pid %"PRIuMAX" (use
>> --force if not)"), name, (uintmax_t)pid);
>>
>> and vi.po shows
>>
>> #: builtin/gc.c:397
>> #, c-format
>> msgid ""
>> "gc is already running on machine '%s' pid %<PRIuMAX> (use --force if not)"
>
> And translators are expcted to keep "%<PRIuMAX>" in their translated
> .po files, and whatever translates .po into .mo knows what
> %<PRIuMAX> should be mapped to?
>
> That is surprising.
gettext.info answered me ;-)
The ‘gettext’ tools and library have special support for these
‘<inttypes.h>’ macros. You can therefore simply write
printf (gettext ("The amount is %0" PRId64 "\n"), number);
The PO file will contain the string "The amount is %0<PRId64>\n". The
translators will provide a translation containing "%0<PRId64>" as well,
and at runtime the ‘gettext’ function’s result will contain the
appropriate constant string, "d" or "ld" or "lld".
This works only for the predefined ‘<inttypes.h>’ macro...
Nice.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html