Class: Scribble::Methods::T

Inherits:
Method
  • Object
show all
Defined in:
lib/schoolkeep/scribble/methods/t.rb

Instance Method Summary collapse

Instance Method Details

#t(key) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/schoolkeep/scribble/methods/t.rb', line 8

def t key
  if key[0] == '.'
    key = "custom_templates.#{ template_name }#{ key }"
  end

  I18n.translate(key)
end

#template_nameObject



16
17
18
19
20
21
22
# File 'lib/schoolkeep/scribble/methods/t.rb', line 16

def template_name
  name = (
    @context.variables[:template_name] ||
    @receiver.variables[:template_name]
  )
  name.split(".").first
end