aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/i18n.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index c191db1df9..e3ca129189 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -316,6 +316,17 @@ end
```
```ruby
+# app/controllers/application_controller.rb
+class ApplicationController < ActionController::Base
+ before_action :set_locale
+
+ def set_locale
+ I18n.locale = params[:locale] || I18n.default_locale
+ end
+end
+```
+
+```ruby
# app/controllers/home_controller.rb
class HomeController < ApplicationController
def index