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

NAME

Leyland::Localizer - Wrapper for the Locale::Wolowitz localization system for Leyland apps

VERSION

version 0.001007

SYNOPSIS

        # in app.psgi
        my $config = {
                ...
                locales => '/path/to/myapp/locales',
                ...
        };

        # in your controllers
        $c->set_lang('es'); # use Spanish when responding, possibly because that's what the client wants
        $c->loc('Hello %1', $c->params->{name});

        # in your views (assuming you're using L<Tenjin>):
        <h1>[== $c->loc('Hello %1', $c->params->{name}) =]</h1>

DESCRIPTION

This module provides Leyland applications with simple localization capabilities, using Locale::Wolowitz. This does not mean localizing your application to the locale of the computer/server on which it is running, but localizing your HTTP responses according to your application's client's wishes.

If, for example, your application is a website provided in two or more languages, this module will provide your application with Wolowitz's loc() method, for translating strings into a certain language.

See the Leyland::Manual::Localization for more information.

ATTRIBUTES

path

The path of the directory in which Locale::Wolowitz translation files reside. Can be a relative path. This attribute will come from the "locales" config option in app.psgi.

w

The Locale::Wolowitz object used for localization.

OBJECT METHODS

loc( $string, $language, [ @replacements ] )

Translates $string into $language, possibly performing some replacements. This is just a shortcut for Locale::Wolowitz->loc(), so check out Locale::Wolowitz for more information.

INTERNAL METHODS

The following methods are only to be used internally.

BUILD()

Automatically called by Moose after initializing an instance of this class, this method creates a new Locale::Wolowitz object and saves it as the "w" attribute.

AUTHOR

Ido Perlmuter, <ido at ido50.net>

BUGS

Please report any bugs or feature requests to bug-Leyland at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Leyland. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc Leyland::Localizer

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2010-2011 Ido Perlmuter.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.