.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "I18N::LangTags::Detect 3perl" .TH I18N::LangTags::Detect 3perl "2021-09-24" "perl v5.32.1" "Perl Programmers Reference Guide" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" I18N::LangTags::Detect \- detect the user's language preferences .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use I18N::LangTags::Detect; \& my @user_wants = I18N::LangTags::Detect::detect(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" It is a common problem to want to detect what language(s) the user would prefer output in. .SH "FUNCTIONS" .IX Header "FUNCTIONS" This module defines one public function, \&\f(CW\*(C`I18N::LangTags::Detect::detect()\*(C'\fR. This function is not exported (nor is even exportable), and it takes no parameters. .PP In scalar context, the function returns the most preferred language tag (or undef if no preference was seen). .PP 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 \&\f(CW\*(C`I18N::LangTags::implicate_supers_tightly(...)\*(C'\fR or \&\f(CW\*(C`I18N::LangTags::implicate_supers(...)\*(C'\fR, like so: .PP .Vb 4 \& my @languages = \& I18N::LangTags::implicate_supers_tightly( \& I18N::LangTags::Detect::detect() \& ); .Ve .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" This module looks at several environment variables: \&\s-1REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE, LANGUAGE, LC_ALL, LC_MESSAGES,\s0 and \s-1LANG.\s0 .PP It will also use the Win32::Locale module, if it's installed and \s-1IGNORE_WIN32_LOCALE\s0 is not set to a true value in the environment. .SH "SEE ALSO" .IX Header "SEE ALSO" I18N::LangTags, Win32::Locale, Locale::Maketext. .PP (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.) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 1998\-2004 Sean M. Burke. All rights reserved. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP 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. .SH "AUTHOR" .IX Header "AUTHOR" Sean M. Burke \f(CW\*(C`sburke@cpan.org\*(C'\fR