John Dennis wrote:
On 04/04/2012 09:01 AM, Petr Viktorin wrote:
On 04/02/2012 03:15 PM, Rob Crittenden wrote:
John Dennis wrote:
Translators need to reorder messages to suit the needs of the target
language. The conventional positional format specifiers (e.g. %s %d)
do not permit reordering because their order is tied to the ordering
of the arguments to the printf function. The fix is to use indexed
format specifiers.

I guess this looks ok but all of these errors are of the format: string
error, error number (and inconsistently, sometimes the reverse).

Not all of them, e.g.

- fprintf(stderr, _("Search for %s on rootdse failed with error %d"),
+ fprintf(stderr, _("Search for %1$s on rootdse failed with error
%2$d\n"),
root_attrs[0], ret);

- fprintf(stderr, _("Failed to open keytab '%s': %s\n"), keytab,
+ fprintf(stderr, _("Failed to open keytab '%1$s': %2$s\n"), keytab,
error_message(krberr));

Do those really need to be re-orderable?


You can never make too few assumptions about foreign languages. Most
likely at least some will need reordering.
Enforcing indexed specifiers everywhere means we don't have to worry
about individual cases, or change our strings when a new language is
added.

+1

But there is also another practical reason. The validation logic does
not have artificial intelligence and cannot parse the semantic intent of
the string. It only knows if there are multiple non-indexed specifiers.

If we want to automatically validate strings (make lint) from another
patch, we have to live with rigid application of the rules (adding
exception logic to the validator would be pretty complex because unlike
lint there is no way to tag the string that would get carried all the
way thought the xgettext process and be visible to the validator).

I'm still not convinced that another language would want to reorder these but it does no harm so ACK.

pushed to master and ipa-2-2

rob

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to