Skip to content

Commit ac2b471

Browse files
lacatoireGirgias
andauthored
Document Locale::isRightToLeft (PHP 8.5) (#5055)
--------- Co-authored-by: Gina Peter Banyard <girgias@php.net>
1 parent ff9181e commit ac2b471

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="locale.isrighttoleft"
4+
xmlns="http://docbook.org/ns/docbook"
5+
xmlns:xlink="http://www.w3.org/1999/xlink">
6+
7+
<refnamediv>
8+
<refname>Locale::isRightToLeft</refname>
9+
<refpurpose>Check whether a locale uses a right-to-left writing system</refpurpose>
10+
</refnamediv>
11+
12+
<refsect1 role="description">
13+
&reftitle.description;
14+
<methodsynopsis role="Locale">
15+
<modifier>public</modifier>
16+
<modifier>static</modifier>
17+
<type>bool</type>
18+
<methodname>Locale::isRightToLeft</methodname>
19+
<methodparam choice="opt">
20+
<type>string</type><parameter>locale</parameter>
21+
<initializer>""</initializer>
22+
</methodparam>
23+
</methodsynopsis>
24+
25+
<simpara>
26+
Determines whether a locale uses a right-to-left writing system.
27+
</simpara>
28+
29+
<simpara>
30+
This method relies on the ICU library and evaluates the dominant script
31+
associated with the locale.
32+
</simpara>
33+
34+
<simpara>
35+
If an empty string is provided, the default locale is used.
36+
</simpara>
37+
</refsect1>
38+
39+
<refsect1 role="parameters">
40+
&reftitle.parameters;
41+
<variablelist>
42+
<varlistentry>
43+
<term><parameter>locale</parameter></term>
44+
<listitem>
45+
<simpara>
46+
The locale identifier. If empty, the default locale is used.
47+
</simpara>
48+
</listitem>
49+
</varlistentry>
50+
</variablelist>
51+
</refsect1>
52+
53+
<refsect1 role="returnvalues">
54+
&reftitle.returnvalues;
55+
<simpara>
56+
Returns &true; if the locale uses a right-to-left
57+
writing system, or &false; otherwise.
58+
</simpara>
59+
</refsect1>
60+
61+
<refsect1 role="changelog">
62+
&reftitle.changelog;
63+
<informaltable>
64+
<tgroup cols="2">
65+
<thead>
66+
<row>
67+
<entry>&Version;</entry>
68+
<entry>&Description;</entry>
69+
</row>
70+
</thead>
71+
<tbody>
72+
<row>
73+
<entry>8.5.0</entry>
74+
<entry>
75+
Added <methodname>Locale::isRightToLeft</methodname>.
76+
</entry>
77+
</row>
78+
</tbody>
79+
</tgroup>
80+
</informaltable>
81+
</refsect1>
82+
83+
<refsect1 role="examples">
84+
&reftitle.examples;
85+
<example>
86+
<title>Checking text direction for a locale</title>
87+
<programlisting>
88+
<![CDATA[
89+
var_dump(Locale::isRightToLeft('en-US'));
90+
var_dump(Locale::isRightToLeft('ar'));
91+
]]>
92+
</programlisting>
93+
&example.outputs;
94+
<screen>
95+
<![CDATA[
96+
bool(false)
97+
bool(true)
98+
]]>
99+
</screen>
100+
</example>
101+
</refsect1>
102+
103+
</refentry>

0 commit comments

Comments
 (0)