mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
add 2 new unicode functions
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@196911 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
c02c3077f2
commit
fb4907aa32
2 changed files with 222 additions and 0 deletions
89
reference/unicode/functions/i18n-loc-get-default.xml
Normal file
89
reference/unicode/functions/i18n-loc-get-default.xml
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.i18n-loc-get-default">
|
||||
<refnamediv>
|
||||
<refname>i18n_loc_get_default</refname>
|
||||
<refpurpose>Get the default Locale</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>i18n_loc_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>i18n_loc_get_default</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// get the default Locale
|
||||
echo i18n_loc_get_default();
|
||||
|
||||
//set a new Locale...
|
||||
i18n_loc_set_default('pt_PT');
|
||||
|
||||
// ... and print it
|
||||
echo i18n_loc_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>i18n_loc_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
|
||||
-->
|
133
reference/unicode/functions/i18n-loc-set-default.xml
Normal file
133
reference/unicode/functions/i18n-loc-set-default.xml
Normal file
|
@ -0,0 +1,133 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.i18n-loc-set-default">
|
||||
<refnamediv>
|
||||
<refname>i18n_loc_set_default</refname>
|
||||
<refpurpose>Set the default Locale</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>i18n_loc_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>i18n_loc_set_default</function> example</title>
|
||||
<para>
|
||||
This example demonstrates a possible usage of
|
||||
<function>i18n_loc_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)
|
||||
i18n_loc_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>i18n_loc_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
|
||||
-->
|
Loading…
Reference in a new issue