This specific syntax looks ok, but we need to limit ourself to the common syntax between guile and lisp, because that's what gettext supports.

We should use this kind of syntax everywhere we have more than one argument. Also thinking about rtl languages, it's probably important for them, though I'm not sure how gettext works for them.

Le 22 décembre 2020 10:00:35 GMT-05:00, "Ludovic Courtès" <ludo@gnu.org> a écrit :
Hi,

Arun Isaac <arunisaac@systemreboot.net> skribis:

This looks like a real issue. I’m surprised this isn’t already
addressed though: after all, ‘printf’ format strings have the same
problem, right? How does everyone else deal with that?

For C's printf format strings, gettext supports special syntax to
specify argument order. See
https://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html

Oh, I see.

A German example is provided on that page.

"%2$d Zeichen lang ist die Zeichenkette `%1$s'"

With (ice-9 format), as has been suggested before, we should be able to
do away with the “argument jumping” syntax (info "(guile) Formatted
Output"):

(format #f "~1@*~d Zeichen lang ist die Zeichenkette `~0@*~a'" "ab" 2)

It’s a bit awkward though, in particular because we have to jump to the
previous argument (0 and 1 here instead of 1 and 2).

Does xgettext support that syntax? We’ve had troubles before with ~*.

If it does, where should we use this syntax in lieu of the simpler
forms? Everywhere?

Thanks,
Ludo’.