[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coordination on standardizing gettext() in future POSIX

From: Joerg Schilling
Subject: Re: Coordination on standardizing gettext() in future POSIX
Date: Fri, 24 Jan 2020 15:14:48 +0100
User-agent: Heirloom mailx 12.5 7/5/10

Bruno Haible <address@hidden> wrote:

> > 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.

Most platforms support it anyway. It has been introduced in 1988 for ksh88 and 
/bin/printf on SVr4/Solaris - but only usable for string parameters as:

        printf "Hello World %2$s %1$s\\n"  1 2

This simple (string only) variant is supported on:

/bin/printf     on Oracle Solaris but limited to 20 arguments only 
                Most likely (as it is the same source) on HP-UX and AIX as well.

ksh88           anywhere

mksh            a ksh88 clone

The full version that supports any type of format strings (including %d, ...) is
supported by:

/bin/printf     on OpenSolaris (SchilliX and Illlumos) and on FreeBSD

ksh93           anywhere

bosh            anywhere

zsh             anywhere

Not usable is this feature only with:

/bin/printf     on Linux, ...

bash            anywhere

dash            anywhere

yash            anywhere


 EMail:address@hidden                    (home) Jörg Schilling D-13353 Berlin
    address@hidden (work) Blog: http://schily.blogspot.com/
 URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'

reply via email to

[Prev in Thread] Current Thread [Next in Thread]