[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Coordination on standardizing gettext() in future POSIX
From: |
Bruno Haible |
Subject: |
Re: Coordination on standardizing gettext() in future POSIX |
Date: |
Fri, 24 Jan 2020 14:26:05 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; ) |
Jörg Schilling wrote:
> OK, then use:
>
> printf "$(gettext 'Hello World %d')\\n" $$
This is a good solution to the problem of gettext with sentences with
embedded arguments.
I withdraw my objection about "half of the necessary API".
The other objection, that we should avoid copying the echo(1) mess regarding
escape sequences into gettext(1), still stands.
> If you use a modern printf(1) implementation (as available in "bosh"), you
> could even use:
>
> printf "$(gettext 'Hello World %2$d %1$d')\\n" 1 2
>
> to be able to control the order of the output of arguments in a way that is
> specific to the target language. ...
> BTW: this extension is also available in /bin/printf on OpenSolaris and
> FreeBSD.
Yes, it would be good to have this %n$d syntax in 'printf' standardized
by POSIX [1]. This way of allowing argument reordering by translators is
supported by many programming languages. It would be good to have it
portably supported in shell scripts as well.
Bruno
[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html