Module: Mulang::Expectation::I18n

Defined in:
lib/mulang/expectation/i18n.rb

Class Method Summary collapse

Class Method Details

.translate(e, tokens = nil) ⇒ Object Also known as: t



3
4
5
6
7
# File 'lib/mulang/expectation/i18n.rb', line 3

def translate(e, tokens = nil)
  translate!(e, tokens)
rescue
  '<unknown expectation>'
end

.translate!(e, tokens = nil) ⇒ Object



9
10
11
12
13
# File 'lib/mulang/expectation/i18n.rb', line 9

def translate!(e, tokens = nil)
  e = e.as_v2
  key = key_for e.binding, e.inspection
  ::I18n.t(key, **translation_params(e, tokens))
end