Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

I18N::LangTags::Detect

Name I18N::LangTags::Detect
Version 1.06
Located at /usr/share/perl5
File /usr/share/perl5/I18N/LangTags/Detect.pm
Is Core Yes
Search CPAN for this module I18N::LangTags::Detect
Documentation I18N::LangTags::Detect
Module Details I18N::LangTags::Detect

NAME

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 the Win32::Locale manpage module, if it's installed.


SEE ALSO

the I18N::LangTags manpage, the Win32::Locale manpage, the Locale::Maketext manpage.

(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 sburke@cpan.org

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024