Chinese Number to Words JavaScript
3 Chinese locales — Simplified, Traditional, and Cantonese.
| Locale | Variant | Script |
|---|---|---|
zh-CN | Simplified Chinese | 简体 |
zh-TW | Traditional Chinese | 繁體 |
yue-HK | Cantonese (Hong Kong) | 繁體 |
Install
bash
npm install to-wordsBasic Conversion
js
import { ToWords } from 'to-words';
const tw = new ToWords({ localeCode: 'zh-CN' });
tw.convert(12345); // "一万二千三百四十五"Formal Characters (大写 / Anti-fraud)
js
tw.convert(12345, { formal: true }); // "壹万贰仟叁佰肆拾伍"FAQ
Q: What is the formal option for Chinese?
A: Formal characters (大写, dàxiě) are used in banking, invoicing, and legal documents to prevent fraud. Pass { formal: true }.
Q: Is Cantonese (yue-HK) different from Mandarin zh-TW?
A: They share script but use different numerals/vocabulary in some cases.