Re: [PATCH 3/5] index-pack: correct "len" type in unpack_data()
From: Junio C Hamano <hidden>
Date: 2016-07-06 16:09:10
Junio C Hamano [off-list ref] writes:
Duy Nguyen [off-list ref] writes:quoted
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.