Name

Web::ComposableRequest::Role::L10N - Provide localisation methods

Synopsis

package Your::Request::Class;

use Moo;

extends 'Web::ComposableRequest::Base';
with    'Web::ComposableRequest::Role::L10N';

Description

Provide localisation methods

Configuration and Environment

Defines the following attributes;

domain

The domain to which this request belongs. Can be used to select assets like translation files

locale

The language requested by the client. Defaults to the LANG constant en (for English)

Defines the following configuration attributes

l10n_attributes

A hash reference. The domains attribute is an array reference containing the default gettext domains

locale

A non empty simple string which defaults to the constant LANG. The default locale for the application

locales

An array reference of non empty simple strings. Defaults to a list containing the LANG constant. Defines the list of locales supported by the application

quote_bind_values

A boolean which defaults to true. Causes the bind values in parameter substitutions to be quoted

Subroutines/Methods

loc

$localised_string = $self->loc( $key, @args );

Translates $key into the required language and substitutes the bind values

loc_default

Like the loc method but always translates to the default language

Diagnostics

None

Dependencies

Unexpected

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to http://rt.cpan.org/NoAuth/Bugs.html?Dist=Web-ComposableRequest. Patches are welcome

Acknowledgements

Larry Wall - For the Perl programming language

Author

Peter Flanigan, <pjfl@cpan.org>

License and Copyright

Copyright (c) 2016 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE