rails_set_locale 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 023a690fec4f556d36ab2211169bdd2fe38cad94
4
- data.tar.gz: 2ade8ac27e36e5977ec5cf6e131babac019c9aa0
3
+ metadata.gz: d66fd091ca70afa5c4b0b181697a4f115c8759a5
4
+ data.tar.gz: a4d529872af327909e2d59b321c97ddaccf8377b
5
5
  SHA512:
6
- metadata.gz: e79eee79e53a00a7bfb58c928623b6a0b804a76a0e003321042df07f5210ef2949a1ca2620e5959d8b48deace04bdfcf3f5fcc0c78f2c3b71eca0bb9a6921424
7
- data.tar.gz: 1bf0032bb1dd9a94456ea28d0b7f3185022a4d6229097fb13dd025e19d9646ec68821f0acc798a3394f4b833dee41f057c3c437e3e5e7c9f31224a8c1fa1cb73
6
+ metadata.gz: f14f58c7b490554d924bf11bf1e397f6ee20fe4d492238255760894275da762de5a9b4b97255335cb3cca9c2b36bb1e85501faa89c8e1b02c78eab88206fcd97
7
+ data.tar.gz: b44eb8a2dcac76de83afeaa678f824c42cc4b4cb867908f036ad5b04a107cdb5ccab9f71b103760b9f20559d6aaf506bae51aa8b45a32f8756f6d9099b69607b
data/README.md CHANGED
@@ -47,13 +47,14 @@ You can set the locale by letting your users visiting the URL:
47
47
 
48
48
  `/set_locale`
49
49
 
50
- with param `locale` specifying the new locale.
50
+ with param `locale` specifying the new locale. You need to give, also, the `return_back_to` URL because the controller
51
+ that is setting the locale needs to know where to redirect to.
51
52
 
52
53
  For example:
53
54
 
54
- `/set_locale?locale=el`
55
+ `/set_locale?locale=el&return_back_to=/`
55
56
 
56
- will set the locale to the Greek locale.
57
+ will set the locale to the Greek locale and redirect to `/`.
57
58
 
58
59
  The controller implemented by the `RailsSetLocale` gem, is setting the `session[:locale]` to the locale requested.
59
60
 
@@ -4,12 +4,12 @@ require_dependency 'rails_set_locale/application_controller'
4
4
 
5
5
  module RailsSetLocale
6
6
  class LocaleController < ApplicationController
7
- # GET "/set_locale?locale=XX&current_path=XXXXX"
7
+ # GET "/set_locale?locale=XX&return_back_to=XXXXX"
8
8
  def set_locale
9
9
  new_locale = params[:locale].to_sym
10
10
  I18n.locale = new_locale
11
11
  session[:locale] = new_locale
12
- redirect_to params[:return_back_to] || request.referer || root_url
12
+ redirect_to params[:return_back_to]
13
13
  end
14
14
  end
15
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsSetLocale
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_set_locale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Panos Matsinopoulos