NAME
CatalystX::I18N::Role::Maketext - Support for maketext L10N
SYNOPSIS
# In your catalyst base class
package MyApp::Catalyst;
use Catalyst qw/MyPlugins
CatalystX::I18N::Role::Base
CatalystX::I18N::Role::Maketext/;
# L10N model class
package MyApp::Model::L10N;
use parent qw/CatalystX::I18N::Model::L10N/;
# Create a L10N class (must be a Locale::Maketext class)
package MyApp::L10N;
use parent qw/CatalystX::I18N::L10N/;
# 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::L10N model.
In order to work properly this role needs a model called L10N
. A call to $c->model('L10N')
should return a handle for a L10N / Locale::Maketext class. You can either write your own Model and L10N class or use CatalystX::I18N::Model::L10N and CatalystX::I18N::L10N.
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::L10N and CatalystX::I18N::L10N
AUTHOR
Maroš Kollár
CPAN ID: MAROS
maros [at] k-1.com
L<http://www.revdev.at>