Search code examples
ruby-on-railsinternationalizationrails-i18nrails-activestorage

How to translate ActiveStorage attribute


My model, Order, has many texts, and each text can have one attached document (has_one_attached(:document)). Sometimes, the base error is Texts document, sometimes document...

I would like to translate it, but I don't know how.

This is my activerecord.fr.yml :

fr:
  activerecord:
    errors:
      models:
        text:
          attributes:
            document: 'blabla'
            texts_document: 'test'

but it's not working. I also tried this:

fr:
  activerecord:
    errors:
      models:
        order:
          attributes:
            texts:
             document: 'blabla'
             texts_document: 'test'

Any idea?


Solution

  • fr:
      activerecord:
        models:
          order: "l'ordre"
          text: le texte
        attributes:
          text:
            document: le document