Skip to content

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-words

Basic 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 codeCountryCurrencyNotes
ms-MYMalaysiaRinggit / SenStandard Malaysian Malay wording
ms-SGSingaporeDolar / SenSingapore Malay with SGD currency

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.

Released under the MIT License.