require "i18n/globals/version"

module I18n
  class Config
    def globals
      @globals ||= {}
    end

    def globals=(globals)
      @globals = globals
    end
  end

  class << self
    def translate(*args)
      globals = config.globals
      if config.respond_to?(:original_config)
        globals.merge!(config.original_config.globals)
      end

      if args.last.is_a?(Hash)
        args[-1] = globals.merge(args.last)
      else
        args << globals
      end
      super(*args)
    end
  end
end

require "i18n/globals/version"

module I18n
  class Config
    def globals
      @globals ||= {}
    end

    def globals=(globals)
      @globals = globals
    end
  end

  class << self
    def translate(*args)
      globals = config.globals
      if config.respond_to?(:original_config)
        globals.merge!(config.original_config.globals)
      end

      if args.last.is_a?(Hash)
        args[-1] = globals.merge(args.last)
      else
        args << globals
      end
      super(*args)
    end

    alias t translate
  end
end

Fix missing alias for translations
Fix missing alias for translations

I18n main lib provides two methods to translate copies. One is
`translate` and the other one is `t`. In this gem we are just overriding
`translate` but not `t`. So `t` is not adding global interpolation as
expected.

As you can see here, the original gem is doing that:

https://github.com/attilahorvath/i18n-globals/blob/master/lib/i18n/globals.rb#L118
