我有一个多国 Rails 应用程序。我需要为每个请求设置 i18n 后备模式。是否有可能以及如何实现这一目标?
UPD
class Country < ApplicationRecord
# String attribute "languages" (array)
end
class CountriesController < ApplicationController
def show
@country = Country.find params[:id]
I18n.fallbacks = {
@country.languages.first => @country.languages.second
} # This does not work
render 'show'
end
end