New extension that is part of Unicode and PHP 6.

A couple of functions/files were renamed/moved from ref.unicode to here
  *  i18n-loc-get-default.xml -->  locale-get-default.xml
  *  i18n-loc-set-default.xml -->  locale-set-default.xml


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@233377 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2007-04-06 05:45:58 +00:00
parent bdea8824da
commit cd1324b3ab
3 changed files with 279 additions and 0 deletions

View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.locale-get-default">
<refnamediv>
<refname>locale_get_default</refname>
<refpurpose>Get the default Locale</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>locale_get_default</methodname>
<void/>
</methodsynopsis>
<para>
This function returns the default Locale, which is used by PHP to localize
certain features. Please note that this isn't influenced by
<function>setlocale</function> or the system settings.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a <type>string</type> with the current Locale.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>locale_get_default</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// get the default Locale
echo locale_get_default();
//set a new Locale...
locale_set_default('pt_PT');
// ... and print it
echo locale_get_default();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
en_US_POSIX
pt_PT
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>locale_set_default</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:"../../../../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
-->

View file

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.locale-set-default">
<refnamediv>
<refname>locale_set_default</refname>
<refpurpose>Set the default Locale</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>locale_set_default</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
<para>
Sets the default Locale for PHP programs. Please note that this has nothing
to do with <function>setlocale</function> nor with the system locale.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The new Locale name. A comprehensive list of the supported locales is
available at <ulink url="&url.icu.locales;"/>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>locale_set_default</function> example</title>
<para>
This example demonstrates a possible usage of
<function>locale_set_default</function> to localize the
<function>sort</function> functions.
</para>
<programlisting role="php">
<![CDATA[
<?php
// the list of the strings to sort
$array = array(
'caramelo',
'cacto',
'caçada'
);
// set our locale (Portuguese, in this case)
locale_set_default('pt_PT');
// sort using the locale we previously set
sort($array, SORT_LOCALE_STRING);
print_r($array);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[0] => caçada
[1] => cacto
[2] => caramelo
)
]]>
</screen>
<para>
If we didn't use the locale, PHP would sort the string using the ASCII
characters value, thus returning (wrongly):
</para>
<screen>
<![CDATA[
Array
(
[0] => cacto
[1] => caramelo
[2] => caçada
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>locale_get_default</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:"../../../../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
-->

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Purpose: international -->
<!-- Membership: core, external -->
<!-- note to translators:
do NOT translate anything in this extension!!
the docs will change very very often -->
<reference id="ref.i18n">
<title>i18n &Functions;</title>
<titleabbrev>i18n</titleabbrev>
<partintro>
<section id="i18n.intro">
&reftitle.intro;
<para>
i18n support. <!-- nice intro needed :) -->
</para>
<warning>
<para>
This extension is still in development and it isn't available to public yet.
</para>
</warning>
</section>
<section id="i18n.requirements">
&reftitle.required;
<para>
The <link linkend="ref.unicode">Unicode Extension</link>.
</para>
</section>
</partintro>
&reference.i18n.functions;
</reference>
<!-- 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:"../../../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
-->