This library will help you to detect if the intl is right-to-left language
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
tasks Add Avestan and N'Ko to rtl languages list Dec 19, 2017
test
.eslintrc.json
.gitignore
.travis.yml Add Avestan and N'Ko to rtl languages list Dec 19, 2017
Gruntfile.js
LICENSE.md Rename LICENSE to LICENSE.md Feb 3, 2015
README.md
index.js
package.json

README.md

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.