Socket
Socket
Sign inDemoInstall

intl-locale-textinfo-polyfill

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    intl-locale-textinfo-polyfill

Library will help you to detect if the locale is right-to-left language.


Version published
Weekly downloads
383
decreased by-13.35%
Maintainers
1
Install size
20.5 kB
Created
Weekly downloads
 

Changelog

Source

2.1.1

  • fix: TS index import issue with outFile

Readme

Source

intl-locale-textinfo-polyfill

This library will help you to detect if the locale is right-to-left language or not.

It implements part of this now Stage 3 intl-locale-info proposal.

The library has begun as a fork of rtl-detect, but it strives to adhere to the Intl.Locale (textInfo) proposal (notably, locales with underscores as in the form en_US are not accepted).

Usage

import the library as a ponyfill

import Locale from 'intl-locale-textinfo-polyfill';

const { direction } = new Locale('he').textInfo;
// "rtl"

import the library as a polyfill

import 'intl-locale-textinfo-polyfill/lib/polyfill.js';

const { direction } = new Intl.Locale('he').textInfo;
// `direction` will be "rtl"

Intl.Locale#textInfo

This returns an object with the language direction for the locale.

Examples:

const { direction } = new Intl.Locale('ar-JO').textInfo;
// `direction` will be "rtl"
const { direction } = new Intl.Locale('ar').textInfo;
// `direction` will be "rtl"
const { direction } = new Intl.Locale('en-US')).textInfo;
// `direction` will be "ltr"

Keywords

FAQs

Last updated on 29 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc