Sha256: 8d51a3ccff622c45ccd3a7522e62c1b2fb9b7eb4db523471a114fa59eb0e9fe1
Contents?: true
Size: 799 Bytes
Versions: 24
Compression:
Stored size: 799 Bytes
Contents
module ActiveadminSelleoCms module ContentTranslation def self.included(base) base.extend(ClassMethods) end module ClassMethods end def initialize_missing_translations Locale.available_locale_codes.each do |locale_code| translations.build(locale: locale_code) unless translations.detect{|t| t.locale == locale_code} end end def create_missing_translations Locale.available_locale_codes.each do |locale_code| translations.create(locale: locale_code) unless translations.detect{|t| t.locale == locale_code} end end def translated_attribute(attr, locale) _locale = I18n.locale I18n.locale = locale translation = send(attr.to_sym) I18n.locale = _locale translation end end end
Version data entries
24 entries across 24 versions & 1 rubygems