Convert numbers to Arabic words with gender awareness support.
npm install arabic-ntl
import { ntl, ArabicNTL } from 'arabic-ntl';
// Using singleton instance
const result = ntl.number(123).counted("كتاب").toWords();
// Output: "مئة و ثلاثة و عشرون كتاب"
// Using static method
const result2 = ArabicNTL.convert(456, "طالبة");
// Output: "أربع مئة و ستة و خمسون طالبة"
const { ntl, ArabicNTL } = require('arabic-ntl');
// Convert without counted item
const result = ntl.number(789).toWords();
// Output: "سبع مئة و تسعة و ثمانون"
<script src="node_modules/arabic-ntl/index.js"></script>
<script>
const result = ntl.number(1000).counted("دينار").toWords();
// Output: "ألف دينار"
</script>
ntl.number(num).counted(item).toWords()
-
number(num)
: Set the number to convert -
counted(item)
: Set the counted item (المعدود) - optional -
toWords()
: Convert to Arabic words
ArabicNTL.convert(num, counted)
-
num
: The number to convert -
counted
: The counted item (optional)
const converter = new ArabicNTL();
converter.number(2500).toWords();
// Output: "ألفان و خمس مئة"
- ✅ Gender awareness (masculine/feminine)
- ✅ Support for numbers up to trillions
- ✅ Proper Arabic grammar rules
- ✅ Zero configuration
- ✅ Lightweight
- ✅ No dependencies
// Masculine
ArabicNTL.convert(3, "كتاب") // "ثلاثة كتاب"
ArabicNTL.convert(13, "قلم") // "ثلاثة عشر قلم"
ArabicNTL.convert(2000, "ريال") // "ألفان ريال"
// Feminine
ArabicNTL.convert(3, "طالبة") // "ثلاث طالبة"
ArabicNTL.convert(13, "ورقة") // "ثلاث عشرة ورقة"
ArabicNTL.convert(2000, "ليرة") // "ألفان ليرة"
// Without counted item
ArabicNTL.convert(0) // "صفر"
ArabicNTL.convert(100) // "مئة"
ArabicNTL.convert(1000000) // "مليون"
MIT