orasnita at gmail
Jan 27, 2012, 5:45 AM
Post #3 of 7
----- Original Message -----
Re: What are the best practices for using phrasebooks inCatalyst applications?
[In reply to]
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?
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:
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.
List: Catalyst [at] lists
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/