Module: StringExtension

Defined in:
lib/community_engine/i18n_extensions.rb

Instance Method Summary collapse

Instance Method Details

#localize(*args) ⇒ Object Also known as: l



2
3
4
5
6
7
8
9
10
11
# File 'lib/community_engine/i18n_extensions.rb', line 2

def localize(*args)
  if args.first.is_a? Symbol
    sym = args.shift
  else
    sym = underscore.tr(' ', '_').gsub(/[^a-z0-9_]+/i, '').to_sym
  end
  args << {:default => self}
    
  I18n.t(sym, *args).html_safe
end