[Catalyst] What are the best practices for using phrasebooks inCatalyst applications?

Octavian Rasnita orasnita at gmail.com
Fri Jan 27 13:45:20 GMT 2012


----- Original Message ----- 
Subject: [Catalyst] What are the best practices for using phrasebooks inCatalyst applications?


> 
> I am working on a project where the terminology we are using for "objects"
> in the system is diverging from terminology that the client is using for
> those things.  And it also seems that other clients may use different names
> for these objects. (And this is just for English-language interfaces.)
> 
> So I would like to use some kind of phrasebook, so that the source code can
> use the same, consistent terminology, but the clients see their terminology
> in the UI.
> 
> I'd prefer not to maintain a separate set of templates for each client,
> since that requires keeping changes to templates consistent across sets, and
> requires keeping changes to terminology consistent in a set.
> 
> So... is there an existing plugin that is used for such things?
> 
> Otherwise, I am thinking of writing a plugin that makes use of
> Data::Phrasebook (or something similar), allows for configuration of the
> phrasebook in the configuration file, and adds a new method to the Catalyst
> context variable for querying the phrasebook, e.g. the template may have
> something like
> 
>  <h1>[% c.phrase('widgets') | html %]</h1>
> 
> Does this make sense, or is there a better way to do this?
> 
> Thanks,
> Rob



If the terminology differs, then you may use I18N.

You could define your own "languages" for all the terminologies you need, set the current "language" with:

$c->languages([$language]);

and then you'll just need to use something like:

[% l('widgets') | html %]

where l() is a macro defined with:

[% MACRO l(text,args) BLOCK; c.localize(text,args) || text; END ~%]

It may work unless the site already needs to use I18N for real languages.

Octavian




More information about the Catalyst mailing list