-
-
26 Aug 2009 13:18:23 UTC
- Distribution: Catalyst-TraitFor-Request-PerLanguageDomains
- Module version: 0.01
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (8 / 115 / 11)
- Kwalitee
Bus factor: 1- License: perl_5
- Perl: v5.8.5
- Activity
24 month- Tools
- Download (25.09KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Stephan Jauernick
- Dependencies
- Catalyst
- I18N::AcceptLanguage
- Moose
- namespace::autoclean
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Catalyst::TraitFor::Request::PerLanguageDomains - Language detection for Catalyst::Requests
SYNOPSIS
package MyApp; use Moose; use namespace::autoclean; use Catalyst; use CatalystX::RoleApplicator; extends 'Catalyst'; __PACKAGE__->apply_request_class_roles(qw/ Catalyst::TraitFor::Request::PerLanguageDomains /); __PACKAGE__->config( 'TraitFor::Request::PerLanguageDomains' => { default_language => 'de', selectable_language => ['de','en'], } }; __PACKAGE__->setup;
#config general style: <TraitFor::Request::PerLanguageDomains> default_language de selectable_language de selectable_language en </Catalyst::Request>
DESCRIPTION
Extend request objects with a method for language detection
METHODS
language
my $language = $ctx->request->language;
Returns a string that is the two digit code for the request language.
The following things are checked to find the request language, in order:
- The lang part of the domain (e.g. de from de.example.org)
- The
language
key set in the session (if Catalyst::Plugin::Session is loaded) - The
Accept-Language
header of the request.
AUTHOR
Stephan Jauernick <stephan@stejau.de>
LICENSE
This software is copyright (c) 2009 by Stephan Jauernick.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Catalyst::TraitFor::Request::PerLanguageDomains, copy and paste the appropriate command in to your terminal.
cpanm Catalyst::TraitFor::Request::PerLanguageDomains
perl -MCPAN -e shell install Catalyst::TraitFor::Request::PerLanguageDomains
For more information on module installation, please visit the detailed CPAN module installation guide.