Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with parser with the letters "e" and "d" #47

Open
RaphaelAudet opened this issue Sep 11, 2018 · 1 comment
Open

Issue with parser with the letters "e" and "d" #47

RaphaelAudet opened this issue Sep 11, 2018 · 1 comment

Comments

@RaphaelAudet
Copy link

RaphaelAudet commented Sep 11, 2018

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

@sobrinho
Copy link
Contributor

@carlosantoniodasilva can be closed with #48 being merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants