NAME

CatalystX::I18N::L10N - Wrapper around Locale::Maketext

SYNOPSIS

package MyApp::L10N;
use parent qw(CatalystX::I18N::L10N);

DESCRIPTION

This class can be used as your L10N base-class. It is a wrapper around Locale::Maketext and provides methods for auto-loading lexicon files. It is designed to work toghether with CatalystX::Model::L10N.

You need to subclass this package in your project in order to use it.

MEDTHODS

load_lexicon

MyApp::L10N->load_lexicon(
    locales        => ['de','de_AT'],              # Required
    directories    => ['/path/to/your/l10/files'], # Required
    gettext_style  => 0,                           # Optional, Default 1
    inheritance    => {                            # Optional
        de_AT          => 'de',
    },
);

This method will search the given directories and load all available L10N files for the requested locales

If no translation files can be found for a given locale then Locale::Maketext::Lexicon::Auto will be loaded.

The following parameters are recognized/required

  • locales

    Array reference of locales.

    Required

  • directories

    Array reference of directories. Also accepts Path::Class::Dir objects and single values.

    Required

  • gettext_style

    Enable gettext style. %quant(%1,document,documents) instead of [quant,_1,document,documents]

    Optional, Default TRUE

  • inheritance

    Set inheritance as as HashRef (e.g. 'en_US' inherits from 'en')

    Optional

SEE ALSO

Locale::Maketext and Locale::Maketext::Lexicon

AUTHOR

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

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