Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rtl-detect

shadiabuhilal2.6mBSD-3-Clause1.1.2TypeScript support: definitely-typed

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

rtl-detect, rtl-detect, locale direction, locale dir, locale, intl direction, intl dir, intl, right-to-left, left-to-right, rtl, ltr, intl-lang

readme

rtl-detect

Build Status

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

Usage

require rtl-detect lib

var rtlDetect = require('rtl-detect');

isRtlLang

This function will check if the locale is right-to-left language or not.

Examples:

var isRtl = rtlDetect.isRtlLang('ar-JO');
// isRtl will be true
var isRtl = rtlDetect.isRtlLang('ar_JO');
// isRtl will be true
var isRtl = rtlDetect.isRtlLang('ar');
// isRtl will be true
var isRtl = rtlDetect.isRtlLang('en-US');
// isRtl will be false

getLangDir

This function will get language direction for the locale.

Examples:

var langDir = rtlDetect.getLangDir('ar-JO');
// langDir will be 'rtl'
var langDir = rtlDetect.getLangDir('ar_JO');
// langDir will be 'rtl'
var langDir = rtlDetect.getLangDir('ar');
// langDir will be 'rtl'
var langDir = rtlDetect.getLangDir('en-US');
// langDir will be 'ltr'

Copyright 2015, Yahoo! Inc.

changelog

1.1.2 (2023-10-24)

Bug Fixes

  • file name: fix CHANGELOG.md to be generated automatically (9a89bc7)