Module: I18nToolbox::I18nHelper

Defined in:
lib/i18n_toolbox/helpers/i18n_helper.rb

Instance Method Summary collapse

Instance Method Details

#image_tag(source, options = {}) ⇒ Object



3
4
5
6
# File 'lib/i18n_toolbox/helpers/i18n_helper.rb', line 3

def image_tag(source, options = {})
  source = "#{I18n.locale}/#{source}" if options.delete(:localize)
  super(source, options)
end

#possessive(owner, thing) ⇒ Object



8
9
10
# File 'lib/i18n_toolbox/helpers/i18n_helper.rb', line 8

def possessive(owner, thing)
  t(owner.last == 's' ? :'i18n_toolbox.possessive_s' : :'i18n_toolbox.possessive', :owner => owner, :thing => thing, :default => :'i18n_toolbox.possessive') if owner.present?
end

#truncate(text, options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/i18n_toolbox/helpers/i18n_helper.rb', line 12

def truncate(text, options = {})
  options.reverse_merge!(:length => 30)
  options[:length] = options[:length] * I18nToolbox.character_ratio if options.delete(:localize)
  super(text, options)
end