Skip to content

Commit 255b4f1

Browse files
authored
ext/intl: document PHP 8.5 changes (#5806)
* ext/intl: document PHP 8.5 changes - Add Locale::addLikelySubtags() and Locale::minimizeSubtags() methods - Add grapheme_levenshtein() function - Locale methods now throw ValueError when locale arguments contain null bytes * docs(intl): add missing seealso links to Locale and grapheme pages
1 parent c05fbe7 commit 255b4f1

3 files changed

Lines changed: 190 additions & 1 deletion

File tree

reference/intl/locale.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
</simpara>
3636
<simpara>
3737
Locales cannot be instantiated as objects. All of the functions/methods
38-
provided are static.
38+
provided are static. Use <methodname>Locale::getDefault</methodname> and
39+
<methodname>Locale::setDefault</methodname> to read and write the default
40+
locale used by ICU.
3941
</simpara>
4042
<simpara>
4143
The null or empty string obtains the "root" locale. The "root" locale is
@@ -177,6 +179,14 @@
177179
</row>
178180
</thead>
179181
<tbody>
182+
<row>
183+
<entry>8.5.0</entry>
184+
<entry>
185+
<classname>Locale</classname> methods now throw a
186+
<exceptionname>ValueError</exceptionname> when a locale argument
187+
contains null bytes.
188+
</entry>
189+
</row>
180190
<row>
181191
<entry>8.4.0</entry>
182192
<entry>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="locale.addlikelysubtags" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<refnamediv>
5+
<refname>Locale::addLikelySubtags</refname>
6+
<refname>locale_add_likely_subtags</refname>
7+
<refpurpose>Add likely subtags to a locale</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<simpara>
13+
&style.oop;
14+
</simpara>
15+
<methodsynopsis role="Locale">
16+
<modifier>public</modifier> <modifier>static</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>Locale::addLikelySubtags</methodname>
17+
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
18+
</methodsynopsis>
19+
<simpara>
20+
&style.procedural;
21+
</simpara>
22+
<methodsynopsis>
23+
<type class="union"><type>string</type><type>false</type></type><methodname>locale_add_likely_subtags</methodname>
24+
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
25+
</methodsynopsis>
26+
<simpara>
27+
Expands a locale tag by adding likely subtags based on the ICU locale data.
28+
For example, <literal>en</literal> becomes <literal>en_Latn_US</literal>.
29+
</simpara>
30+
</refsect1>
31+
32+
<refsect1 role="parameters">
33+
&reftitle.parameters;
34+
<variablelist>
35+
<varlistentry>
36+
<term><parameter>locale</parameter></term>
37+
<listitem>
38+
<simpara>
39+
The locale to expand.
40+
</simpara>
41+
</listitem>
42+
</varlistentry>
43+
</variablelist>
44+
</refsect1>
45+
46+
<refsect1 role="returnvalues">
47+
&reftitle.returnvalues;
48+
<simpara>
49+
Returns the locale with likely subtags added, or &false; on failure.
50+
</simpara>
51+
</refsect1>
52+
53+
<refsect1 role="errors">
54+
&reftitle.errors;
55+
<simpara>
56+
Throws a <exceptionname>ValueError</exceptionname> when the <parameter>locale</parameter>
57+
argument contains null bytes.
58+
</simpara>
59+
</refsect1>
60+
61+
<refsect1 role="seealso">
62+
&reftitle.seealso;
63+
<simplelist>
64+
<member><methodname>Locale::minimizeSubtags</methodname></member>
65+
<member><methodname>Locale::canonicalize</methodname></member>
66+
</simplelist>
67+
</refsect1>
68+
69+
</refentry>
70+
<!-- Keep this comment at the end of the file
71+
Local variables:
72+
mode: sgml
73+
sgml-omittag:t
74+
sgml-shorttag:t
75+
sgml-minimize-attributes:nil
76+
sgml-always-quote-attributes:t
77+
sgml-indent-step:1
78+
sgml-indent-data:t
79+
indent-tabs-mode:nil
80+
sgml-parent-document:nil
81+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
82+
sgml-exposed-tags:nil
83+
sgml-local-catalogs:nil
84+
sgml-local-ecat-files:nil
85+
End:
86+
vim600: syn=xml fen fdm=syntax fdl=2 si
87+
vim: et tw=78 syn=sgml
88+
vi: ts=1 sw=1
89+
-->
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="locale.minimizesubtags" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<refnamediv>
5+
<refname>Locale::minimizeSubtags</refname>
6+
<refname>locale_minimize_subtags</refname>
7+
<refpurpose>Remove likely subtags from a locale</refpurpose>
8+
</refnamediv>
9+
10+
<refsect1 role="description">
11+
&reftitle.description;
12+
<simpara>
13+
&style.oop;
14+
</simpara>
15+
<methodsynopsis role="Locale">
16+
<modifier>public</modifier> <modifier>static</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>Locale::minimizeSubtags</methodname>
17+
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
18+
</methodsynopsis>
19+
<simpara>
20+
&style.procedural;
21+
</simpara>
22+
<methodsynopsis>
23+
<type class="union"><type>string</type><type>false</type></type><methodname>locale_minimize_subtags</methodname>
24+
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
25+
</methodsynopsis>
26+
<simpara>
27+
Minimizes a locale tag by removing subtags that can be inferred using the
28+
ICU likely subtag data. For example, <literal>en_Latn_US</literal> becomes
29+
<literal>en</literal>.
30+
</simpara>
31+
</refsect1>
32+
33+
<refsect1 role="parameters">
34+
&reftitle.parameters;
35+
<variablelist>
36+
<varlistentry>
37+
<term><parameter>locale</parameter></term>
38+
<listitem>
39+
<simpara>
40+
The locale to minimize.
41+
</simpara>
42+
</listitem>
43+
</varlistentry>
44+
</variablelist>
45+
</refsect1>
46+
47+
<refsect1 role="returnvalues">
48+
&reftitle.returnvalues;
49+
<simpara>
50+
Returns the locale with likely subtags removed, or &false; on failure.
51+
</simpara>
52+
</refsect1>
53+
54+
<refsect1 role="errors">
55+
&reftitle.errors;
56+
<simpara>
57+
Throws a <exceptionname>ValueError</exceptionname> when the <parameter>locale</parameter>
58+
argument contains null bytes.
59+
</simpara>
60+
</refsect1>
61+
62+
<refsect1 role="seealso">
63+
&reftitle.seealso;
64+
<simplelist>
65+
<member><methodname>Locale::addLikelySubtags</methodname></member>
66+
<member><methodname>Locale::canonicalize</methodname></member>
67+
</simplelist>
68+
</refsect1>
69+
70+
</refentry>
71+
<!-- Keep this comment at the end of the file
72+
Local variables:
73+
mode: sgml
74+
sgml-omittag:t
75+
sgml-shorttag:t
76+
sgml-minimize-attributes:nil
77+
sgml-always-quote-attributes:t
78+
sgml-indent-step:1
79+
sgml-indent-data:t
80+
indent-tabs-mode:nil
81+
sgml-parent-document:nil
82+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
83+
sgml-exposed-tags:nil
84+
sgml-local-catalogs:nil
85+
sgml-local-ecat-files:nil
86+
End:
87+
vim600: syn=xml fen fdm=syntax fdl=2 si
88+
vim: et tw=78 syn=sgml
89+
vi: ts=1 sw=1
90+
-->

0 commit comments

Comments
 (0)