summaryrefslogtreecommitdiff
path: root/vendor/bundle/ruby/3.4.0/gems/i18n-1.15.2/lib/i18n/middleware.rb
blob: 899983491d799128af1b18b66de4fbd59a604c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module I18n
  class Middleware

    def initialize(app)
      @app = app
    end

    def call(env)
      @app.call(env)
    ensure
      if Fiber.respond_to?(:[])
        Fiber[:i18n_config] = I18n::Config.new
      else
        Thread.current.thread_variable_set(:i18n_config, I18n::Config.new)
      end
    end

  end
end