NAME

Mojolicious::Plugin::I18NUtils - provide some helper functions for I18N

VERSION

version 0.05

SYNOPSIS

In your startup:

  sub startup {
      my $self = shift;

      # do some Mojolicious stuff
      $self->plugin( 'I18NUtils' );

      # more Mojolicious stuff
  }

In your template:

<%= datetime_loc('2014-12-10', 'de') %>

CONFIGURE

If you use a default format other than %Y-%m-%d %H:%M:%S for dates in your application, you can set a format for the parser. E.g. if your dates look like

10.12.2014 12:34:56

You can add the plugin this way

$self->plugin( I18NUtils => { format => '%d.%m.%Y %H:%M:%S' } );

HELPERS

This plugin adds two helper methods to your web application:

datetime_loc

This helper returns the givent date and time in the localized format.

<%= datetime_loc('2014-12-10 11:12:13', 'de') %>

will return

10.12.2014 11:12:13

date_loc

Same as datetime_loc, but omits the time

<%= date_loc('2014-12-10 11:12:13', 'de') %>

will return

10.12.2014

METHODS

register

Called when registering the plugin.

# load plugin, alerts are dismissable by default
$self->plugin( 'I18NUtils' );

AUTHOR

Renee Baecker <reneeb@cpan.org>

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)