Module: I18n

Defined in:
lib/zmeygo.rb

Class Method Summary collapse

Class Method Details

.custom_exception_handler(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/zmeygo.rb', line 6

def custom_exception_handler(*args)
  args.shift
  locale = args.shift
  key = args.shift
  Zmeygo.add_to_cache(key)
  # return an aproximation of translation
  # This is last part of dot separated key, with _ replaced with space,
  # capitalized and inserted between square brakets. I found this to be best
  # aproximation of future translation.
  arr = key.to_s.split('.')
  last = if arr.respond_to?(:last)
    arr.last
  else
    arr
  end
  "["+last.tr('_',' ').capitalize+"]"
end