boboson has asked for the wisdom of the Perl Monks concerning the following question:

I am using Class::PhraseBook and HTML::Template to create a multilingual website (or I am trying to...). However, there will be alot of phrases and I don't want to substitute every singel one of them into a HTML::Template variable such as.
$tmpl->param(testvar => "hello");
Is there any easier way to accomplish this task?
Can I send the Class::PhraseBook object directly to HTML::Template, or is there any other module where this can be done?

Replies are listed 'Best First'.
Re: Multilingual website with HTML::Template and Class::PhraseBook
by InfiniteSilence (Curate) on Mar 07, 2006 at 17:00 UTC
    HTML::Template internally represents data as hashes of arrays that have hashes in them. This is an example from the perldoc:
    $template->param(EMPLOYEE_INFO => [ { name => 'Sam', job => 'pr +ogrammer' }, { name => 'Steve', job => ' +soda jerk' }, ] );
    If you read in your data using XML::Simple it will be represented in almost the exact same structure (depending upon the parameters you set in XML::Simple).

    So the answer may be to just use XML::Simple rather than Class::PhraseBook to implement your solution.

    Celebrate Intellectual Diversity

Re: Multilingual website with HTML::Template and Class::PhraseBook
by kutsu (Priest) on Mar 07, 2006 at 16:51 UTC

    I don't know about Class::PhraseBook but if you use Template::Toolkit you can send the data as a hash and access it that way.