NAME
Mojolicious::Plugin::TagHelpersI18N - TagHelpers with I18N support
VERSION
version 0.05
SYNOPSIS
use Mojolicious::Lite;
plugin('I18N' => { namespace => 'Local::I18N', default => 'de' } );
plugin('TagHelpersI18N');
any '/' => sub {
my $self = shift;
$self->render( 'default' );
};
any '/no' => sub { shift->render };
app->start;
__DATA__
@@ default.html.ep
%= select_field 'test' => [qw/hello test/];
@@ no.html.ep
%= select_field 'test' => [qw/hello test/], no_translation => 1
DESCRIPTION
The TagHelpers in Mojolicious::Plugin::TagHelpers are really nice.
Unfortunately, I need to create select fields where the labels are
translated.
This plugin is the solution for that.
HELPER
select_field
Additionally to the stock select_field helper, you can pass the option
no_translation to avoid translated values
%= select_field test => [qw(hello one)];
results in
and
%= select_field test => [qw(hello one)], no_translation => 1;
results in
in de.pm:
'hello' => 'Hallo',
'one' => 'eins',
With this module you can sort the options:
%= select_field test => [qw/one hello/], sort => 1;
With translation enabled, the translated labels are sorted.
More info about select_field: Mojolicious::Plugin::TagHelpers
AUTHOR
Renee Baecker
COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)