Dancer2::Pluging::Locale::Meta
This plugin allow Dancer2 developers to use Locale::Meta package. This Plugin is based on Dancer2::Plugin::Locale::Wolowitz plugin.
use Dancer2; use Dancer2::Plugin::Locale::Meta; # in your routes ## Getting the translation get '/' => sub { my $greeting = loc("hello"); template index.tt, { greeting => $greeting } } ## Getting locale_meta attribute my $locale_meta = locale_meta; # in your template <% l('greeting') %> # load custom structure on your app my $structure = { "en" => { "goodbye" => { "trans" => "bye", } }, "es" => { "goodbye" => { "trans" => "chao", } } }; In order to load the data use the keyword on your routes: load_structure($structure);
plugins: Locale::Meta: fallback: "en" locale_path_directory: "i18n" lang_session: "lang"
To install Dancer2::Plugin::Locale::Meta, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer2::Plugin::Locale::Meta
CPAN shell
perl -MCPAN -e shell install Dancer2::Plugin::Locale::Meta
For more information on module installation, please visit the detailed CPAN module installation guide.