From 49e7c36fb22a67f2bb4a77475ff30fdeba4b5865 Mon Sep 17 00:00:00 2001 From: James Smith Date: Sun, 2 Jul 2023 16:32:37 +0100 Subject: [PATCH] autodetect language using rack middleware --- Gemfile | 1 + Gemfile.lock | 3 +++ config/application.rb | 3 +++ 3 files changed, 7 insertions(+) diff --git a/Gemfile b/Gemfile index 6d8fc73b6..4a7ca280c 100644 --- a/Gemfile +++ b/Gemfile @@ -105,3 +105,4 @@ gem "rails-controller-testing", "~> 1.0", group: :test gem "pundit", "~> 2.3" gem "spdx", "~> 4.1" +gem "rack-contrib", "~> 2.3" diff --git a/Gemfile.lock b/Gemfile.lock index a6828ce0c..1beb5a396 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -288,6 +288,8 @@ GEM activesupport (>= 3.0.0) racc (1.7.3) rack (2.2.8) + rack-contrib (2.3.0) + rack (~> 2.0) rack-mini-profiler (3.3.0) rack (>= 1.2.0) rack-test (2.1.0) @@ -522,6 +524,7 @@ DEPENDENCIES public_suffix (~> 5.0) puma (~> 6.4) pundit (~> 2.3) + rack-contrib (~> 2.3) rack-mini-profiler (~> 3.1) rails (~> 7.0.8) rails-controller-testing (~> 1.0) diff --git a/config/application.rb b/config/application.rb index 4f7cd2afa..53d694744 100644 --- a/config/application.rb +++ b/config/application.rb @@ -18,6 +18,8 @@ require "rails" rescue LoadError end +require "rack/contrib" + # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) @@ -48,5 +50,6 @@ module Manyfold ) end end + config.middleware.use Rack::Locale end end