Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

i18n::langtags::detect(3pm) [osx man page]

I18N::LangTags::Detect(3pm)				 Perl Programmers Reference Guide			       I18N::LangTags::Detect(3pm)

I18N::LangTags::Detect - detect the user's language preferences SYNOPSIS
use I18N::LangTags::Detect; my @user_wants = I18N::LangTags::Detect::detect(); DESCRIPTION
It is a common problem to want to detect what language(s) the user would prefer output in. FUNCTIONS
This module defines one public function, "I18N::LangTags::Detect::detect()". This function is not exported (nor is even exportable), and it takes no parameters. In scalar context, the function returns the most preferred language tag (or undef if no preference was seen). In list context (which is usually what you want), the function returns a (possibly empty) list of language tags representing (best first) what languages the user apparently would accept output in. You will probably want to pass the output of this through "I18N::LangTags::implicate_supers_tightly(...)" or "I18N::LangTags::implicate_supers(...)", like so: my @languages = I18N::LangTags::implicate_supers_tightly( I18N::LangTags::Detect::detect() ); ENVIRONMENT
This module looks for several environment variables, including REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE, LANGUAGE, LC_ALL, LC_MESSAGES, and LANG. It will also use the Win32::Locale module, if it's installed. SEE ALSO
I18N::LangTags, Win32::Locale, Locale::Maketext. (This module's core code started out as a routine in Locale::Maketext; but I moved it here once I realized it was more generally useful.) COPYRIGHT
Copyright (c) 1998-2004 Sean M. Burke. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The programs and documentation in this dist are distributed in the hope that they will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. AUTHOR
Sean M. Burke "" perl v5.16.2 2012-10-11 I18N::LangTags::Detect(3pm)

Check Out this Related Man Page

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

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, <>. perl v5.14.2 2012-09-05 Mojolicious::Plugin::I18N(3pm)
Man Page