0
votes

I am trying to use I18n with activescaffold, which is working fine in terms of translating errors for models.

But I would like to translate these:

  • "1 error prohibited this {model} from being saved"
  • "There were problems with the following fields:"

My yml file looks like

sk:
 errors:
  template:
    header:
      one:   "1 error prohibited this %{model} from being saved"
      other: "%{count} errors prohibited this %{model} from being saved"
    body:    "There were problems with the following fields:"

Result in activescaffold form is:

errors.template.header
errors.template.body

Not much luck with that. I know that 'error_messages_for' have been depreciated, and I also found that I should update my view...but with activescaffold, I am not using any views so I don't know what to update to have above lines translated. I installed dynamic_form gem, but above does not work either.

I found this post: rails3 I18n: can't override..., but as I said, I am not using any views so not sure how to override above.

Any tips much appreciated.

Regards Jan

1

1 Answers

1
votes

Solution was to look into activescaffold gem directory to see how default en.yml looks like.

From there it is obvious that error messages should be represented as follows:

en:
  active_scaffold:
    add: 'Add'
    add_existing: 'Add Existing'
    add_existing_model: 'Add Existing %{model}'
    errors:
      template:
        header:
          one:    "1 error prohibited this %{model} from being saved."
          other:  "%{count} errors prohibited this %{model} from being saved"
        body: "There were problems with the following fields:"