Author image Daisuke Maki
and 1 contributors


Catalyst::Model::Data::Localize - Catalyst Model Over Data::Localize


    $c->model('Data::Localize') # or Localize. whatever
      ->localize($key, @args);


WARNING: Data::Localize, which this module is based on, is still in alpha quality. This module should also be treated as such.

This is a thin wrapper around Data::Localize. The only thing it does that a plain Catalyst::Model::Adaptor + Data::Localize can do is the automatic discovery of I18N files (if they are placed under likely locations).

For example, these files will automatically be found:

    # suppose our Catalyst app is at  lib/

Also, for those like me that don't like to put a catalyst app at the project's top namespace, we look for one level above, too:

    # suppose our Catalyst app is at  lib/MyApp/

The default behavior is to detect the language setting from the HTTP headers. If you want to override it, simply place an explicit call somehwere in your action chain:

    my $loc = $c->model('Data::Localize');
    $loc->set_languages('ja'); # or whatever you prefer
    $loc->localize($key, @args);


Configuration can be done via the 'Model::Data::Localize' slot:

        auto 1
            class Gettext
            path  /path/to/gettext/files/*.po

If you want Catalyst::Plugin::I18N compatible style method generation on the context object, look at Catalyst::Plugin::Data::Localize, which is just a really thin wrapper over this module.

languages parameter is a bit special, as it overrides the default behavior to detect the desired language from HTTP headers.

    # Always use ja
        languages ja


Tests. Yes, I know.


Daisuke Maki <>


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.