[PHPTAL] i18n:translate doesnt work:/

Laurent Bedubourg lbedubourg at motion-twin.com
Thu Jul 19 09:43:32 CEST 2007


deirathe elf wrote:
> When i trying to use <div i18n:translate="">lubie krzysia</div> i 
> getting something like that:
> *Fatal error*: Call to a member function translate() on a non-object in 
> */tmp/tpl_1_1_8cd8717e56bf4011566de371aea17e5e2.php * on line *27
> *
> What am i supouse to do? Please help me...
> 

Hi,

You are supposed to give a translator to PHPTAL, for instance a 
GetTextTranslator :

require_once 'PHPTAL.php';
require_once 'PHPTAL/GetTextTranslator.php';

$gettext = new PHPTAL_GetTextTranslator();
$gettext->setLanguage('en_GB', 'en_GB.utf8');
$gettext->addDomain('test');
$gettext->useDomain('test');

$tpl = new PHPTAL('mytemplate.html');
$tpl->setTranslator($gettext);
echo $tpl->execute();

The PHPTAL manual contains a gettext section which should help you start.


Best regards
Laurent

-- 
Laurent Bedubourg
lbedubourg at motion-twin.com
http://www.motion-twin.com



More information about the PHPTAL mailing list