Posted by acushla on November 17, 2010 at 9:21pm
Hi,
I have written a module that adds a cck number field formatter that shows the number in words.
Ex. 123456 is shown as One Hundred and Twenty-Three Thousand Four Hundred and Fifty-Six.
Do you think it will be a good idea to contribute this module?
Thanks in advance,
Rajat
Comments
Old code I made
Here's an old issue I made in regards to this
http://drupal.org/node/331700#comment-1179255
Got the core logic from here
http://www.roscripts.com/snippets/show/53
I would say contribute it but look into including other formatters as well
I'd find it useful. But it
I'd find it useful.
But it should be possible to display both, the number and the number in words. Like:
Thanks so much
Thanks so much Mike and no2e. :-)
Looking forward to contribute the module with configuration option to include no2e's suggestion.
One Hundred and Twenty-Three
English major alert! Technically speaking, both of the "and"s in this are incorrect. "And" should only be used to separate the fraction part of the number (if any) from the whole number. So both of these would be correct:
One hundred twenty-three thousand four hundred fifty-six
One hundred twenty-three thousand four hundred fifty-six and seven eighths
But either way, though a module like this could be nifty, I think it would only really be practical on smaller numbers than this. "123,456" is much easier to read than "One hundred twenty-three thousand four hundred fifty-six."
The Boise Drupal Guy!
US English or UK English?
The "and"s are correct, and expected, in UK English, as opposed to American English :)
We would say "One hundred and twenty-three thousand, four hundred and fifty-six" here. We think that the American way of omitting the "and"s sounds very odd ;)
We'd probably say "One hundred and twenty-three thousand, four hundred and fifty-six, and seven eighths" too, although this sort of number is very unlikely to appear in real life.
Huh. I did not learn that as
Huh. I did not learn that as a difference of American English, but it appears you're correct. What do you know.
The Boise Drupal Guy!
Utilize what is there.
Just a side note. IMO, this should just be a formatter for the existing number field that comes with CCK. (assuming it already not)
--
zzolo
Just what I am looking for
This is what I am looking for, I agree with zzolo, this should be added to the CCK number field as a display format.
Just my $0.02
-Chris
shows the number in words.
Acushla, As I can access the module you developed? I would like to try.
the solution
I need to show the price, provided by drupal commerce, in separate field or block, converted into words. How can I do it?
Anybody interested may
Anybody interested may checkout this one.
https://www.drupal.org/project/number2word
here is another d8/d9 release
here is another d8/d9 release for the Number as Words
https://www.drupal.org/project/twig_n2w