[geeklog-devel] [Fwd: Re: Flexy translation]

Tony Bibbs tony at tonybibbs.com
Fri Dec 17 23:34:49 EST 2004

Worth reading.  I'm going to try and get the SOB working tonight.


-------- Original Message --------
Subject: 	Re: Flexy translation
Date: 	Sat, 18 Dec 2004 11:32:52 +0800
From: 	Alan Knowles <alan at akbkhome.com>
To: 	Tony Bibbs <tony at tonybibbs.com>
References: 	<41C376A4.5010305 at tonybibbs.com>

Ok, you need the latest CVS (translation2 as well) - as I   there are a 
few fixes in it..

$x = new HTML_Template_Flexy(array(
   ..... usual options....
  'locale' => 'fr',
  'Translation2' => array('driver' => 'dataobjectsimple')

.. a template containing..

will be compiled to xxx.fr.html

or you can translate blocks with HTML inside:
{_( ....<B>some text</B>.... )_}

Assuming you have set up the word in Translation2 ok..

Have a look at HTML_Template_Flexy_Translator for a few ideas - the 
trick is that the compiler dumps a 'gettext.serial file.' - which can be 
used to find the words in the template.


Tony Bibbs wrote:

> I'm using Flexy in a project that has to support multiple language.  
> Right now we are leaning towards using PEAR::Translation2.   I know 
> Flexy is smart enought to build templates per locale which is great 
> but how do I achieve that using Translation2?
> In a template for a login page I have this:
> <table>
> <tr>
>    <td>{translate('Username')}:</td>
>    <td><input type="text" name="gl2User->userName"/></td>
> </tr>
> ...
> Where translate() is a method on the class that renders this view.  
> I'm guessing I don't want to do it this way because it appears this 
> would cause the translate() method to get called every single request 
> even if the template has been compiled.  Am I right in that assumption?
> --Tony

More information about the geeklog-devel mailing list