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

Crashing French translations #107

Closed
Startouf opened this issue Jan 8, 2015 · 7 comments
Closed

Crashing French translations #107

Startouf opened this issue Jan 8, 2015 · 7 comments

Comments

@Startouf
Copy link

Startouf commented Jan 8, 2015

I try to translate some figures into French, but I run into a

uninitialized constant NumbersAndWords::Strategies::FiguresConverter::Decorators::Fr error

Is there an option somewhere to switch back to english translations if a problem like this appears ?

@dblock
Copy link
Collaborator

dblock commented Jan 9, 2015

It looks like this is a legit bug. It would be great if you could build a repro spec for this? Thanks.

@Startouf
Copy link
Author

It's only about float numbers conversion, and apparently :en language fails too. This might be related to my gems, but I have different error for :en I18n::InvalidPluralizationData: translation data {:one=>"hundredth", :other=>"hundredths"} can not be used with :count => 42
error for :en language

Below is a test for :fr translations only, but maybe you could do something like [:fr, :de, :en, :....].each do to test all languages (in case the bug only appears for some specific untranslated language). I have never written tests so far, so I hope this is good.

test "it should translate integer and float numbers or fallback to a known language traslation" do
  assert_block("It works with integers") do # Note this one already passes (for :fr at least)
    # Ideally add a loop here to test for all languages of the I18n
    I18n.with_locale(:fr) do
      assert_block("Integer translation for :fr") do
        42.to_words == "quarante-deux" or 42.to_words == "forty-two" # Replace by default translation
      end
    end
  end
  assert_block("It works with floats") do # This is the one that doesn't
    # Ideally add a loop here to test for all languages of the I18n
    I18n.with_locale(:fr) do
      assert_block("Float translation for :fr") do
        (42.42).to_words == "quarante-deux virgule quarante-deux" or (42.42).to_words == "forty-two coma forty-two" # Replace by default translation
      end
    end
  end
end

@sebfie
Copy link

sebfie commented Aug 4, 2015

Any solution for that?

@bsylvain
Copy link

I have the same problem, is there any solution?

@Startouf
Copy link
Author

I had fixed the problem on my fork of the repo. It was quite a long time ago, and I'm not even sure it's still compatible with the current master.
But you might want to try [https://github.com/Startouf/numbers_and_words] to see if it fixes your problem

@dblock
Copy link
Collaborator

dblock commented Jun 25, 2016

There's a PR in #111, but it needs tests. Someone wants to finish it up?

@jlduran
Copy link
Collaborator

jlduran commented Jul 7, 2017

Closed in #144

@jlduran jlduran closed this as completed Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants