Skip to content

Translate number to words (Working for english and spanish)

Notifications You must be signed in to change notification settings

gedera/humanize_numbers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Humanize Number

Rails gem to describe a number in words for English, Spanish and Portugues. For use english, spanish and portugues simply define:

I18n.locale = :en (English)
I18n.locale = :es (Espanish)
I18n.locale = :pt (Portugues)

Ideal to be used to print in receipts.

Install

Add the following line in to your Gemfile:

gem 'humanize_numbers', :git => 'git://github.com/gedera/humanize_numbers.git'

And from the command line run:

bundle install

Usage

Examples for return numbers in english, spanish and portugues:

9736.humanize
=> "nine thousand seven hundred thirty six" (English)
=> "nueve mil setecientos treinta y seis" (Spanish)
=> "nove mil setecentos e trinta e seis" (Portugues)

9736.45.humanize
=> "nine thousand seven hundred thirty six with 45/100" (English)
=> "nueve mil setecientos treinta y seis con 45/100" (Spanish)
=> "nove mil setecentos e trinta e seis com 45/100" (Portugues)

Enjoy!!!

About

Translate number to words (Working for english and spanish)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%