NAME

CatalystX::I18N::Model::Maketext - Glues Locale::Maketext into Catalyst

SYNOPSIS

# In your catalyst base class
package MyApp::Catalyst;
use Catalyst qw/CatalystX::I18N::Role::Base/;

__PACKAGE__->config(
   'Model::Maketext' => {
       class           => 'MyApp::Maketext', # optional
       directories     => '/path/to/maketext/files', # optional
   },
);


# Create a model class
package MyApp::Model::Maketext;
use parent qw/CatalystX::I18N::Model::Maketext/;


# Create a Maketext class (must be a Locale::Maketext class)
package MyApp::Maketext;
use parent qw/CatalystX::I18N::Maketext/;


# In your controller class(es)
package MyApp::Controller::Main;
use parent qw/Catalyst::Controller/;

sub action : Local {
    my ($self,$c) = @_;
    
    my $model = $c->model('Maketext');
    $c->stash->{title} = $model->maketext('Hello world');
    # See CatalystX::I18N::Role::Maketext for a convinient wrapper
}

DESCRIPTION

This model glues a Locale::Maketext class (eg. CatalystX::I18N::Maketext) into you Catalyst application.

The method fail_with will be called for each missing msgid if present in your model class.

package MyApp::Model::Maketext;
use parent qw/CatalystX::I18N::Model::Maketext/;

sub fail_with {
    my ($self,$c,$language_handle,$msgid,$params) = @_;
    # Do somenthing clever
    return $string;
}

See Catalyst::Helper::Model::Maketext for gerating an Maketext model from the command-line.

CONFIGURATION

class

Set the Locale::Maketext class you want to use from this model.

Defaults to $APPNAME::Maketext

gettext_style

Enable gettext style. %quant(%1,document,documents) instead of [quant,_1,document,documents]

Default TRUE

directories

Array reference of directories to be searched for maketext files.

See CatalystX::I18N::Maketext for more details on the directory parameter

SEE ALSO

CatalystX::I18N::Maketext, Locale::Maketext, Locale::Maketext::Lexicon and CatalystX::I18N::Role::Maketext

AUTHOR

Maroš Kollár
CPAN ID: MAROS
maros [at] k-1.com

L<http://www.k-1.com>