rtl-detect-intl
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

rtl-detect-intl

This is a fork of rtl-detect that uses the browser/node Intl API if possible: Locale.getTextInfo()

Usage

require rtl-detect-intl lib

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

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.

Package Sidebar

Install

npm i rtl-detect-intl

Weekly Downloads

33

Version

0.1.2

License

BSD-3-Clause

Unpacked Size

24.5 kB

Total Files

12

Last publish

Collaborators

  • asakusuma