RE: [PHP-I18N] Problems passing variables to gettext

From: Date: Wed, 23 Dec 2009 11:30:09 +0000
Subject: RE: [PHP-I18N] Problems passing variables to gettext
References: 1 2  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-1343@lists.php.net to get a copy of this message
Hello :) HPO wrote > Marie-Aude wrote: >> $sitetitle= _('My beautiful site') ; >[...] >> the echo _($sitetitle) does not work. >Are you actually trying to translate your site's title twice? >If not, gettext problems usually arise from not/wrongly setting the >domain and the path gettext is expecting. If you have a look at the >php manual for the gettext function, there is a complete example. Actually no :) though it looks like. At first I had $sitetitle= _('My beautiful site') ; in variables.php And echo $sitetitle in the second file, which is my template. As it did not work, I imagined the translation of the variable did not work as non translated value was shown, and I tried to re-translate it. I tried both configurations (you know when you are despaired because you can't grab why it does not work. It is definitively not a path or configuration problem, because all other strings are correctly translated. But the other strings are in other files, so this is the only case where I define a variable that has to be translated. -- Marie-Aude

« previous php.i18n (#1343) next »