Skip to content

Convert numerical numbers to written numbers, in 25+ languages.

License

Notifications You must be signed in to change notification settings

ASutrick/n2words

 
 

Repository files navigation

@asutrick/n2words

Original project by forzagreen n2words converts numerical numbers into written ones, supports 27 languages, and has zero dependencies.

This Fork

This fork changes the English written number functionality. Significant words are capitalized and 'and' is removed.

Example

n2words(123)   // 'One Hundred Twenty-Three'
n2words(-1.5)  // 'minus One point Five'

n2words(123, {lang: 'fr'})  // 'cent vingt-trois'
n2words(123, {lang: 'es'})  // 'ciento veintitrés'
n2words(123, {lang: 'ar'})  // 'مائة و ثلاثة و عشرون'

See the Wiki for examples and advanced usage like importing only specific languages.

Install

npm install @asutrick/n2words

Usage

ESM

import n2words from '@asutrick/n2words'

CommonJS (dynamic import)

import('n2words').then(({default: n2words}) => {
    n2words(100)
})

Browser

<script src="./n2words.js"></script>
<script>
    n2words(100)
</script>

n2words is also available on jsDelivr.

Supported Languages

  • en (English, default)
  • ar (Arabic)
  • az (Azerbaijani)
  • cz (Czech)
  • dk (Danish)
  • de (German)
  • es (Spanish)
  • fr (French)
  • fa (Farsi)
  • he (Hebrew)
  • hr (Croatian)
  • hu (Hungarian)
  • id (Indonesian)
  • it (Italian)
  • ko (Korean)
  • lt (Lithuanian)
  • lv (Latvian)
  • nl (Dutch)
  • no (Norwegian)
  • pl (Polish)
  • pt (Portuguese)
  • ru (Russian)
  • sr (Serbian)
  • tr (Turkish)
  • uk (Ukrainian)
  • vi (Vietnamese)
  • zh (Chinese)

Contributing

This is a personal fork. Any issues/requests will not be acknowledged. The original repository is actively updated, so try there.

License

MIT

About

Convert numerical numbers to written numbers, in 25+ languages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.8%
  • HTML 0.2%