加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

本地化 – Rails I18n验证不建议警告,设置enforce_available_loc

发布时间:2020-12-16 22:23:57 所属栏目:百科 来源:网络整理
导读:你在config / application.rb中放置了这样的东西 I18n.enforce_available_locales = true config.i18n.load_path += Dir[Rails.root.join('config/locales/','*.{rb,yml}').to_s]config.i18n.available_locales = ['es-LA',:en] config.i18n.default_locale
你在config / application.rb中放置了这样的东西
I18n.enforce_available_locales = true                                        
config.i18n.load_path += Dir[Rails.root.join('config/locales/','*.{rb,yml}').to_s]
config.i18n.available_locales = ['es-LA',:en]                               
config.i18n.default_locale = 'es-LA'

并且警告仍然出现:

[deprecated] I18n.enforce_available_locales will default to true in the future.

解决方法

原因是由于语言国家/地区格式的错误.好消息是它已经被修复了.这在Github中报道了 Issue 13164,固定在 pull request 229.

如果要使用修复程序获取最新的代码,请更新gem,如下所示:

更新您的Gemfile与:

gem 'i18n',github: 'svenfuchs/i18n'

然后:捆绑安装

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读