Skip to content

Add i18n#311

Merged
seejohnrun merged 9 commits into
ice-cube-ruby:masterfrom
gocardless:null-i18n-seejohnrun
Dec 7, 2015
Merged

Add i18n#311
seejohnrun merged 9 commits into
ice-cube-ruby:masterfrom
gocardless:null-i18n-seejohnrun

Conversation

@greysteil
Copy link
Copy Markdown

An amalgamation of:

Specs should pass and this should be 👌 to go...

seejohnrun added a commit that referenced this pull request Dec 7, 2015
@seejohnrun seejohnrun merged commit d311f13 into ice-cube-ruby:master Dec 7, 2015
@seejohnrun
Copy link
Copy Markdown
Collaborator

👍

Released as version 0.13.1
Thanks everyone!

@martinstreicher
Copy link
Copy Markdown

Is there something required to use 0.13.1? I am getting ...

 expected: "Yearly"
            got: "translation missing: en.ice_cube.each_year"

In some of my own tests.

@martinstreicher
Copy link
Copy Markdown

This is another instance:

  expected: "Every 2 years"
            got: "translation missing: en.ice_cube.each_year"

@martinstreicher
Copy link
Copy Markdown

And one other issue that appears a lot in my specs...

     TypeError:
       no implicit conversion of Symbol into Integer
     # /Users/mss67/.rvm/gems/ruby-2.2.3@emerald/gems/ice_cube-0.13.1/lib/ice_cube/builders/string_builder.rb:24:in `[]'
     # /Users/mss67/.rvm/gems/ruby-2.2.3@emerald/gems/ice_cube-0.13.1/lib/ice_cube/builders/string_builder.rb:24:in `block in to_s'
     # /Users/mss67/.rvm/gems/ruby-2.2.3@emerald/gems/ice_cube-0.13.1/lib/ice_cube/builders/string_builder.rb:17:in `each'
     # /Users/mss67/.rvm/gems/ruby-2.2.3@emerald/gems/ice_cube-0.13.1/lib/ice_cube/builders/string_builder.rb:17:in `to_s'
     # /Users/mss67/.rvm/gems/ruby-2.2.3@emerald/gems/ice_cube-0.13.1/lib/ice_cube/validated_rule.rb:78:in `to_s'
     # /Users/mss67/.rvm/gems/ruby-2.2.3@emerald/gems/ice_cube-0.13.1/lib/ice_cube/schedule.rb:317:in `block in to_s'
     # /Users/mss67/.rvm/gems/ruby-2.2.3@emerald/gems/ice_cube-0.13.1/lib/ice_cube/schedule.rb:317:in `map'
     # /Users/mss67/.rvm/gems/ruby-2.2.3@emerald/gems/ice_cube-0.13.1/lib/ice_cube/schedule.rb:317:in `to_s'

@martinstreicher
Copy link
Copy Markdown

Digging in a little on the latter to see if I can relay more info.

@martinstreicher
Copy link
Copy Markdown

On line 24...

(byebug) ap IceCube::I18n.t('ice_cube.string.format')
"translation missing: en.ice_cube.string.format"

So I18n is not returning a hash and then the [type] dereference blows up. Am I missing a file?

@seejohnrun
Copy link
Copy Markdown
Collaborator

@martinstreicher odd - I'm able to do the following and get 'every 2 years'

require 'ice_cube'

schedule = IceCube::Schedule.new Time.now
schedule.rrule IceCube::Rule.yearly(2)
puts schedule.to_s

any more detail you can provide? cc / @greysteil

@martinstreicher
Copy link
Copy Markdown

Odd. I get this when running that small snippet. What version of i18n do you have? I am using Ruby 2.2.3.

/Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/i18n-0.7.0/lib/i18n.rb:284:in `enforce_available_locales!': :en is not a valid locale (I18n::InvalidLocale)
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/i18n-0.7.0/lib/i18n.rb:151:in `translate'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/i18n.rb:4:in `t'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/validations/yearly_interval.rb:35:in `build_s'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/validated_rule.rb:75:in `block (2 levels) in to_s'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/validated_rule.rb:74:in `each'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/validated_rule.rb:74:in `block in to_s'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/validated_rule.rb:73:in `each'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/validated_rule.rb:73:in `to_s'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/schedule.rb:317:in `block in to_s'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/schedule.rb:317:in `map'
    from /Users/strike/.rvm/gems/ruby-2.2.3@duke_prompt/gems/ice_cube-0.13.1/lib/ice_cube/schedule.rb:317:in `to_s'
    from eh.rb:5:in `<main>'

@seejohnrun
Copy link
Copy Markdown
Collaborator

This is 0.7.0 as well :/

Here's my Gemfile.lock for reference:

PATH
  remote: .
  specs:
    ice_cube (0.13.1)

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (4.2.5)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    diff-lcs (1.1.3)
    i18n (0.7.0)
    json (1.8.3)
    minitest (5.8.3)
    rake (10.4.2)
    rspec (2.12.0)
      rspec-core (~> 2.12.0)
      rspec-expectations (~> 2.12.0)
      rspec-mocks (~> 2.12.0)
    rspec-core (2.12.2)
    rspec-expectations (2.12.1)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.12.2)
    thread_safe (0.3.5)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)

PLATFORMS
  ruby

DEPENDENCIES
  activesupport (>= 3.0.0)
  i18n
  ice_cube!
  rake
  rspec (~> 2.12.0)
  tzinfo

@martinstreicher
Copy link
Copy Markdown

That's a pretty simple list. I have tons of other things in mine, including Rails. Let me do some digging. This was not an issue with 0.13.0, but I think from the commits for 0.13.1 that i18n was added for that release.

@seejohnrun
Copy link
Copy Markdown
Collaborator

That's correct
This PR's diff is basically the new changes

@martinstreicher
Copy link
Copy Markdown

Stupid question: If I look at the 0.13.1 gem installed locally after running bundle install, I do not see a config directory. Should I be installing from the master branch?

@martinstreicher
Copy link
Copy Markdown

If I pull down the tar file for the release, the subdir config is there.

@seejohnrun
Copy link
Copy Markdown
Collaborator

Ahh :) I think this may be it - the config path should be added to the gemspec
Can you try installing 0.13.2 (just released)

@martinstreicher
Copy link
Copy Markdown

0.13.2 fixes the issue. The config directory is there and the gem works.

@seejohnrun
Copy link
Copy Markdown
Collaborator

Great sorry for the inconvenience @martinstreicher and thanks for the great report

@dgilperez
Copy link
Copy Markdown
Contributor

👏 🎉 😄

Thanks @seejohnrun for merging.

@seejohnrun
Copy link
Copy Markdown
Collaborator

thank you @dgilperez :)

@martinstreicher
Copy link
Copy Markdown

@seejohnrun No problem. Thanks to rspec and a very large suite for my IceCube coding. (Now I just need to figure out why 8 of my tests always break when run on a machine set in the UTC time zone!)

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

Successfully merging this pull request may close these issues.

5 participants