module Coco module Concerns module Translatable extend ActiveSupport::Concern def tt(key) t("coco.#{self.class.i18n_path}.#{key}") end class_methods do def i18n_path(path = nil) @_i18n_path = path unless path.nil? @_i18n_path ||= component_path.underscore.tr("/", ".") end end end end end