Number to Word

Description:

Provides a field formatter that converts numeric field values into their word representation. Works with integer, decimal, and float fields using the Composer-based kwn/number-to-words library.

Key Features

  • Converts numeric values to words automatically on display
  • Supports integer, decimal, and float fields
  • Multiple language/locales supported (30+)
  • Prefix and suffix text for contextual display
  • Optional thousand separator for English numbers
  • Decimal separator word (e.g., "point", "and")
  • Option to capitalize the first letter of the output
  • Fully compatible with Drupal 11 and PHP 8.4

Use Cases

  • Displaying currency amounts in words (invoices, checks)
  • Accessibility improvements for screen readers
  • Educational content or numeric exercises
  • Legal or formal document generation

Installation

Via Composer (Drupal.org release):

composer require drupal/numbertoword
drush en numbertoword

Manual / Local Development:

  1. Place module in web/modules/custom/numbertoword
  2. Install dependency: composer require kwn/number-to-words
  3. Enable module: drush en numbertoword

Configuration

  1. Navigate to Structure → Content types → [Your Content Type] → Manage Display
  2. Select your numeric field and set numbertoWord as the formatter
  3. Click the gear icon to configure settings:
Setting Description
Prefix Text displayed before the number words
Suffix Text displayed after the number words
Thousand separator Character inserted between word groups (English only)
Decimal separator word Word between integer and decimal part
Language Locale/language for number conversion
Capitalize first letter Capitalize the first character

Click Update then Save

Usage

Once configured, numeric fields will display numbers as words automatically.

Input Settings Output
12345 default twelve thousand three hundred forty-five
12345.67 decimal separator: "point" twelve thousand three hundred forty-five point six seven
1500 Prefix: "USD", Suffix: "only" USD one thousand five hundred only
42 Capitalize first letter: yes Forty-two
1234567 Thousand separator: comma one million, two hundred thirty-four thousand, five hundred sixty-seven

Languages supported: English, Albanian, Arabic, Azerbaijani, Bulgarian, Czech, Danish, Dutch, Estonian, French, German, Georgian, Hungarian, Indonesian, Italian, Latvian, Lithuanian, Malay, Persian, Polish, Portuguese (Brazil), Romanian, Russian, Slovak, Spanish, Swedish, Turkish, Turkmen, Ukrainian, Yoruba

Troubleshooting

  • Formatter doesn’t appear: Ensure module is enabled and cache cleared (drush cr)
  • NumberToWords library not found: Run composer require kwn/number-to-words
  • Decimal numbers incorrect: Check decimal separator word and ensure numeric input
  • Language fallback: If selected language fails, English will be used

Project information

Releases