Module: R18n::Helpers

Defined in:
lib/r18n-core/helpers.rb

Overview

Useful aliases. Set I18n object before use them:

R18n.set('en')

t.ok               #=> "OK"
l Time.now, :human #=> "now"
r18n.locale.code   #=> "en"

Instance Method Summary collapse

Instance Method Details

#l(*params) ⇒ Object

Localize object. Alias for ‘r18n.l`.



41
42
43
# File 'lib/r18n-core/helpers.rb', line 41

def l(*params)
  R18n.get.l(*params)
end

#r18nObject Also known as: i18n

Get current I18n object.



30
31
32
# File 'lib/r18n-core/helpers.rb', line 30

def r18n
  R18n.get
end

#t(*params) ⇒ Object

Translate message. Alias for ‘r18n.t`.



36
37
38
# File 'lib/r18n-core/helpers.rb', line 36

def t(*params)
  R18n.get.t(*params)
end