rails_set_locale 0.2.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/app/controllers/rails_set_locale/locale_controller.rb +2 -2
- data/lib/rails_set_locale/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d66fd091ca70afa5c4b0b181697a4f115c8759a5
|
4
|
+
data.tar.gz: a4d529872af327909e2d59b321c97ddaccf8377b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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&
|
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]
|
12
|
+
redirect_to params[:return_back_to]
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|