Security News
Dutch National Police Disrupt Redline and Meta Malware Operations
Dutch National Police and FBI dismantle Redline and Meta infostealer malware-as-a-service operations in Operation Magnus, seizing servers and source code.
The rtl-detect npm package is used to detect if a given language is written in a right-to-left (RTL) script. This can be useful for internationalization and localization purposes, especially when dealing with languages like Arabic, Hebrew, and Persian.
Detect if a language is RTL
This feature allows you to check if a given language code corresponds to a right-to-left language. In this example, 'ar' (Arabic) is checked and returns true.
const rtlDetect = require('rtl-detect');
const isRtl = rtlDetect.isRtlLang('ar');
console.log(isRtl); // true
Get list of RTL languages
This feature provides a list of all language codes that are written in a right-to-left script. This can be useful for dynamically adjusting UI elements based on the user's language.
const rtlDetect = require('rtl-detect');
const rtlLanguages = rtlDetect.getRtlLangs();
console.log(rtlLanguages); // ['ar', 'he', 'fa', ...]
rtlcss is a framework for transforming CSS from left-to-right (LTR) to right-to-left (RTL). While rtl-detect focuses on detecting RTL languages, rtlcss is more about converting CSS styles to support RTL layouts.
bidi-js is a JavaScript library for handling bidirectional text. It provides utilities for detecting and managing text direction, similar to rtl-detect, but with more focus on text processing and manipulation.
i18next is an internationalization framework for JavaScript. It provides extensive support for language detection, including RTL languages, but also offers a wide range of other localization features such as translation and formatting.
This library will help you to detect if the locale is right-to-left language or not.
var rtlDetect = require('rtl-detect');
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
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.
FAQs
Library will help you to detect if the locale is right-to-left language.
The npm package rtl-detect receives a total of 390,856 weekly downloads. As such, rtl-detect popularity was classified as popular.
We found that rtl-detect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Dutch National Police and FBI dismantle Redline and Meta infostealer malware-as-a-service operations in Operation Magnus, seizing servers and source code.
Research
Security News
Socket is tracking a new trend where malicious actors are now exploiting the popularity of LLM research to spread malware through seemingly useful open source packages.
Security News
Research
Noxia, a new dark web bulletproof host, offers dirt cheap servers for Python, Node.js, Go, and Rust, enabling cybercriminals to distribute malware and execute supply chain attacks.