lastobelus-merb_global 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/merb_global/controller.rb +8 -0
- metadata +1 -1
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rake/rdoctask'
|
|
4
4
|
|
5
5
|
PLUGIN = "merb_global"
|
6
6
|
NAME = "merb_global"
|
7
|
-
GEM_VERSION = "0.0.
|
7
|
+
GEM_VERSION = "0.0.10"
|
8
8
|
AUTHORS = ["Alex Coles", "Maciej Piechotka"]
|
9
9
|
EMAIL = "merb_global@googlegroups.com"
|
10
10
|
HOMEPAGE = "http://trac.ikonoklastik.com/merb_global/"
|
@@ -9,12 +9,20 @@ module Merb
|
|
9
9
|
before do
|
10
10
|
# Set up the language
|
11
11
|
accept_language = self.request.env['HTTP_ACCEPT_LANGUAGE']
|
12
|
+
if Merb::Global.config(:locale_in_session)
|
13
|
+
if params[:locale]
|
14
|
+
session[:locale] = params[:locale]
|
15
|
+
elsif session[:locale]
|
16
|
+
params[:locale] = session[:locale]
|
17
|
+
end
|
18
|
+
end
|
12
19
|
Merb::Global::Locale.current =
|
13
20
|
Merb::Global::Locale.new(params[:locale]) ||
|
14
21
|
(self._mg_locale &&
|
15
22
|
Merb::Global::Locale.new(self.instance_eval(&self._mg_locale))) ||
|
16
23
|
Merb::Global::Locale.from_accept_language(accept_language) ||
|
17
24
|
Merb::Global::Locale.new('en')
|
25
|
+
params[:locale] ||= Merb::Global::Locale.current.to_s
|
18
26
|
end
|
19
27
|
|
20
28
|
# Sets the language of block.
|