I was just looking through the mailing list archives for some help
with my gettext problem (basically, I can't get it to work).
Anyway, I came across your post:
> Thanks for the reply. This will not solve my problem. The problem is,
for some
> languages the sentence structure may be different. For example, the
sentence
> may need to be,
> $greeting = "$first_name, welcome!"
> as opposed to,
> $greeting = "Welcome, $first_name!"
This can be handled by gettext. Change your english code to something like:
$greeting = sprintf( gettext("Welcome, %s!"), $first_name );
Once you run xgettext to extract all the strings, you'll end up with
msgid "Welcome, %s!"
msgstr ""
So just convert it into whatever language, and move the "%s" as needed, eg:
msgstr "%s, bonjour!"
This even works with multiple "%s"'s, in later versions of PHP where you can
rearrange the arguments in the format string, but not the way they are
passed
to sprintf():
msgid "%s is %d years old"
msgstr "$2%d Jahrs habe $1%s"
Check www.php.net/sprintf for details.
Hope that helps.
- Colin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]