Re: String formatting with APR_INT64_T etc. & gettext localization
From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Sun, 27 Apr 2014 15:13:37 +0100 (BST)
Branko Čibej wrote:
Yes, it's wrong to substitute a fixed literal string such as "%ld" before translation. (I'm not considering casting the values.)
Our available options are:
* Substitute one of the <inttypes.h> tokens (PRId64, etc.) that 'gettext' handles.
* Do what 'gettext' does for 'PRId64', which is arrange for the
+ -e 's/APR_INT64_T_FMT/PRId64/g' \
The way 'gettext' handles PRId64 (etc.) is:
First, when 'gettext' is extracting translatable strings from the C source files into the .pot (PO template) file, it replaces the source token 'PRId64' with the literal string
Second, after the translations have been prepared in the .po files, 'msgfmt'
Therefore the executable that looks up the strings at run time gets a translated
The documentation about that facility  is rather slim. I learnt the
Whether we can use that for APR_OFF_T etc. depends on whether we can determine, at build time, what recognized <inttypes.h> type to map those to. I haven't confirmed but think we probably can.
An alternative option is to emulate the functionality that's built in to
Any further thoughts on whether this approach is feasible?
This is an archived mail posted to the Subversion Dev mailing list.