Debian Codegraph @

upstream/opensuse-tumbleweed/man3/I18N::LangTags::Detect.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (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 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "I18N::LangTags::Detect 3pm"
61 .TH I18N::LangTags::Detect 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 I18N::LangTags::Detect \- detect the user\*(Aqs language preferences
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 2
71 \& use I18N::LangTags::Detect;
72 \& my @user_wants = I18N::LangTags::Detect::detect();
73 .Ve
74 .SH DESCRIPTION
75 .IX Header "DESCRIPTION"
76 It is a common problem to want to detect what language(s) the user would
77 prefer output in.
78 .SH FUNCTIONS
79 .IX Header "FUNCTIONS"
80 This module defines one public function,
81 \&\f(CWI18N::LangTags::Detect::detect()\fR. This function is not exported
82 (nor is even exportable), and it takes no parameters.
83 .PP
84 In scalar context, the function returns the most preferred language
85 tag (or undef if no preference was seen).
86 .PP
87 In list context (which is usually what you want),
88 the function returns a
89 (possibly empty) list of language tags representing (best first) what
90 languages the user apparently would accept output in. You will
91 probably want to pass the output of this through
92 \&\f(CWI18N::LangTags::implicate_supers_tightly(...)\fR
93 or
94 \&\f(CWI18N::LangTags::implicate_supers(...)\fR, like so:
95 .PP
96 .Vb 4
97 \& my @languages =
98 \& I18N::LangTags::implicate_supers_tightly(
99 \& I18N::LangTags::Detect::detect()
100 \& );
101 .Ve
102 .SH ENVIRONMENT
103 .IX Header "ENVIRONMENT"
104 This module looks at several environment variables:
105 REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE,
106 LANGUAGE, LC_ALL, LC_MESSAGES, and LANG.
107 .PP
108 It will also use the Win32::Locale module, if it\*(Aqs installed
109 and IGNORE_WIN32_LOCALE is not set to a true value in the
110 environment.
111 .SH "SEE ALSO"
112 .IX Header "SEE ALSO"
113 I18N::LangTags, Win32::Locale, Locale::Maketext.
114 .PP
115 (This module\*(Aqs core code started out as a routine in Locale::Maketext;
116 but I moved it here once I realized it was more generally useful.)
117 .SH COPYRIGHT
118 .IX Header "COPYRIGHT"
119 Copyright (c) 1998\-2004 Sean M. Burke. All rights reserved.
120 .PP
121 This library is free software; you can redistribute it and/or
122 modify it under the same terms as Perl itself.
123 .PP
124 The programs and documentation in this dist are distributed in
125 the hope that they will be useful, but without any warranty; without
126 even the implied warranty of merchantability or fitness for a
127 particular purpose.
128 .SH AUTHOR
129 .IX Header "AUTHOR"
130 Sean M. Burke \f(CW\*(C`[email protected]\*(C'\fR