NAME

CatalystX::I18N::Role::DataLocalize - Support for localize

SYNOPSIS

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

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

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

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

# 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->localize('Your search found %quant(%1,result,results)',$count);
}

DESCRIPTION

This role adds support for Data::Localize localisation via the CatalystX::I18N::Model::DataLocalize model.

In order to work properly this role needs a model called DataLocalize. A call to $c->model('DataLocalize') should return a Data::Localize object. You can either write your own Model and use Data::Localize directly or use CatalystX::I18N::Model::DataLocalize togheter with CatalystX::I18N::DataLocalize.

METHODS

localize

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

Translates a string via Data::Localize.

SEE ALSO

Data::Localize, CatalystX::I18N::Model::DataLocalize and CatalystX::I18N::DataLocalize

AUTHOR

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

L<http://www.revdev.at>