Open renchap opened 3 years ago
I tried to recreate this problem on https://github.com/tansengming/stripe-rails-dummy/tree/issue-206-test
it has
I also added config.i18n.available_locales = %i[en fr]
to application.rb
just to be sure. But I can't seem to recreate the error. Can you think of anything else I'm missing?
Sorry for the long delay.
I managed to reproduce it: it depends on the location of the stripe-rails
gem in your Gemfile
!
For me it was near the end and the error occurred, but if I move it at the top of my Gemfile
is works fine.
I added some debugging to I18n and with stripe-rails
loaded first, I can see that it is called once with the default config (empty) and then with my own config:
In i18n.rb
line 336:
pp locale
pp I18n.config.available_locales_set
pp I18n.config.available_locales
$ rails c
:en
#<Set: {"en", :en}>
[:en]
:en
#<Set: {"en", :en}>
["en", "fr"]
With the gem loaded later, available_locales
is empty:
:en
#<Set: {}>
[]
I guess stripe-i18n
should only load locale-dependent code once the app has been initialized by Rails, not when the gem is loaded, so it is no-longer order dependent and will use the correct I18n config.
After upgrading to
stripe-rails
2.2.0 (or 2.2.1), I am getting this error when runningrails c
orrails s
I am not sure what is happening here as my locales are defined as
config.i18n.available_locales = %i[en fr]