NAME

CatalystX::I18N::Role::Maketext - Support for maketext

SYNOPSIS

# In your catalyst base class
package MyApp::Catalyst;

use Catalyst qw/MyPlugins
   CatalystX::I18N::Role::Base
   CatalystX::I18N::Role::Maketext/;

# Maketext 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::Catalyst::Controller::Main;
use strict;
use warnings;
use parent qw/Catalyst::Controller/;

sub action : Local {
    my ($self,$c) = @_;

    $c->stash->{results} = $c->maketext('Your search found %quant(%1,result,results)',$count);
}

DESCRIPTION

This role adds support for Locale::Maketext localisation via the CatalystX::I18N::Model::Maketext model.

In order to work properly this role needs a model called Maketext. A call to $c->model('Maketext') should return a handle for a Maketext / Locale::Maketext class. You can either write your own Model and Maketext class or use CatalystX::I18N::Model::Maketext and CatalystX::I18N::Maketext.

METHODS

maketext

my $translated_string = $c->maketext($msgid,@params);
OR
my $translated_string = $c->maketext($msgid,\@params);

Translates a string via Locale::Maketext.

SEE ALSO

Locale::Maketext, CatalystX::I18N::Model::Maketext and CatalystX::I18N::Maketext

AUTHOR

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

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