Sha256: cc15478a442b7af0b58df650b4851bb021cc00203c208518d7d8bf35696f6dbe
Contents?: true
Size: 582 Bytes
Versions: 2
Compression:
Stored size: 582 Bytes
Contents
module GettextI18nRails::ActiveRecord # CarDealer.sales_count -> s_('CarDealer|Sales count') -> 'Sales count' if no translation was found def human_attribute_name(attribute, *args) s_(gettext_translation_for_attribute_name(attribute)) end # CarDealer -> _('car dealer') def human_name(*args) _(self.human_name_without_translation) end def human_name_without_translation self.to_s.underscore.gsub('_',' ') end def gettext_translation_for_attribute_name(attribute) "#{self}|#{attribute.to_s.split('.').map! {|a| a.humanize }.join('|')}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nulogy-gettext_i18n_rails-0.4.6.2 | lib/gettext_i18n_rails/active_record.rb |
nulogy-gettext_i18n_rails-0.4.6.1 | lib/gettext_i18n_rails/active_record.rb |