Intl.Locale.prototype.getTextInfo()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The getTextInfo() method of Intl.Locale instances returns the ordering of characters indicated by either ltr (left-to-right) or by rtl (right-to-left) for this locale.

Note: In some versions of some browsers, this method was implemented as an accessor property called textInfo. However, because it returns a new object on each access, it is now implemented as a method to prevent the situation of locale.textInfo === locale.textInfo returning false. Check the browser compatibility table for details.

Syntax

js
getTextInfo()

Parameters

None.

Return value

An object representing text typesetting information associated with the Locale data specified in UTS 35's Layouts Elements. It has the following properties:

direction

A string indicating the direction of text for the locale. Can be either "ltr" (left-to-right) or "rtl" (right-to-left).

Examples

Obtaining text info

Return the supported text directions for a given Locale.

js
const ar = new Intl.Locale("ar");
console.log(ar.getTextInfo()); // { direction: "rtl" }
console.log(ar.getTextInfo().direction); // "rtl"
js
const es = new Intl.Locale("es");
console.log(es.getTextInfo()); // { direction: "ltr" }
console.log(es.getTextInfo().direction); // "ltr"

Specifications

Specification
Intl Locale Info Proposal
# sec-Intl.Locale.prototype.getTextInfo

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
getTextInfo
Chrome – Full support
Chrome 99 (Release date: 2022-03-01)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Chrome – Full support
Chrome 130 (Release date: 2024-10-15)
footnote Full support
Edge – Full support
Edge 99 (Release date: 2022-03-03)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Edge – Full support
Edge 130 (Release date: 2024-10-17)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 85 (Release date: 2022-03-23)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Opera – Full support
Opera 115 (Release date: 2024-11-27)
footnote Full support
Safari – No support
Safari 15.4 – TP (Release date: 2022-03-14)
altname
footnote Removed in TP and later
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Safari – Full support
Safari 17 (Release date: 2023-09-18)
footnote Full support
Chrome Android – Full support
Chrome Android 99 (Release date: 2022-03-01)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Chrome Android – Full support
Chrome Android 130 (Release date: 2024-10-15)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 68 (Release date: 2022-03-30)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Opera Android – Full support
Opera Android 86 (Release date: 2024-12-02)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15.4 (Release date: 2022-03-14)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Safari on iOS – Full support
Safari on iOS 17 (Release date: 2023-09-18)
footnote Full support
Samsung Internet – Full support
Samsung Internet 18 (Release date: 2022-08-08)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Samsung Internet – Full support
Samsung Internet 28 (Release date: 2025-04-02)
footnote Full support
WebView Android – Full support
WebView Android 99 (Release date: 2022-03-01)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
WebView Android – Full support
WebView Android 130 (Release date: 2024-10-15)
footnote Full support
WebView on iOS – Full support
WebView on iOS 15.4 (Release date: 2022-03-14)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
WebView on iOS – Full support
WebView on iOS 17 (Release date: 2023-09-18)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1.19 (Release date: 2022-02-17)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Node.js – Full support
Node.js 18 (Release date: 2022-04-19)
footnote , altname
altname Alternate name: textInfo
footnote Implemented as an accessor property.
Node.js – Full support
Node.js 24 (Release date: 2025-05-06)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.
Uses a non-standard name
Has more compatibility info.

See also