设置force_available_locales = true后,Rails I18n验证弃用警告 [英] Rails I18n validation deprecation warning, after setting enforce_available_locales = true
本文介绍了设置force_available_locales = true后,Rails I18n验证弃用警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您在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中用问题13164 报告的,并用
The reason is due to a bug with locales that have the language-country format. The good news is that it has been fixed already. This was reported in Github with Issue 13164 and fixed with pull request 229.
如果您想使用此修复程序获取最新的代码,请像这样更新gem:
If you want to grab the latest code with the fix, update the gem like this:
使用以下命令更新您的Gemfile:
Update your Gemfile with:
gem 'i18n', github: 'svenfuchs/i18n'
然后:bundle install
这篇关于设置force_available_locales = true后,Rails I18n验证弃用警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文