nlopess         Sun Sep 25 11:46:03 2005 EDT

  Added files:                 
    /phpdoc/en/reference/unicode/functions      i18n-loc-get-default.xml 
                                                i18n-loc-set-default.xml 
  Log:
  add 2 new unicode functions
  

http://cvs.php.net/co.php/phpdoc/en/reference/unicode/functions/i18n-loc-get-default.xml?r=1.1&p=1
Index: phpdoc/en/reference/unicode/functions/i18n-loc-get-default.xml
+++ phpdoc/en/reference/unicode/functions/i18n-loc-get-default.xml
<?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
-->

http://cvs.php.net/co.php/phpdoc/en/reference/unicode/functions/i18n-loc-set-default.xml?r=1.1&p=1
Index: phpdoc/en/reference/unicode/functions/i18n-loc-set-default.xml
+++ phpdoc/en/reference/unicode/functions/i18n-loc-set-default.xml
<?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
-->

Reply via email to