NAME
Leyland::Localizer - Wrapper for the Locale::Wolowitz localization system for Leyland apps
SYNOPSIS
# in your app's main package
sub setup {
return {
...
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|Leyland::View::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()
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:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
Copyright 2010-2014 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.