title: Hook into Rails' I18n
body: <p>I've written a little library to hold translated content in model attributes. All you have to do is add the following to a model:</p>
  
  <pre><code>class Page &lt; ActiveRecord::Base
    i18n_attributes :title, :content
  end
  </code></pre>
  
  <p>By convention, the data is written to the real attributes i18n_title and i18n_content as a hash (or hstore hash for Postgres). And a number of getters and setters give you access to "localized virtual attributes":</p>
  
  <pre><code>page = Page.new
  page.title_en = 'Hello'
  page.title_es = 'Hola'
  page.i18n_title   # =&gt; { en: "Hello", es: "Hola" }
  I18n.locale = :es
  page.title        # =&gt; "Hola"
  page.title_en     # =&gt; "Hello"
  </code></pre>
  
  <p>You can use these virtual attributes in forms as well, but there's a downside: The form builder uses I18n to get the label and translate attribute validation errors. And it does of course look for keys such as <code>activerecord.attributes.page.title_en</code> if you use <code>title_en</code>in the form.</p>
  
  <p>It would be very cumbersome to replicate the same translation for every available_locale in the <code>locales/en.yml</code> etc files: </p>
  
  <pre><code>activerecord:
    attributes:
      page:
        title_en: "Title"
        title_es: "Title"
        ...
  </code></pre>
  
  <p>What I'd like to do is execute some code after Rails has loaded all locales in the boot process and then clone translations for these keys. Is there a way to do this? Maybe a hook which gets called after the translations have been loaded from the YAML files? (The translations are not yet loaded when my lib loads.)</p>
  
  <p>Or do you see another way to tackle this problem? (I've tried to alias I18n.translate, but I'm afraid this might cause major headache in the future.)</p>
  
  <p>Thanks for your hints!</p>