Module: I18nToolbox::I18nHelper
- Defined in:
- lib/i18n_toolbox/helpers/i18n_helper.rb
Instance Method Summary collapse
- #image_tag(source, options = {}) ⇒ Object
- #possessive(owner, thing) ⇒ Object
- #truncate(text, options = {}) ⇒ Object
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, = {}) source = "#{I18n.locale}/#{source}" if .delete(:localize) super(source, ) 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, = {}) .reverse_merge!(:length => 30) [:length] = [:length] * I18nToolbox.character_ratio if .delete(:localize) super(text, ) end |