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.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/merb_global/controller.rb +8 -0
  3. 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.9"
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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lastobelus-merb_global
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Coles