Sha256: e13276ec6878e7cd36b259c4bf7882cc00e0659ed25b76a379a9cdf496c936c2

Contents?: true

Size: 733 Bytes

Versions: 3

Compression:

Stored size: 733 Bytes

Contents

# encoding: utf-8
require File.join(File.dirname(__FILE__),'/zmeygo_sync/base')

module I18n
  class << self
    def custom_exception_handler(*args)
      args.shift
      locale = args.shift
      key = args.shift
      ZmeygoSync.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
  end
  I18n.exception_handler = :custom_exception_handler
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zmeygo_sync-0.22 lib/zmeygo_sync.rb
zmeygo_sync-0.21 lib/zmeygo_sync.rb
zmeygo_sync-0.2 lib/zmeygo_sync.rb