Dancer2::Plugin::Locale::Wolowitz - Dancer2's plugin for Locale::Wolowitz
This plugin give you the Locale::Wolowitz support. It's a blatant copy of Dancer::Plugin::Locale::Wolowitz and should be a drop in replacement for Dancer2 projects.
use Dancer2;
use Dancer2::Plugin::Locale::Wolowitz;
# in your templates
get '/' => sub {
template 'index';
}
# or directly in code
get '/logout' => sub {
template 'logout', {
bye => loc('Bye');
}
}
... meanwhile, in a nearby template file called index.tt
<% l('Welcome') %>
plugins:
Locale::Wolowitz:
fallback: "en"
locale_path_directory: "i18n"
lang_session: "lang"
lang_available:
- de
- en
- id
- nl
The loc
keyword can be used in code to look up the correct translation. In
templates you can use the l('')
function
Menno Blom, <blom at cpan.org>
This module is developed on Github at: http://github.com/b10m/p5-Dancer-Plugin-Locale-Wolowitz
Many thanks go out to HOBBESTIG for writing the Dancer 1 version of this plugin (Dancer::Plugin::Locale::Wolowitz).
And obviously thanks to IDOPEREL for creating the main code we're using in this plugin! (Locale::Wolowitz).
Copyright 2014- Menno Blom
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.