
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
amount-to-words-multilang
Advanced tools
Convert numbers to words in multiple languages (EN, TH, FR, JA, DE, ET, ES, FA, ZH)
A TypeScript library for converting numeric amounts to words in multiple languages (English, Thai, French, Japanese, German, Estonian, Spanish, Persian, Chinese). Perfect for financial applications, invoice generation, and internationalization.
npm install amount-to-words-multilang
import { amountToWords } from 'amount-to-words-multilang';
// English (default)
console.log(amountToWords(1234.56));
// "one thousand two hundred thirty-four dollars and fifty-six cents"
// Thai
console.log(amountToWords(1234.56, 'th'));
// "หนึ่งพันสองร้อยสามสิบสี่บาทห้าสิบหกสตางค์"
// French
console.log(amountToWords(1234.56, 'fr'));
// "mille deux cent trente-quatre euros et cinquante-six centimes"
// Japanese (hiragana output)
console.log(amountToWords(1234.56, 'ja'));
// "せんにひゃくさんじゅうよんえんごじゅうろくせん"
// German
console.log(amountToWords(1234.56, 'de'));
// "eintausend zweihundertvierunddreißig Euro und sechsundfünfzig Cent"
// Estonian
console.log(amountToWords(1234.56, 'et'));
// "tuhat kakssada kolmkümmend neli eurot ja viiskümmend kuus senti"
// Spanish
console.log(amountToWords(1234.56, 'es'));
// "mil doscientos treinta y cuatro euros y cincuenta y seis céntimos"
// Persian
console.log(amountToWords(1234.56, 'fa'));
// "یک هزار و دویست و سی و چهار یورو و پنجاه و شش سنت"
// Chinese
console.log(amountToWords(1234.56, 'zh'));
// "一千二百三十四元五十六分"
| Locale | Language | Currency | Fractional Unit |
|---|---|---|---|
en | English | Dollar | Cents |
th | Thai | Baht | Satang |
fr | French | Euro | Centimes |
ja | Japanese | Yen | Sen |
de | German | Euro | Cent |
et | Estonian | Euro | Senti |
es | Spanish | Euro | Céntimos |
fa | Persian | Euro | Cent |
zh | Chinese | Yuan | Fen |
amountToWords(amount, locale?)Converts a numeric amount to words in the specified language.
Parameters:
amount (number): The numeric amount to convert (must be non-negative and finite)locale (string, optional): The target locale ('en', 'th', 'fr', 'ja', 'de', 'et', 'es', 'fa', 'zh'). Defaults to 'en'Returns:
string: The amount converted to wordsThrows:
Error: For invalid inputs (negative numbers, infinity, NaN, unsupported locales)You can also import and use converters directly:
import {
enConverter,
thConverter,
frConverter,
jaConverter,
deConverter,
etConverter,
esConverter,
faConverter,
zhConverter
} from 'amount-to-words-multilang';
console.log(enConverter.convert(100.50));
console.log(thConverter.convert(100.50));
console.log(frConverter.convert(100.50));
console.log(jaConverter.convert(100.50));
console.log(deConverter.convert(100.50));
console.log(etConverter.convert(100.50));
console.log(esConverter.convert(100.50));
console.log(faConverter.convert(100.50));
console.log(zhConverter.convert(100.50));
This library supports flexible currency handling beyond default locale units. Use ConversionOptions to control currency, minor digits, and unit words.
import { amountToWords } from 'amount-to-words-multilang';
// English with Thai Baht
amountToWords(123.45, { locale: 'en', currency: 'THB' });
// "one hundred twenty-three baht and forty-five satang"
// Thai with Baht (shows "ถ้วน" when no satang)
amountToWords(123, { locale: 'th', currency: 'THB' });
// "หนึ่งร้อยยี่สิบสามบาทถ้วน"
// English with Japanese Yen (JPY has 0 minor digits)
amountToWords(123.45, { locale: 'en', currency: 'JPY' });
// "one hundred twenty-three yen"
// Japanese with JPY (hiragana output)
amountToWords(123.45, { locale: 'ja', currency: 'JPY' });
// "ひゃくにじゅうさんえん"
// Override units explicitly (any locale)
amountToWords(10.5, {
locale: 'en',
unitsOverride: {
majorSingular: 'credit',
majorPlural: 'credits',
minorSingular: 'point',
minorPlural: 'points',
},
});
// "ten credits and fifty points"
type ConversionOptions = {
locale?: 'en' | 'th' | 'fr' | 'ja' | 'de' | 'et' | 'es' | 'fa' | 'zh';
currency?: 'USD' | 'EUR' | 'THB' | 'JPY' | 'GBP' | 'CNY';
minorDigits?: number; // overrides currency defaults (e.g. JPY: 0)
unitsOverride?: {
majorSingular: string;
majorPlural: string;
minorSingular: string;
minorPlural: string;
};
// Thai-specific
showMinorIfZero?: boolean; // default true, adds "ถ้วน" when no satang
}
Default currency minor digits (ISO 4217 common defaults):
Unit words are resolved per-locale and per-currency, and can be overridden via unitsOverride.
import { amountToWords } from 'amount-to-words-multilang';
// Zero amounts
amountToWords(0, 'en'); // "zero dollars"
amountToWords(0, 'th'); // "ศูนย์บาท"
// Whole numbers
amountToWords(1, 'en'); // "one dollar"
amountToWords(100, 'fr'); // "cent euros"
// Decimals
amountToWords(1.50, 'en'); // "one dollar and fifty cents"
amountToWords(42.99, 'de'); // "zweiundvierzig Euro und neunundneunzig Cent"
amountToWords(99.01, 'et'); // "üheksakümmend üheksa eurot ja üks sent"
amountToWords(75.25, 'es'); // "setenta y cinco euros y veinticinco céntimos"
amountToWords(33.67, 'fa'); // "سی و سه یورو و شصت و هفت سنت"
amountToWords(88.99, 'zh'); // "八十八元九十九分"
// Large numbers
amountToWords(1000000, 'en'); // "one million dollars"
amountToWords(12345678, 'ja'); // "千二百三十四万五千六百七十八円"
amountToWords(987654321, 'zh'); // "九億八千七百六十五万四千三百二十一元"
// Precision handling
amountToWords(0.1 + 0.2, 'en'); // Handles floating-point precision correctly
try {
amountToWords(-100); // Throws: "Amount must be non-negative"
amountToWords(Infinity); // Throws: "Amount must be finite"
amountToWords(100, 'invalid'); // Throws: "Unsupported locale"
} catch (error) {
console.error(error.message);
}
npm run build
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage report
npm run test:verbose # Run tests with verbose output
src/
├── index.ts # Main entry point
├── types.ts # Type definitions
└── locales/
├── en.ts # English converter
├── th.ts # Thai converter
├── fr.ts # French converter
├── ja.ts # Japanese converter
├── de.ts # German converter
├── et.ts # Estonian converter
├── es.ts # Spanish converter
├── fa.ts # Persian converter
└── zh.ts # Chinese converter
tests/
├── main.test.ts # Integration tests
├── en.test.ts # English converter tests
├── th.test.ts # Thai converter tests
├── fr.test.ts # French converter tests
├── ja.test.ts # Japanese converter tests
├── de.test.ts # German converter tests
├── et.test.ts # Estonian converter tests
├── es.test.ts # Spanish converter tests
├── fa.test.ts # Persian converter tests
└── zh.test.ts # Chinese converter tests
Contributions are welcome! Please feel free to submit issues or pull requests.
To add support for a new language:
src/locales/[locale].tsNumberToWordsConverter interfaceSupportedLocale type in src/types.tssrc/index.tstests/[locale].test.tsMIT License - see LICENSE file for details.
currency, minorDigits, unitsOverridesrc/currencies.ts with ISO minor digitsFAQs
Convert numbers to words in multiple languages (EN, TH, FR, JA, DE, ET, ES, FA, ZH)
We found that amount-to-words-multilang demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.