Re: Language class for PEAR?

From: Date: Sun, 10 Feb 2002 17:46:58 +0000
Subject: Re: Language class for PEAR?
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-4567@lists.php.net to get a copy of this message
On Sunday 10 February 2002 18:30, Tomas V.V.Cox wrote: > > 3. Another important thing when designing this class was that it > > can also translate dynamic strings, like: > > "Welcome $USERNAME to $APPLICATION_NAME!", > > where the order of those variables might also be different in > > another language, i.e. into German you may translate it as: > > "Willkommen zu $APPLICATION_NAME, $USERNAME!". > > This is done here by using simple regular expressions (pieces). > > The example would be saved as this, if the "source language" is > > english: english: "Welcome (.*) to (.*)!" > > german: "Willkommen $2, $1!" > > 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. This is necessary since all languages have a different grammar and the order of the dynamic text might not maintain the same as in the "source language" (as i called it). > How people > will translate the messages? Could you provide an example? A small admin-application needs to be written for that, right now i am still writing the translated text straight in the DB. :-) an example which uses this translation class is here: http://wolfram.kriesing.de/libs/php/examples/SimpleTemplate/fullFeatu red/ just push on the "german" link to translate part of the text. (i was to lazy to translate all of it :-) i hope that explains it a bit. you can also find the source and a DB-dump there -- Wolfram ... translating template system ... http://wolfram.kriesing.de/SimpleTemplate

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