Debian Codegraph @

upstream/debian-unstable/man3/I18N::LangTags::Detect.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "I18N::LangTags::Detect 3perl"
58 .TH I18N::LangTags::Detect 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 I18N::LangTags::Detect \- detect the user's language preferences
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 2
68 \& use I18N::LangTags::Detect;
69 \& my @user_wants = I18N::LangTags::Detect::detect();
70 .Ve
71 .SH DESCRIPTION
72 .IX Header "DESCRIPTION"
73 It is a common problem to want to detect what language(s) the user would
74 prefer output in.
75 .SH FUNCTIONS
76 .IX Header "FUNCTIONS"
77 This module defines one public function,
78 \&\f(CWI18N::LangTags::Detect::detect()\fR. This function is not exported
79 (nor is even exportable), and it takes no parameters.
80 .PP
81 In scalar context, the function returns the most preferred language
82 tag (or undef if no preference was seen).
83 .PP
84 In list context (which is usually what you want),
85 the function returns a
86 (possibly empty) list of language tags representing (best first) what
87 languages the user apparently would accept output in. You will
88 probably want to pass the output of this through
89 \&\f(CWI18N::LangTags::implicate_supers_tightly(...)\fR
90 or
91 \&\f(CWI18N::LangTags::implicate_supers(...)\fR, like so:
92 .PP
93 .Vb 4
94 \& my @languages =
95 \& I18N::LangTags::implicate_supers_tightly(
96 \& I18N::LangTags::Detect::detect()
97 \& );
98 .Ve
99 .SH ENVIRONMENT
100 .IX Header "ENVIRONMENT"
101 This module looks at several environment variables:
102 REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE,
103 LANGUAGE, LC_ALL, LC_MESSAGES, and LANG.
104 .PP
105 It will also use the Win32::Locale module, if it's installed
106 and IGNORE_WIN32_LOCALE is not set to a true value in the
107 environment.
108 .SH "SEE ALSO"
109 .IX Header "SEE ALSO"
110 I18N::LangTags, Win32::Locale, Locale::Maketext.
111 .PP
112 (This module's core code started out as a routine in Locale::Maketext;
113 but I moved it here once I realized it was more generally useful.)
114 .SH COPYRIGHT
115 .IX Header "COPYRIGHT"
116 Copyright (c) 1998\-2004 Sean M. Burke. All rights reserved.
117 .PP
118 This library is free software; you can redistribute it and/or
119 modify it under the same terms as Perl itself.
120 .PP
121 The programs and documentation in this dist are distributed in
122 the hope that they will be useful, but without any warranty; without
123 even the implied warranty of merchantability or fitness for a
124 particular purpose.
125 .SH AUTHOR
126 .IX Header "AUTHOR"
127 Sean M. Burke \f(CW\*(C`[email protected]\*(C'\fR