php-doc-en/reference/intl/locale/lookup.xml
Peter Cowburn 6dc49f7235 Fix example arguments
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@333164 c90b9560-bf6c-de11-be94-00142212c4b1
2014-03-29 21:52:55 +00:00

165 lines
4.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="locale.lookup">
<refnamediv>
<refname>Locale::lookup</refname>
<refname>locale_lookup</refname>
<refpurpose>Searches the language tag list for the best match to the language</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
&style.oop;
</para>
<methodsynopsis>
<modifier>public</modifier>
<modifier>static</modifier>
<type>string</type>
<methodname>Locale::lookup</methodname>
<methodparam><type>array</type><parameter>langtag</parameter></methodparam>
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>canonicalize</parameter><initializer>false</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>default</parameter></methodparam>
</methodsynopsis>
<para>
&style.procedural;
</para>
<methodsynopsis>
<type>string</type>
<methodname>locale_lookup</methodname>
<methodparam><type>array</type><parameter>langtag</parameter></methodparam>
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>canonicalize</parameter><initializer>false</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>default</parameter></methodparam>
</methodsynopsis>
<para>
Searches the items in <parameter>langtag</parameter> for the best match to
the language range specified in <parameter>locale</parameter> according to
RFC 4647's lookup algorithm.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>langtag</parameter></term>
<listitem>
<para>
An <type>array</type> containing a list of language tags to compare to
<parameter>locale</parameter>. Maximum 100 items allowed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>locale</parameter></term>
<listitem>
<para>
The locale to use as the language range when matching.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>canonicalize</parameter>
</term>
<listitem>
<para>
If true, the arguments will be converted to canonical form before
matching.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>default</parameter></term>
<listitem>
<para>
The locale to use if no match is found.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The closest matching language tag or default value.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>locale_lookup</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$arr = array(
'de-DEVA',
'de-DE-1996',
'de',
'de-De'
);
echo locale_lookup($arr, 'de-DE-1996-x-prv1-prv2', true, 'en_US');
?>
]]>
</programlisting>
</example>
<example>
<title>OO example</title>
<programlisting role="php">
<![CDATA[
<?php
$arr = array(
'de-DEVA',
'de-DE-1996',
'de',
'de-De'
);
echo Locale::lookup($arr, 'de-DE-1996-x-prv1-prv2', true, 'en_US');
?>
]]>
</programlisting>
</example>
&example.outputs;
<screen>
<![CDATA[
de_de_1996
]]>
</screen>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>locale_filter_matches</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->