i18n_alchemy
i18n_alchemy copied to clipboard
Issue with parser with the letters "e" and "d"
Hi, I have tried using the parser on a lot of data and have found a issue with a very specific case of the parser.
description of issue
When using the localized method with french locale if the decimal is followed by the letters "e" or "d" (with or without spaces) the localization method produces 0, most other non-numeric I have tried work.
- ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]
- rails 5.1.5
- i18n_alchemy (0.2.4)
steps to reproduce
see code below
irb(main):105:0> I18n.with_locale(:fr) { quote.localized({quantity1_price_en: "0,29"}) }.quantity1_price_en
=> "0.290"
irb(main):106:0> I18n.with_locale(:fr) { quote.localized({quantity1_price_en: "0,28889"}) }.quantity1_price_en
=> "0.289"
irb(main):107:0> I18n.with_locale(:fr) { quote.localized({quantity1_price_en: "0,28889 per unit"}) }.quantity1_price_en
=> "0.289"
irb(main):108:0> I18n.with_locale(:fr) { quote.localized({quantity1_price_en: "0,28889 euros per unit"}) }.quantity1_price_en
=> "0.000"
irb(main):109:0> I18n.with_locale(:fr) { quote.localized({quantity1_price_en: "0,28889 dollars per unit"}) }.quantity1_price_en
=> "0.000"
Parsing the strings "0,29", "0,29 per unit", "0,29 oioioioio" all produce "0,29" which is fine The string "0,28889 euros per unit" produce "0.000" which is unexpected
what is expected I'd expect
I would expect parsing the string "0,28889 euros per unit" produce "0.28889"
ps: there is also a rounding issue but we should perhaps leave this out of this issue
@carlosantoniodasilva can be closed with #48 being merged.