Re: Language class for PEAR?

From: Date: Wed, 03 Apr 2002 06:16:41 +0000
Subject: Re: Language class for PEAR?
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-5178@lists.php.net to get a copy of this message
On Wed, 2002-04-03 at 01:03, Colin Viebrock wrote: > > > I would use the gettext style here: "Welcome %s to %s". > > > > providing the gettext style is no problem. But how can the order of > > the dynamic text in the translation be determined? As in "Willkommen > > $2, $1!" which switches the order of $APPLICATION_NAME and $USERNAME > > in the into german translated message. > > Sorry for the really delayed response, but this can be done as follows: > > EN: $format="Welcome %s to %s!"; > sprintf($format, $APP, $USER ); > > DE: $format = "Willkommen %2$s, %1$s!"; > sprintf($format, $APP, $USER ); > > Bascially, that functionality is built into sprintf(). But not in PHP's *printf. It's a great feature though, someone should implement it. :-) - Stig

« previous php.pear.dev (#5178) next »