Module: Mulang::Expectation::I18n

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

Constant Summary collapse

DEFAULT_KEYWORDS =
{
  keyword_fail: :fail,
  keyword_false: :false,
  keyword_findall: :findall,
  keyword_for: :for,
  keyword_forall: :forall,
  keyword_foreach: :foreach,
  keyword_if: :if,
  keyword_is: :is,
  keyword_not: :not,
  keyword_null: :null,
  keyword_repeat: :repeat,
  keyword_switch: :switch,
  keyword_true: :true,
  keyword_while: :while,
  keyword_yield: :yield
}

Class Method Summary collapse

Class Method Details

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



21
22
23
24
25
26
27
# File 'lib/mulang/expectation/i18n.rb', line 21

def translate(e, keywords = nil)
  e = e.as_v2
  key = key_for e.binding, e.inspection
  ::I18n.t key, translation_params(e, keywords)
rescue
  '<unknown expectation>'
end