The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CatalystX::I18N::TraitFor::Request - Adds various I18N methods to a Catalyst::Request object

SYNOPSIS

 package MyApp::Catalyst;
 
 use CatalystX::RoleApplicator;
 use Catalyst qw/MyPlugins 
    CatalystX::I18N::Role::Base/;
 
 __PACKAGE__->apply_request_class_roles(qw/CatalystX::I18N::TraitFor::Request/);

DESCRIPTION

Adds several attributes to a Catalyst::Request object that help you determine a users language and locale.

All attributes are lazy. This means that the values will be only calculated when the attributes is read/called the first time.

METHODS

accept_language

 my @languages = $c->request->accept_language();

Returns an ordered list of accepted languages (from the 'Accept-Language' header). Inavlid entries in the language headers are filtered.

browser_language

 my $browser_language = $c->request->browser_language();

Returns the language of the browser (form the 'User-Agent' header)

browser_territory

 my $browser_territory = $c->request->browser_territory();

Returns the territory of the browser (form the 'User-Agent' header)

client_country

 my $browser_territory = $c->request->client_country();

Looks up the client IP-address via IP::Country::Fast.

browser_detect

 my $browser_detect = $c->request->browser_detect();

Returns a HTTP::BrowserDetect object.

SEE ALSO

Catalyst::Request, IP::Country::Fast, HTTP::BrowserDetect

AUTHOR

    Maroš Kollár
    CPAN ID: MAROS
    maros [at] k-1.com
    
    L<http://www.k-1.com>