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

[email protected] (Lumiere de Lune) Wed, 23 Dec 2009 12:30:09 +0100
Newsgroups php.i18n
Message-ID <002c01ca83c3$496c82f0$dc4588d0$@com>
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