Malay Number to Words in JavaScript (ms-MY, ms-SG) โ
Use ms-MY or ms-SG when your application needs Malay number words for Malaysian or Singaporean invoicing, checkout flows, or legal documents.
Locale codes:
ms-MY,ms-SGยท Numbering system: Short scale ยท Currency: Ringgit / Sen (ms-MY), Dolar / Sen (ms-SG) ยท Script: Latin
Install โ
bash
npm install to-wordsBasic Conversion โ
js
import { ToWords } from 'to-words';
const tw = new ToWords({ localeCode: 'ms-MY' });
tw.convert(100);
tw.convert(1000);
tw.convert(1000000);Currency - Ringgit / Sen โ
js
tw.convert(1234.56, { currency: true });
tw.convert('500.00', { currency: true, includeZeroFractional: true });Singapore (ms-SG) โ
js
const twSG = new ToWords({ localeCode: 'ms-SG' });
twSG.convert(1234.56, { currency: true });
// Uses Singapore Dollar (S$)Ordinal Numbers โ
js
tw.toOrdinal(1);
tw.toOrdinal(10);
tw.toOrdinal(100);Locale Codes โ
| Locale code | Country | Currency | Notes |
|---|---|---|---|
ms-MY | Malaysia | Ringgit / Sen | Standard Malaysian Malay wording |
ms-SG | Singapore | Dolar / Sen | Singapore Malay with SGD currency |
Related โ
FAQ โ
Q: Which locale code should I use for Malaysian Malay number-to-words output? Use ms-MY for Malaysia. Use ms-SG for Singapore.
Q: Does to-words support Malay ordinal words? Yes. Both ms-MY and ms-SG include ordinal mappings.