# I18N::LangTags::Detect - man - phpman

## NAME
    [I18N::LangTags::Detect](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags%3A%3ADetect/markdown) - detect the user's language preferences

## SYNOPSIS
      use [I18N::LangTags::Detect](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags%3A%3ADetect/markdown);
      my @user_wants = [I18N::LangTags::Detect::detect](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags%3A%3ADetect%3A%3Adetect/markdown)();

## 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](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags%3A%3ADetect%3A%3Adetect/markdown)()". 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](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags%3A%3Aimplicatesuperstightly/markdown)(...)" or "[I18N::LangTags::implicate_supers](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags%3A%3Aimplicatesupers/markdown)(...)", like
    so:

      my @languages =
        [I18N::LangTags::implicate_supers_tightly](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags%3A%3Aimplicatesuperstightly/markdown)(
          [I18N::LangTags::Detect::detect](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags%3A%3ADetect%3A%3Adetect/markdown)()
        );

## ENVIRONMENT
    This module looks at several environment variables: REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE,
    LANGUAGE, LC_ALL, LC_MESSAGES, and LANG.

    It will also use the [Win32::Locale](https://www.chedong.com/phpMan.php/perldoc/Win32%3A%3ALocale/markdown) module, if it's installed and IGNORE_WIN32_LOCALE is not set
    to a true value in the environment.

## SEE ALSO
    [I18N::LangTags](https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALangTags/markdown), [Win32::Locale](https://www.chedong.com/phpMan.php/perldoc/Win32%3A%3ALocale/markdown), [Locale::Maketext](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext/markdown).

    (This module's core code started out as a routine in [Locale::Maketext](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext/markdown); 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>"

