[DOC-CVS] [doc-en] master: Document Locale::isRightToLeft (PHP 8.5) (#5055)
[email protected] (Louis-Arnaud via GitHub) Wed, 22 Apr 2026 00:20:57 +0000
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Louis-Arnaud (lacatoire) Committer: GitHub (web-flow) Pusher: DanielEScherzer Date: 2026-04-21T17:20:55-07:00 Commit: https://github.com/php/doc-en/commit/ac2b471bbca22b1b77140cf7c67c979d18a0caec Raw diff: https://github.com/php/doc-en/commit/ac2b471bbca22b1b77140cf7c67c979d18a0caec.diff Document Locale::isRightToLeft (PHP 8.5) (#5055) --------- Co-authored-by: Gina Peter Banyard <[email protected]> Changed paths: A reference/intl/locale/isrighttoleft.xml Diff: diff --git a/reference/intl/locale/isrighttoleft.xml b/reference/intl/locale/isrighttoleft.xml new file mode 100644 index 000000000000..c0a3e2c22f7b --- /dev/null +++ b/reference/intl/locale/isrighttoleft.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> +<refentry xml:id="locale.isrighttoleft" + xmlns="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <refnamediv> + <refname>Locale::isRightToLeft</refname> + <refpurpose>Check whether a locale uses a right-to-left writing system</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis role="Locale"> + <modifier>public</modifier> + <modifier>static</modifier> + <type>bool</type> + <methodname>Locale::isRightToLeft</methodname> + <methodparam choice="opt"> + <type>string</type><parameter>locale</parameter> + <initializer>""</initializer> + </methodparam> + </methodsynopsis> + + <simpara> + Determines whether a locale uses a right-to-left writing system. + </simpara> + + <simpara> + This method relies on the ICU library and evaluates the dominant script + associated with the locale. + </simpara> + + <simpara> + If an empty string is provided, the default locale is used. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>locale</parameter></term> + <listitem> + <simpara> + The locale identifier. If empty, the default locale is used. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + Returns &true; if the locale uses a right-to-left + writing system, or &false; otherwise. + </simpara> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>8.5.0</entry> + <entry> + Added <methodname>Locale::isRightToLeft</methodname>. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>Checking text direction for a locale</title> + <programlisting> +<![CDATA[ +var_dump(Locale::isRightToLeft('en-US')); +var_dump(Locale::isRightToLeft('ar')); +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +bool(false) +bool(true) +]]> + </screen> + </example> + </refsect1> + +</refentry>