📄 detect.html
字号:
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../../displayToc.js"></script>
<script language="JavaScript" src="../../../tocParas.js"></script>
<script language="JavaScript" src="../../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../../scineplex.css">
<title>I18N::LangTags::Detect - detect the user's language preferences</title>
<link rel="stylesheet" href="../../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
<script>writelinks('__top__',3);</script>
<h1><a>I18N::LangTags::Detect - detect the user's language preferences</a></h1>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#functions">FUNCTIONS</a></li>
<li><a href="#environment">ENVIRONMENT</a></li>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#copyright">COPYRIGHT</a></li>
<li><a href="#author">AUTHOR</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>I18N::LangTags::Detect - detect the user's language preferences</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
<span class="keyword">use</span> <span class="variable">I18N::LangTags::Detect</span><span class="operator">;</span>
<span class="keyword">my</span> <span class="variable">@user_wants</span> <span class="operator">=</span> <span class="variable">I18N::LangTags::Detect::detect</span><span class="operator">();</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>It is a common problem to want to detect what <code>language(s)</code> the user would
prefer output in.</p>
<p>
</p>
<hr />
<h1><a name="functions">FUNCTIONS</a></h1>
<p>This module defines one public function,
<code>I18N::LangTags::Detect::detect()</code>. This function is not exported
(nor is even exportable), and it takes no parameters.</p>
<p>In scalar context, the function returns the most preferred language
tag (or undef if no preference was seen).</p>
<p>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
<code>I18N::LangTags::implicate_supers_tightly(...)</code>
or
<code>I18N::LangTags::implicate_supers(...)</code>, like so:</p>
<pre>
<span class="keyword">my</span> <span class="variable">@languages</span> <span class="operator">=</span>
<span class="variable">I18N::LangTags::implicate_supers_tightly</span><span class="operator">(</span>
<span class="variable">I18N::LangTags::Detect::detect</span><span class="operator">()</span>
<span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="environment">ENVIRONMENT</a></h1>
<p>This module looks for several environment variables, including
REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE,
LANGUAGE, LC_ALL, LC_MESSAGES, and LANG.</p>
<p>It will also use the <a href="../../../Win32/Locale.html">the Win32::Locale manpage</a> module, if it's installed.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="../../../lib/I18N/LangTags.html">the I18N::LangTags manpage</a>, <a href="../../../Win32/Locale.html">the Win32::Locale manpage</a>, <a href="../../../lib/Locale/Maketext.html">the Locale::Maketext manpage</a>.</p>
<p>(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.)</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright (c) 1998-2004 Sean M. Burke. All rights reserved.</p>
<p>This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.</p>
<p>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.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Sean M. Burke <code>sburke@cpan.org</code></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -