[DOC-CVS] [doc-en] master: Document locale_canonicalize (#4963)
[email protected] (AllenJB via GitHub)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: AllenJB (AllenJB)
Committer: GitHub (web-flow)
Pusher: devnexen
Date: 2025-11-03T20:43:48Z
Commit: https://github.com/php/doc-en/commit/8a22321e312e13fb1e2785169a0e83df84c0c3d0
Raw diff: https://github.com/php/doc-en/commit/8a22321e312e13fb1e2785169a0e83df84c0c3d0.diff
Document locale_canonicalize (#4963)
Changed paths:
M reference/intl/locale/canonicalize.xml
Diff:
diff --git a/reference/intl/locale/canonicalize.xml b/reference/intl/locale/canonicalize.xml
index 060c0c3119cd..f284efa22cfb 100644
--- a/reference/intl/locale/canonicalize.xml
+++ b/reference/intl/locale/canonicalize.xml
@@ -13,12 +13,17 @@
<modifier>public</modifier> <modifier>static</modifier> <type class="union"><type>string</type><type>null</type></type><methodname>Locale::canonicalize</methodname>
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
</methodsynopsis>
- <para>
-
- </para>
-
- &warn.undocumented.func;
-
+ <simpara>
+ Canonicalizes the passed locale string to ICU format.
+ </simpara>
+ <simpara>
+ This does not necessarily indicate or return a valid locale. It is only a
+ version of the input that has been canonicalized according to ICU rules.
+ </simpara>
+ <simpara>
+ The behavior of this function depends on the version of ICU PHP is using
+ (<constant>INTL_ICU_VERSION</constant>).
+ </simpara>
</refsect1>
<refsect1 role="parameters">
@@ -27,9 +32,9 @@
<varlistentry>
<term><parameter>locale</parameter></term>
<listitem>
- <para>
-
- </para>
+ <simpara>
+ Original locale string.
+ </simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -43,7 +48,25 @@
&intl.locale-len.return;
</refsect1>
-
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <example>
+ <title><function>locale_canonicalize</function> example</title>
+ <programlisting role="php">
+ <![CDATA[
+echo Locale::canonicalize('en-US.utf8') . "\n";
+echo Locale::canonicalize('totally-not-valid') . "\n";
+ ]]>
+ </programlisting>
+ </example>
+ &example.outputs.similar;
+ <screen>
+ <![CDATA[
+en_US
+totally_NOT_VALID
+ ]]>
+ </screen>
+ </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables: