php-doc-en/reference/intl/locale/parse-locale.xml
2013-06-18 05:36:30 +00:00

133 lines
3.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.parselocale">
<refnamediv>
<refname>Locale::parseLocale</refname>
<refname>locale_parse</refname>
<refpurpose>Returns a key-value array of locale ID subtag elements.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
&style.oop;
</para>
<methodsynopsis>
<modifier>public</modifier>
<modifier>static</modifier>
<type>array</type>
<methodname>Locale::parseLocale</methodname>
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
</methodsynopsis>
<para>
&style.procedural;
</para>
<methodsynopsis>
<type>array</type>
<methodname>locale_parse</methodname>
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
</methodsynopsis>
<para>
Returns a key-value array of locale ID subtag elements.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>locale</parameter></term>
<listitem>
<para>
The locale to extract the subtag array from. Note: The 'variant' and
'private' subtags can take maximum 15 values whereas 'extlang' can take
maximum 3 values.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array containing a list of key-value pairs, where the keys
identify the particular locale ID subtags, and the values are the
associated subtag values. The array will be ordered as the locale id
subtags e.g. in the locale id if variants are '-varX-varY-varZ' then the
returned array will have variant0=&gt;varX , variant1=&gt;varY ,
variant2=&gt;varZ
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>locale_parse</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$arr = locale_parse('sl-Latn-IT-nedis');
if ($arr) {
foreach ($arr as $key => $value) {
echo "$key : $value , ";
}
}
?>
]]>
</programlisting>
</example>
<example>
<title>OO example</title>
<programlisting role="php">
<![CDATA[
<?php
$arr = Locale::parseLocale('sl-Latn-IT-nedis');
if ($arr) {
foreach ($arr as $key => $value) {
echo "$key : $value , ";
}
}
?>
]]>
</programlisting>
</example>
&example.outputs;
<screen>
<![CDATA[
language : sl , script : Latn , region : IT , variant0 : NEDIS ,
]]>
</screen>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>locale_compose</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
-->