FAQ
Since I got no response to my request a few weeks ago about I18N data
from a database I wrote my own :)

This module has just been released to CPAN.

It builds on Catalyst::Plugin::I18N and inherits all methods from that
module. In addition it provides a 'load_lexicon' method that loads data
from a database. (Which reminds me, the POD does not explain the
database structure ;( I see version 0.02 coming on...)

The 'Lexicon' data in the en.pm, fr.pm, de.pm etc. files is empty. It is
loaded from the database using the 'load_lexicon' method.

You can also divide up your application into 'paths', for example
'header', 'footer', 'navigation', 'user/edit', 'user/login' etc. which
means you only need to load a subset of the translation data as required
by your templates.

Regards
Ian C. Docherty (ICD)

Search Discussions

  • John Napiorkowski at Nov 13, 2006 at 7:42 pm

    -- Ian Docherty wrote:

    Since I got no response to my request a few weeks
    ago about I18N data
    from a database I wrote my own :)

    This module has just been released to CPAN.

    It builds on Catalyst::Plugin::I18N and inherits all
    methods from that
    module. In addition it provides a 'load_lexicon'
    method that loads data
    from a database. (Which reminds me, the POD does not
    explain the
    database structure ;( I see version 0.02 coming
    on...)

    The 'Lexicon' data in the en.pm, fr.pm, de.pm etc.
    files is empty. It is
    loaded from the database using the 'load_lexicon'
    method.

    You can also divide up your application into
    'paths', for example
    'header', 'footer', 'navigation', 'user/edit',
    'user/login' etc. which
    means you only need to load a subset of the
    translation data as required
    by your templates.

    Regards
    Ian C. Docherty (ICD)
    I'll be using it in this application I wrote that
    stores the TT templates in a database. Now I can move
    everything to the DB interface for my users. Thanks!
    --john

    _______________________________________________
    List: Catalyst@lists.rawmode.org
    Listinfo:
    http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.rawmode.org/
    Dev site: http://dev.catalyst.perl.org/



    ____________________________________________________________________________________
    Do you Yahoo!?
    Everyone is raving about the all-new Yahoo! Mail beta.
    http://new.mail.yahoo.com
  • Ian Docherty at Nov 13, 2006 at 9:20 pm
    John
    I finally worked out what I was doing wrong in my upload to CPAN.

    It should be on the mirrors soon, but if you want a version prior to that
    or information on how to use it send me a personal email.

    Regards
    Ian

    John Napiorkowski wrote:
    I'll be using it in this application I wrote that
    stores the TT templates in a database. Now I can move
    everything to the DB interface for my users. Thanks!
    --john
  • John Beppu at Nov 14, 2006 at 6:30 am
    This looks promising. Thanks for coding this. :-)
  • Brandon Black at Nov 14, 2006 at 11:36 pm

    On 11/13/06, Ian Docherty wrote:
    Since I got no response to my request a few weeks ago about I18N data
    from a database I wrote my own :)

    This module has just been released to CPAN.
    I've just been looking at Cat I18N stuff. This looks promising (I
    haven't actually used it yet). Based on the source, I would make a
    few suggestions for the next version:

    1) Make the model name "DBIC::Lexicon" configurable instead of
    hardcoded, via config->{'I18N::DBIC'}->lexicon_model

    2) Why not make the primary key (language, path, message) instead of a
    random incrementing serial numer that isn't used? It would help
    reduce accidental redundancy in the database, and give you an index on
    the columns most likely to be searched on.

    3) Reloading lexicons per-request is going to be wasteful in the most
    common cases. It might be better to offer a couple of other options
    (via configuration), such as:
    a) Pre-load the entire Lexicon at app startup
    b) Dynamically load lexicon paths into memory as they are used, but
    cache them from then on (don't reload unnecessarily)

    -- Brandon
  • Ian Docherty at Nov 15, 2006 at 6:45 am
    Brandon.
    Thanks for the feedback. see below.

    Brandon Black wrote:

    snip...
    I've just been looking at Cat I18N stuff. This looks promising (I
    haven't actually used it yet). Based on the source, I would make a
    few suggestions for the next version:

    1) Make the model name "DBIC::Lexicon" configurable instead of
    hardcoded, via config->{'I18N::DBIC'}->lexicon_model
    Since I am extending existing packages that already hard-code the name
    'Lexicon' I don't see that this can be changed easily.
    2) Why not make the primary key (language, path, message) instead of a
    random incrementing serial numer that isn't used? It would help
    reduce accidental redundancy in the database, and give you an index on
    the columns most likely to be searched on.
    Certainly, as I think I mention in the docs, the index can be anything you
    want and is not required by the module. So by all means set up your
    index in this way, the schema was just one example.
    3) Reloading lexicons per-request is going to be wasteful in the most
    common cases. It might be better to offer a couple of other options
    (via configuration), such as:
    a) Pre-load the entire Lexicon at app startup
    b) Dynamically load lexicon paths into memory as they are used, but
    cache them from then on (don't reload unnecessarily)
    Those are well worth doing. I presume that you are talking about
    mod-perl in this case so that the lexicon data is cached between requests.

    I will look to do this in a new release.

    Thanks for your feedback.
    Regards
    Ian C. Docherty (ICD)
  • Ian Docherty at Nov 15, 2006 at 8:56 am

    Ian Docherty wrote:
    Brandon.
    Thanks for the feedback. see below.

    Brandon Black wrote:

    snip...
    I've just been looking at Cat I18N stuff. This looks promising (I
    haven't actually used it yet). Based on the source, I would make a
    few suggestions for the next version:

    1) Make the model name "DBIC::Lexicon" configurable instead of
    hardcoded, via config->{'I18N::DBIC'}->lexicon_model
    Just re-read this. I must have been too tired this morning to understand.
    I see now. Yes, the Model name should be configurable. Thanks.

    Regards
    Ian C. Docherty (ICD)
  • Daniel McBrearty at Nov 15, 2006 at 9:38 am
    I'm sorry I didn't see this earlier. We also have translated text
    stored in the db, and have evolved a schema to cope with that. We are
    not using the cat->i18n plugin at the moment though - we wrote our own
    to use our schema.

    At some point though we'd like to share some of the stuff that we've
    learned and use the communal code where possible.

    I'd be interested to see the schema and see how it compares with what
    we are doing. This was the area that I found trickiest - the plugin to
    grap stuff out of the schema is realatively easy.
    On 11/15/06, Ian Docherty wrote:
    Ian Docherty wrote:
    Brandon.
    Thanks for the feedback. see below.

    Brandon Black wrote:

    snip...
    I've just been looking at Cat I18N stuff. This looks promising (I
    haven't actually used it yet). Based on the source, I would make a
    few suggestions for the next version:

    1) Make the model name "DBIC::Lexicon" configurable instead of
    hardcoded, via config->{'I18N::DBIC'}->lexicon_model
    Just re-read this. I must have been too tired this morning to understand.
    I see now. Yes, the Model name should be configurable. Thanks.

    Regards
    Ian C. Docherty (ICD)

    _______________________________________________
    List: Catalyst@lists.rawmode.org
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
    Dev site: http://dev.catalyst.perl.org/

    --
    Daniel McBrearty
    email : danielmcbrearty at gmail.com
    www.engoi.com : the multi - language vocab trainer
    BTW : 0873928131
  • Ian Docherty at Nov 15, 2006 at 10:50 am
    Daniel
    We are still at an early stage in terms of learning how to provide i18n
    and I produced this module as much as a 'proof of concept' as anything else.

    I would be very interested in discussing what you have been doing but it
    may be best to move the discussion out of this forum unless it is
    specific about Catalyst. Do you, or anyone else interested in this
    discussion, want to reply to me directly?

    As you say, the plugin to get information from the database is easy.
    What is difficult is the way that the data in the schema is maintained
    and updated and how translation is managed etc. I presume that this is
    what you are referring to.

    I anticipate creating a mini-app that will allow a translator to make
    changes to the database code and view the result immediately in the
    application.

    Regards
    Ian C. Docherty (ICD)

    Daniel McBrearty wrote:
    I'm sorry I didn't see this earlier. We also have translated text
    stored in the db, and have evolved a schema to cope with that. We are
    not using the cat->i18n plugin at the moment though - we wrote our own
    to use our schema.

    At some point though we'd like to share some of the stuff that we've
    learned and use the communal code where possible.

    I'd be interested to see the schema and see how it compares with what
    we are doing. This was the area that I found trickiest - the plugin to
    grap stuff out of the schema is realatively easy.

  • Daniel McBrearty at Nov 16, 2006 at 12:33 am
    Hi Ian

    We seem to be on the same lines. We already have an app that allows
    translators to work online and so on - it's crap, but we learnt some
    useful stuff, and the next (cat based) one will be way better. I'll
    drop you a line off-list when I can and we'll discuss it further.

    cheers
    On 11/15/06, Ian Docherty wrote:
    Daniel
    We are still at an early stage in terms of learning how to provide i18n
    and I produced this module as much as a 'proof of concept' as anything else.

    I would be very interested in discussing what you have been doing but it
    may be best to move the discussion out of this forum unless it is
    specific about Catalyst. Do you, or anyone else interested in this
    discussion, want to reply to me directly?

    As you say, the plugin to get information from the database is easy.
    What is difficult is the way that the data in the schema is maintained
    and updated and how translation is managed etc. I presume that this is
    what you are referring to.

    I anticipate creating a mini-app that will allow a translator to make
    changes to the database code and view the result immediately in the
    application.

    Regards
    Ian C. Docherty (ICD)

    Daniel McBrearty wrote:
    I'm sorry I didn't see this earlier. We also have translated text
    stored in the db, and have evolved a schema to cope with that. We are
    not using the cat->i18n plugin at the moment though - we wrote our own
    to use our schema.

    At some point though we'd like to share some of the stuff that we've
    learned and use the communal code where possible.

    I'd be interested to see the schema and see how it compares with what
    we are doing. This was the area that I found trickiest - the plugin to
    grap stuff out of the schema is realatively easy.


    _______________________________________________
    List: Catalyst@lists.rawmode.org
    Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
    Dev site: http://dev.catalyst.perl.org/

    --
    Daniel McBrearty
    email : danielmcbrearty at gmail.com
    www.engoi.com : the multi - language vocab trainer
    BTW : 0873928131

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedNov 13, '06 at 6:00p
activeNov 16, '06 at 12:33a
posts10
users5
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase