Is i18n globalize fallbacks in Rails 5 a noop?

閲覧: 31 回
最初の未読メッセージにスキップ

Maciej Kalisz

未読、
2018/03/22 15:12:152018/03/22
To: Ruby on Rails: Talk
In both apps there is `config.i18n.fallbacks = true` in `application.rb`:

Rails.version # "4.2.4"
Globalize.fallbacks # [:de]
I18n.fallbacks # { :de => [:de] }
Rails.application.config.i18n.fallbacks # nil

And:

Rails.version # "5.0.0.1"
Globalize # NameError: uninitialized constant Globalize
I18n.fallbacks # {}
Rails.application.config.i18n.fallbacks # nil

Unlike in v5.0.0.1, in v4.2.4 there is `gem "globalize"` in Gemfile.
It's been added there with following commit message:

Upgrade to Rails 2.3.8.
In the process, globalize2 is now updated and runs from a gem, not a plug in.

Unfortunately [rails configuration doc for v2.3.8](http://guides.rubyonrails.org/v2.3.8/configuring.html) doesn't say a word on it.
In v5.0.0.1 this gem was never there (checked with `git log -G'globalize' -- Gemfile`).

In v4.2.4 the setting was added explicitely with the following context:

+ # https://github.com/svenfuchs/globalize3
+ config.i18n.fallbacks = true

[Which](https://github.com/globalize/globalize#i18n-fallbacks-for-empty-translations) makes sense as long as you have the globalize gem installed.

In v5.0.0.1 the setting was added by `rails new` on rails 3.1.0.rc1, so unless the gem has been re-implemented into rails, the setting has been a noop from the very beginning. Am I missing something?

In both cases, should I remove the setting from the `application.rb`, I18n throws this:

# I18n.fallbacks # NoMethodError: undefined method `fallbacks' for I18n:Module

I don't call the `fallbacks` anywhere in the apps other than setting it in the config files.

I'd like to find out:

1. Is in v5.0.01 the `fallbacks` a dead setting, so I can safely remove it?
2. Why `Rails.application.config.i18n.fallbacks` returns `nil`, despite being set in the configs?

I searched through docs (incl. changelogs) of Rails, I18n, and Globalize, but didn't find anything interesting.
全員に返信
投稿者に返信
転送
新着メール 0 件