Class: Formatic::Wrappers::Translate

Inherits:
Object
  • Object
show all
Includes:
Calls
Defined in:
lib/formatic/wrappers/translate.rb

Overview

Looks up translations for placeholders, hints, etc.

Instance Method Summary collapse

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
# File 'lib/formatic/wrappers/translate.rb', line 14

def call
  if optimal_key
    I18n.t optimal_key, default: ([optimal_key] + fallback_keys), raise: true
  else
    I18n.t fallback_keys.first, default: fallback_keys[1..], raise: true
  end
rescue I18n::MissingTranslationData
  nil
end