1I18N::LangTags::Detect(3Ppemr)l Programmers Reference GuIi1d8eN::LangTags::Detect(3pm)
2
3
4

NAME

6       I18N::LangTags::Detect - detect the user's language preferences
7

SYNOPSIS

9         use I18N::LangTags::Detect;
10         my @user_wants = I18N::LangTags::Detect::detect();
11

DESCRIPTION

13       It is a common problem to want to detect what language(s) the user
14       would prefer output in.
15

FUNCTIONS

17       This module defines one public function,
18       "I18N::LangTags::Detect::detect()".  This function is not exported (nor
19       is even exportable), and it takes no parameters.
20
21       In scalar context, the function returns the most preferred language tag
22       (or undef if no preference was seen).
23
24       In list context (which is usually what you want), the function returns
25       a (possibly empty) list of language tags representing (best first) what
26       languages the user apparently would accept output in.  You will
27       probably want to pass the output of this through
28       "I18N::LangTags::implicate_supers_tightly(...)"  or
29       "I18N::LangTags::implicate_supers(...)", like so:
30
31         my @languages =
32           I18N::LangTags::implicate_supers_tightly(
33             I18N::LangTags::Detect::detect()
34           );
35

ENVIRONMENT

37       This module looks for several environment variables, including
38       REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE, LANGUAGE, LC_ALL, LC_MESSAGES,
39       and LANG.
40
41       It will also use the Win32::Locale module, if it's installed.
42

SEE ALSO

44       I18N::LangTags, Win32::Locale, Locale::Maketext.
45
46       (This module's core code started out as a routine in Locale::Maketext;
47       but I moved it here once I realized it was more generally useful.)
48
50       Copyright (c) 1998-2004 Sean M. Burke. All rights reserved.
51
52       This library is free software; you can redistribute it and/or modify it
53       under the same terms as Perl itself.
54
55       The programs and documentation in this dist are distributed in the hope
56       that they will be useful, but without any warranty; without even the
57       implied warranty of merchantability or fitness for a particular
58       purpose.
59

AUTHOR

61       Sean M. Burke "sburke@cpan.org"
62
63
64
65perl v5.30.1                      2019-11-29       I18N::LangTags::Detect(3pm)
Impressum