mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-23 12:28:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@132198 c90b9560-bf6c-de11-be94-00142212c4b1
141 lines
4.6 KiB
XML
141 lines
4.6 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.10 $ -->
|
|
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
|
|
<refentry id="function.setlocale">
|
|
<refnamediv>
|
|
<refname>setlocale</refname>
|
|
<refpurpose>Set locale information</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>setlocale</methodname>
|
|
<methodparam><type>mixed</type><parameter>category</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>...</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>setlocale</methodname>
|
|
<methodparam><type>mixed</type><parameter>category</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>locale</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<parameter>Category</parameter> is a named constant (or string)
|
|
specifying the category of the functions affected by the locale
|
|
setting:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
LC_ALL for all of the below
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
LC_COLLATE for string comparison, see
|
|
<function>strcoll</function>
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
LC_CTYPE for character classification and conversion, for
|
|
example <function>strtoupper</function>
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
LC_MONETARY for <function>localeconv</function>
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara> LC_NUMERIC for decimal separator (See also
|
|
<function>localeconv</function>)
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
LC_TIME for date and time formatting with
|
|
<function>strftime</function>
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
<para>
|
|
If <parameter>locale</parameter> is the empty string
|
|
<literal>""</literal>, the locale names will be set from the
|
|
values of environment variables with the same names as the above
|
|
categories, or from "LANG".
|
|
</para>
|
|
<para>
|
|
If <parameter>locale</parameter> is zero or <literal>"0"</literal>, the locale setting
|
|
is not affected, only the current setting is returned.
|
|
</para>
|
|
<para>
|
|
If <parameter>locale</parameter> is an array or followed by additional
|
|
parameters then each array element or parameter is tried to be set as
|
|
new locale until success. This is usefull if a locale is known under
|
|
different names on different systems or for providing a fallback
|
|
for a possibly not available locale.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Passing multiple locales is not available before PHP 4.3.0
|
|
</simpara>
|
|
</note>
|
|
<para>
|
|
Setlocale returns the new current locale, or &false; if the locale
|
|
functionality is not implemented in the platform, the specified
|
|
locale does not exist or the category name is invalid.
|
|
An invalid category name also causes a warning message. Category/locale
|
|
names can be found in <ulink url="&url.rfc;1766">RFC 1766</ulink>
|
|
and <ulink url="&url.iso-639;">ISO 639</ulink>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
The return value of <function>setlocale</function> depends
|
|
on the system that PHP is running. It returns exactly
|
|
what the system setlocale function returns.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title><function>setlocale</function> Examples</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Set locale to Dutch */
|
|
setlocale (LC_ALL, 'nl_NL');
|
|
|
|
/* Output: vrijdag 22 december 1978 */
|
|
echo strftime ("%A %e %B %Y", mktime (0, 0, 0, 12, 22, 1978));
|
|
|
|
/* try different possible locale names for german as of PHP 4.3.0 */
|
|
$loc_de = setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
|
echo "Preferred locale for german on this system is '$loc_de'";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</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
|
|
-->
|