MemberDecorator < ApplicationDecorator
def friends
t(".friends_gender") # key scope: 'member.friends_gender'
end
end
class ApplicationDecorator < Draper::Decorator
delegate_all
private
def translate(*args)
key = args.first
if key.is_a?(String) && (key[0] == '.')
underscored_scope = self.class.name.gsub('Decorator', '').underscore
args[0] = underscored_scope + key
end
I18n.translate(*args)
end
alias :t :translate
def localize(*args)
I18n.localize(*args)
end
alias :l :localize
end