Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mojolicious::plugin::i18n(3pm) [debian man page]

Mojolicious::Plugin::I18N(3pm)				User Contributed Perl Documentation			    Mojolicious::Plugin::I18N(3pm)

NAME
Mojolicious::Plugin::I18N - Internationalization plugin SYNOPSIS
# Mojolicious $self->plugin('I18N'); % languages 'de'; %=l 'hello' # Mojolicious::Lite plugin I18N => {namespace => 'MyApp::I18N'}; %=l 'hello' # Lexicon package MyApp::I18N::de; use Mojo::Base 'MyApp::I18N'; our %Lexicon = (hello => 'hallo'); 1; DESCRIPTION
Mojolicious::Plugin::I18N adds Locale::Maketext support to Mojolicious. All you have to do besides using this plugin is to add as many lexicon classes as you need. Languages can usually be detected automatically from the "Accept-Languages" request header. This plugin can save a lot of typing, since it will generate the following code by default. # $self->plugin('I18N'); package MyApp::I18N; use base 'Locale::Maketext'; package MyApp::I18N::en; use base 'MyApp::I18N'; our %Lexicon = (_AUTO => 1); 1; Namespace and default language of generated code are affected by their respective options. The default lexicon class will only be generated if it doesn't already exist. The code of this plugin is a good example for learning to build new plugins, you're welcome to fork it. OPTIONS
Mojolicious::Plugin::I18N supports the following options. "default" # Mojolicious::Lite plugin I18N => {default => 'en'}; Default language, defaults to "en". "namespace" # Mojolicious::Lite plugin I18N => {namespace => 'MyApp::I18N'}; Lexicon namespace, defaults to the application class followed by "::I18N". HELPERS
Mojolicious::Plugin::I18N implements the following helpers. "l" %=l 'hello' $self->l('hello'); Translate sentence. "languages" % languages 'de'; $self->languages('de'); Change languages. METHODS
Mojolicious::Plugin::I18N inherits all methods from Mojolicious::Plugin and implements the following new ones. "register" $plugin->register($app, $conf); Register plugin hooks and helpers in Mojolicious application. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojolicious::Plugin::I18N(3pm)

Check Out this Related Man Page

Mojolicious::Plugin::Config(3pm)			User Contributed Perl Documentation			  Mojolicious::Plugin::Config(3pm)

NAME
Mojolicious::Plugin::Config - Perl-ish configuration plugin SYNOPSIS
# myapp.conf { foo => "bar", music_dir => app->home->rel_dir('music') }; # Mojolicious my $config = $self->plugin('Config'); # Mojolicious::Lite my $config = plugin 'Config'; # Reads "myapp.conf" by default my $config = app->config; # Everything can be customized with options my $config = plugin Config => {file => '/etc/myapp.stuff'}; DESCRIPTION
Mojolicious::Plugin::Config is a Perl-ish configuration plugin. The application object can be accessed via $app or the "app" function. You can extend the normal configuration file "myapp.conf" with "mode" specific ones like "myapp.$mode.conf". A default configuration filename will be generated by decamelizing the application class with "decamelize" in Mojo::Util or from the application filename. The code of this plugin is a good example for learning to build new plugins, you're welcome to fork it. OPTIONS
Mojolicious::Plugin::Config supports the following options. "default" # Mojolicious::Lite plugin Config => {default => {foo => 'bar'}}; Default configuration, making configuration files optional. "ext" # Mojolicious::Lite plugin Config => {ext => 'stuff'}; File extension for generated configuration filenames, defaults to "conf". "file" # Mojolicious::Lite plugin Config => {file => 'myapp.conf'}; plugin Config => {file => '/etc/foo.stuff'}; Full path to configuration file, defaults to the value of the "MOJO_CONFIG" environment variable or "myapp.conf" in the application home directory. METHODS
Mojolicious::Plugin::Config inherits all methods from Mojolicious::Plugin and implements the following new ones. "load" $plugin->load($file, $conf, $app); Loads configuration file and passes the content to "parse". sub load { my ($self, $file, $conf, $app) = @_; ... return $self->parse($content, $file, $conf, $app); } "parse" $plugin->parse($content, $file, $conf, $app); Parse configuration file. sub parse { my ($self, $content, $file, $conf, $app) = @_; ... return $hash; } "register" my $config = $plugin->register($app, $conf); Register plugin in Mojolicious application. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojolicious::Plugin::Config(3pm)
Man Page