carlosantoniodasilva/i18n_alchemy

It would be nice the NumericParser work with precision

Closed this issue · 5 comments

Today:

@product.price = 1.8
@product.localized.price
#=> "1,8"

The proposal:

@product.price = 1.8
@product.localized.price
#=> "1,80"

Taking the precision of the i18n locale

Hey mate, this sounds good, the only problem I can see is that we'd have to detect whether the value is an Integer or Float, to know if we should format it. I'll take a look, thanks.

I did a workaround as urgent palliative measure

    if value.is_a?(Integer)
      value.to_s
    else # Float, BigDecimal
      ActionController::Base.helpers.number_with_precision(value, :delimiter => '')
    end

To the i18n_alchemy does not fit the use of the views helper from Rails;

The next step is create a new better solution and put to you see;

Ok, nice. I'll find some time to check how to do it internally. Thanks!

Hey mate, please give it a try with the new changes in e2961e4. Thanks.

Nice! Thanks!