Name

CatalystX::Usul::L10N - Localize text strings

Version

0.5.$Revision: 1139 $

Synopsis

use CatalystX::Usul::L10N;

my $l10n = CatalystX::Usul::L10N->new( {
   debug        => $c->debug,
   log          => $c->log,
   tempdir      => File::Spec->tmpdir } );

$local_text = $l10n->localize( $key, {
   domain_names => [ 'default', $c->action->namespace ],
   locale       => q(de_DE),
   params       => { name => 'value', }, } );

Description

Localize text strings

Configuration and Environment

A POSIX locale id has the form

<language>_<country>.<charset>@<key>=<value>;...

If the use_country attribute is set to true in the constructor call then the language and country are used from locale. By default use_country is false and only the language from the locale attribute is used

Subroutines/Methods

BUILD

Finish initializing the object

get_po_header

$po_header_hash_ref = $l10n->get_po_header( { locale => q(de) } );

Returns a hash ref containing the keys and values of the PO header record

localize

$local_text = $l10n->localize( $key, $args );

Localizes the message. The message catalog is loaded from a GNU Gettext portable object file. Returns the $key if the message is not in the catalog. Language is selected by the $args->{locale} attribute. Expands positional parameters of the form [_<n>] if $args->{params} is an array ref of values to substitute. Otherwise expands named attributes of the form {attr_name} using the $args hash for substitution values. The attribute $args->{count} is passed to the machine object files plural function which is used to select either the singular or plural form of the translation. If $args->{context} is supplied it is prepended to the $key before the lookup in the catalog takes place

Diagnostics

Asserts that the locale attribute is set

Dependencies

CatalystX::Usul::Constants

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Peter Flanigan, <Support at RoxSoft.co.uk>

Acknowledgements

Larry Wall - For the Perl programming language

License and Copyright

Copyright (c) 2012 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE