-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ActiveRecord translations support #35
Conversation
That's cool! However, it will be a breaking API change. |
This can be closed, since |
Where are we on this ? I encounter this very problem. How can we get this fixed ? I am wiling to help if needed. |
The validator passed to AM::Error does not use the `i18n_scope` we define on either Reform::Form or the model, but is delegated from the included AM::Translations module. This in turn causes I18n to lookup the scope `:activemodel`, failing the localization. trailblazer/reform-rails#56 trailblazer/reform-rails#35
This still occurs even if your model or form defines Since we depend upon for accessing AR keys, opening the validator class to enforce the scope works - while not pretty - as expected: Reform::Form::ActiveModel::Validations::Validator.class_eval do
##
# use activerecord as the base scope instead of 'activemodel' to be compatible
# to the messages we have already stored
def self.i18n_scope
:activerecord
end
end What is needed to move this PR forward? |
The main problem is that this fix will break a lot of code since we "force" the correct i18n key. There should be a soft deprecation so we can undo this. |
Maybe an explicit |
The validator passed to AM::Error does not use the `i18n_scope` we define on either Reform::Form or the model, but is delegated from the included AM::Translations module. This in turn causes I18n to lookup the scope `:activemodel`, failing the localization. trailblazer/reform-rails#56 trailblazer/reform-rails#35 [ci skip]
Really old PR which I'll close for now @hrom512, if you still using |
Fix problem with translations for ActiveRecord attributes. For example: