Hi Bill

On Mon, 2009-12-21 at 07:51 +0000, Andy Wardley wrote:

> Yes, you can, but Clint's already done it.  See this message:
> 
> http://mail.template-toolkit.org/pipermail/templates/2008-October/010493.html
> 


As Andy said, this already works in Locale::Maketext::Lexicon,
specifically: 
http://search.cpan.org/~drtech/Locale-Maketext-Lexicon-0.77/lib/Locale/Maketext/Extract/Plugin/TT2.pm

In my templates, I use l(...) for phrases that should be translated
immediately, and loc(...) for "delayed translation", eg:

    labels = {
       foo => loc('Foo [_1]', value),  ## just marks for extraction
       bar => loc('Bar [_1]', value),  ## just marks for extraction
    };

    label = labels.$current;

    l(label,value);       ## does actual translation, not extracted

But this is a matter of personal choice.

    You can use:   l()  loc()  |l   |loc

It also concatenates literals, eg, this would be extracted as one line:

     l(  'Foo foo foo foo foo foo foo foo foo foo foo ' 
       _ 'bar bar bar bar bar bar bar bar bar bar bar');

And won't extract any phrases that contain variables, eg:

     l('foo ${bar}')

hope this helps

clint


_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to