Sha256: 9eb6685e666643a13ece7ab1b2c3f65f9642d8cfa63891a77c3c21024a27eed8
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
module LostInTranslations module Base def self.included(base_class) LostInTranslations.infected_classes.push(base_class) base_class.extend ClassMethods end def translate(field, locale = I18n.locale) translation = LostInTranslations.translate(self, field, locale) if translation.nil? && locale.to_sym == I18n.default_locale.to_sym translation = call_original_field(self, field) end translation end def assign_translation(field, value, locale = I18n.locale) LostInTranslations.assign_translation(self, field, value, locale) end module ClassMethods attr_writer :translation_data_field def translation_data_field @translation_data_field || LostInTranslations.config.translation_data_field end def translation_fields @translation_fields ||= [] end def translate(*fields) translation_fields.concat(fields) define_translation_methods end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lost_in_translations-1.4.0 | lib/lost_in_translations/base.rb |