The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CatalystX::I18N::Role::PosixLocale - Sets the POSIX locale

SYNOPSIS

 # In your catalyst base class
 package MyApp::Catalyst;
 
 use Catalyst qw/MyPlugins
    CatalystX::I18N::Role::Base
    CatalystX::I18N::Role::PosixLocale/;
 
 sub action : Local {
     my ($self,$c) = @_;

     $c->locale('sk_SK')
     # POSIX LC_COLLATE locale is 'sk_SK.UTF-8' now
 }

DESCRIPTION

This role sets the POSIX locales for each request.

METHODS

i18n_posix_category

Helper method that returns the value of the requested POSIX locale category (LC_ALL, LC_COLLATE, LC_NUMERIC, LC_MONETARY). The POSIX category that should be used can be set in the I18N config.

 __PACKAGE__->config(
     I18N    => {
         posix_category     => 'LC_COLLATE',
     }
 );

Default is LC_ALL

CAVEATS

POSIX locale is set for the whole process, and might affect other modules outside of Catalyst' scope. This role is also known to cause problems if used in conjunction with the CatalystX::I18N::TraitFor::ViewTT role

SEE ALSO

POSIX, perllocale

AUTHOR

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