We needed to translate integers from 0 to 100 into words for our system, and looked at a few gems, and thought about the logic, and then said "f*ck it" and just created a YAML file:
0: zero
1: one
2: two
...
Problem solved, and testing was pretty straightforward too!
I love it. Sometimes, if you have a limit like that, writing it out manually can be easier on a quick deadline! Especially if you need to support many languages.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
English is just an instance of a language.
Languages have different ways of doing this.
For instance, there's no seventy in French. The seventies are written as sixty and thirteen.
Then you realize that's why libraries exist and find one that suits your needs.
Yes. But this is just an exercise for fun?
And a damn good exercise it is too.
We needed to translate integers from 0 to 100 into words for our system, and looked at a few gems, and thought about the logic, and then said "f*ck it" and just created a YAML file:
Problem solved, and testing was pretty straightforward too!
I love it. Sometimes, if you have a limit like that, writing it out manually can be easier on a quick deadline! Especially if you need to support many languages.