Joerg
Joerg

Reputation: 3823

How to set up i18n translations for derived ActiveRecord models?

I have the following three models:

class Facebook < ActiveRecord::::Base
end

class Facebook::Like < Facebook
end

class Facebook::Share < Facebook
end

class Like < ActiveRecord::Base
end

And I want to set up the attribute translations for it, but I don't know how to be specific about the derived classes.

config/locales/en.yml

activerecord:
  attributes:
    like:
      data: "Someting"
    facebook_like:
      data: "Someting else"
    facebook_share:
      data: "Again - Someting else"

Ok - so facebook_like and facebook_share obviously doesn't work - but what would I replace them with to be able to achieve my specific translations needs?

Upvotes: 1

Views: 106

Answers (1)

jdoe
jdoe

Reputation: 15779

Use slash /:

facebook/like:
  data: "Someting else"

Upvotes: 1

Related Questions