# rtl-detect

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

Latest version **1.1.2** (published 2023-10-24) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install rtl-detect
pnpm add rtl-detect
yarn add rtl-detect
bun add rtl-detect
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2023-10-24 |
| First published | 2015-02-03 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | separate (@types/rtl-detect) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 54 |
| Author | Shadi Abu Hilal |
| Maintainers | shadiabuhilal |
| Keywords | rtl-detect, rtl-detect, locale direction, locale dir, locale, intl direction, intl dir, intl, right-to-left, left-to-right, rtl, ltr, intl-lang |

## Links

- npm: https://www.npmjs.com/package/rtl-detect
- Repository: https://github.com/shadiabuhilal/rtl-detect
- Issues: https://github.com/shadiabuhilal/rtl-detect/issues
- npm.io page: https://npm.io/package/rtl-detect

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2023-10-24
- 1.1.1 — 2023-10-24
- 1.1.0 — 2023-10-24
- 1.0.4 — 2021-07-15
- 1.0.3 — 2021-05-10
- 1.0.2 — 2017-12-19
- 1.0.1 — 2017-12-18
- 1.0.0 — 2015-02-03

## README

# rtl-detect
![Build Status](https://github.com/shadiabuhilal/rtl-detect/actions/workflows/push-workflows.yml/badge.svg)

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



## Usage

### require rtl-detect lib
```js
var rtlDetect = require('rtl-detect');
```

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

Examples:

```js
var isRtl = rtlDetect.isRtlLang('ar-JO');
// isRtl will be true
```

```js
var isRtl = rtlDetect.isRtlLang('ar_JO');
// isRtl will be true
```

```js
var isRtl = rtlDetect.isRtlLang('ar');
// isRtl will be true
```

```js
var isRtl = rtlDetect.isRtlLang('en-US');
// isRtl will be false
```

### getLangDir
This function will get language direction for the locale.

Examples:

```js
var langDir = rtlDetect.getLangDir('ar-JO');
// langDir will be 'rtl'
```

```js
var langDir = rtlDetect.getLangDir('ar_JO');
// langDir will be 'rtl'
```

```js
var langDir = rtlDetect.getLangDir('ar');
// langDir will be 'rtl'
```

```js
var langDir = rtlDetect.getLangDir('en-US');
// langDir will be 'ltr'
```

Copyright 2015, Yahoo! Inc.

---
_Source: https://npm.io/package/rtl-detect · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
