kslazarev / numbers_and_words

Convert numbers to words using I18N.
MIT License
304 stars 115 forks source link

Improve Italian support #94

Open aldesantis opened 10 years ago

aldesantis commented 10 years ago

numbers_and_words currently has poor support for Italian. I have the code needed to convert a number into Italian, but I'm not able to integrate it in your gem.

If I provide the code, can someone with a better understanding of numbers_and_words use it to improve the present implementation?

Thanks in advance.

aldesantis commented 10 years ago

@kslazarev: any info about this? Do you think you'd be able to do it?

dblock commented 10 years ago

@alessandro1997 I am not sure what you're asking for. Make code changes and pull requests, please.

aldesantis commented 10 years ago

Never mind. First of all, how would I go about removing the spaces between translations? 170 in Italian is "centosettanta", not "cento settanta". Spaces are added after millions and billions (e.g. 1,740,794 is "un milione settecentoquarantamilasettecentonovantaquattro").

Also, 1,000 is "mille", not "uno mille".

If you could point me in the right direction I'd be glad to make the needed changes.

eLod commented 10 years ago

@alessandro1997 you could do this on a couple 'level'

the most basic is you provide some kind of failing tests, for example you could edit the https://github.com/kslazarev/numbers_and_words/blob/development/spec/numbers_and_words/integer/fixture_examples/it.yml (please note: you should work off of the development branch) so it would be clear what the problems are, however without further instructions (and without knowledge about the italian language) i'm not sure anyone could take on them

you could also provide some instructions like you did. for example for the problem with where to put spaces you could check https://github.com/kslazarev/numbers_and_words/blob/development/lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb (see also https://github.com/kslazarev/numbers_and_words/blob/development/lib/numbers_and_words/strategies/figures_converter/languages/base.rb how it is used), in a nutshell (when you call I18n.with_locale(:it) { 1740794.to_words }) what is happening is:

you can check how modifications are made to this process on every level, e.g.:

depending on the rules of the italian language i would change https://github.com/kslazarev/numbers_and_words/blob/development/lib/numbers_and_words/strategies/figures_converter/languages/it.rb to alter strings_logic and/or hundreds_number_to_words

davidebaldini commented 8 years ago

@eLod, if you need feedback, I'm Italian; any example reported by alessandro1997 is correct.

eLod commented 8 years ago

@davidebaldini i'm not working on this, i was just trying to help @alessandro1997