Use the same translations for ActiveRecord and ActiveModel

Posted . Visible to the public.

ActiveRecord translations live in locale.activerecord. ActiveModel translations live in locale.activemodel. To use the same translations for both, use YAML references with & and *:

de:

  models: &models
    user: 'Benutzer'

  attributes: &attributes
    user:
      email: 'E-Mail'
      
  errors: &errors
    format: ! '%{attribute} %{message}'
    messages:
      accepted: muss akzeptiert werden
      blank: muss ausgefüllt werden
      # ...
      
  activerecord:
    errors: *errors
    models: *models
    attributes: *attributes

  activemodel:
    errors: *errors
    models: *models
    attributes: *attributes
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2013-04-30 12:01)