Justin
Justin

Reputation: 1

Variable Internationalization(I18n) looks ups

I have a before_save validation in my model

:before_save, :check_confirmations def check_confirmations self.confirmations[:providers] = I18n.t('enough') end

However, the validation message that I want to show is dependent upon data that is inside of the view and controller, and this data is inaccessible inside/to the model.

Is there anyway inside of the controller I can specify which version of the internationalization to use?

Upvotes: 0

Views: 30

Answers (1)

user3490997
user3490997

Reputation: 58

Not sure what exactly you mean by version. We can set locale on controller

I18n.locale = params[:locale]

Typically this set in application controller but can be overridden as well. You can look here for more details. http://guides.rubyonrails.org/i18n.html

Upvotes: 1

Related Questions