title: How to properly translate Paperclip error messages?
body: <p>I am using Ruby on Rails 3.2.2 and the Paperclip plugin. Since I would like to translate Paperclip error messages, I use the following code:</p>
  
  <pre><code>class Article &lt; ActiveRecord::Base
    validates_attachment_size :picture,
      :less_than =&gt; 4.megabytes,
      :message   =&gt; I18n.t('trl_too_big_file_size', :scope =&gt; 'activerecord.errors.messages')
  end
  </code></pre>
  
  <p>My <code>.yml</code> files are:</p>
  
  <pre><code># &lt;APP_PATH&gt;/config/locales/en.yml (english language)
  activerecord:
    errors:
      messages:
        trl_too_big_file_size: is too big
  
  # &lt;APP_PATH&gt;/config/locales/it.yml (italian language)
  activerecord:
    errors:
      messages:
        trl_too_big_file_size: è troppo grande
  </code></pre>
  
  <p>My <code>ApplicationController</code> is:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    before_filter :set_locale
  
    def set_locale
      # I am using code from http://guides.rubyonrails.org/i18n.html#setting-and-passing-the-locale.
      I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
    end
    # BTW: My `I18n.default_locale` is `:en` (english).
  end
  </code></pre>
  
  <p>However, <em>when I submit the form related to the Paperclip attachment my application generate a <strong>not</strong> translated text</em> - that is, it generates (and outputs) a <em>not</em> properly translated string because it refers always to the default locale languages error string <code>en.activerecord.errors.messages.trl_too_big_file_size</code> even if the <code>I18n.locale</code> is <code>:it</code>. I made some research (for example, <a href="https://github.com/thoughtbot/paperclip/issues/14" rel="nofollow">1</a>, <a href="http://blog.patrickespake.com/2009/11/18/ruby-on-rails-paperclip-com-i18n/" rel="nofollow">2</a>), but I still cannot figure out how to properly translate error messages related to the Paperclip gem in model files (see the code above). It seems a bug of the Parperclip gem (also because that seems that I am not the only one to get this issue)...</p>
  
  <p>How can I solve the issue?</p>
  
  <hr>
  
  <p>P.S.: I think the problem is related to some "<em>file loading order</em> process" of ApplicationController-Paperclip gem... but I do not know how to solve the problem.</p>