On Tue, Dec 25, 2012 at 4:41 AM, Marc Heiler <[email protected]> wrote:
> Anyone knows if standard ruby has this available?
>
> 5.en.numwords # => "five"
> 1.en.numwords # => "one"
>
> This is part of the Linguistics gem, but I wonder why
> standard Ruby does not have this available?

I am guessing that translation and natural language handling are not
considered basic i18n functionality.  That makes a whole lot of sense
if you consider that it is complicated and there are usually a lot
different possible approaches.  Whichever you put into the core or
standard library you will only help part of the Ruby population.
Using a gem for this does not seem to be such a bad alternative.

> To be able to convert "5" to "five" seems useful
> everytime I want to output something to the user.

Well, you could create a poor man's version if you feel the gem is too
heavyweight:

NUMBERS =%w[zero one two three four five six seven eight nine]

puts NUMBERS[5]

;-)

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to