Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

What are the best practices for using phrasebooks in Catalyst applications?

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


robrwo at gmail

Jan 27, 2012, 5:19 AM

Post #1 of 7 (329 views)
Permalink
What are the best practices for using phrasebooks in Catalyst 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



_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


alexander.hartmaier at t-systems

Jan 27, 2012, 5:31 AM

Post #2 of 7 (321 views)
Permalink
Re: What are the best practices for using phrasebooks in Catalyst applications? [In reply to]

Sounds like something similiar to what I18N does.
Your solution looks good to me.

Am 2012-01-27 14:19, schrieb Robert Rothenberg:
> 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
>
>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


orasnita at gmail

Jan 27, 2012, 5:45 AM

Post #3 of 7 (323 views)
Permalink
Re: What are the best practices for using phrasebooks inCatalyst applications? [In reply to]

----- 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


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


dhoworth at mrc-lmb

Jan 27, 2012, 6:13 AM

Post #4 of 7 (321 views)
Permalink
Re: What are the best practices for using phrasebooks inCatalyst applications? [In reply to]

Octavian Rasnita wrote:
> It may work unless the site already needs to use I18N for real languages.

I think the solution in that case is to use a language tag something like

en-US-x-my-private-tag-for-this-user


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


billcrawford1970 at gmail

Jan 27, 2012, 6:30 AM

Post #5 of 7 (318 views)
Permalink
Re: What are the best practices for using phrasebooks inCatalyst applications? [In reply to]

On 27 January 2012 14:13, Dave Howorth <dhoworth [at] mrc-lmb> wrote:
> Octavian Rasnita wrote:
>> It may work unless the site already needs to use I18N for real languages.
>
> I think the solution in that case is to use a language tag something like
>
>  en-US-x-my-private-tag-for-this-user

en_US.UTF8-$CLIENT ?

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


robrwo at gmail

Jan 31, 2012, 11:03 AM

Post #6 of 7 (313 views)
Permalink
Re: What are the best practices for using phrasebooks inCatalyst applications? [In reply to]

Thanks. This works well.

One question: how do I configure Catalyst to watch the locales directory and
restart when they are changed (at least while in debugging mode)?

On 27/01/12 13:45 Octavian Rasnita wrote:
> :
> :
> 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.

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

Jan 31, 2012, 12:01 PM

Post #7 of 7 (310 views)
Permalink
Re: What are the best practices for using phrasebooks inCatalyst applications? [In reply to]

On 31 Jan 2012, at 19:03, Robert Rothenberg wrote:

>
> Thanks. This works well.
>
> One question: how do I configure Catalyst to watch the locales
> directory and
> restart when they are changed (at least while in debugging mode)?

There is a --restart_regex option to the server script which you may
want to tweak..

I'd be entirely happy with a patch which changed the default regex to
be including these files (we're talking about .po files here, right?)
so that you didn't need to remember the option...

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.