muck-engine 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
@@ -13,7 +13,7 @@ module ActionController
13
13
  # http://guides.rubyonrails.org/i18n.html
14
14
  # http://zargony.com/2009/01/09/selecting-the-locale-for-a-request
15
15
  def discover_locale
16
- I18n.locale = extract_locale_from_user_selection || extract_locale_from_tld || extract_locale_from_subdomain || extract_locale_from_headers || extract_locale_from_browser || I18n.default_locale
16
+ I18n.locale = extract_locale_from_user_selection || extract_locale_from_tld || extract_locale_from_subdomain || extract_locale_from_headers || I18n.default_locale
17
17
  end
18
18
 
19
19
  def extract_locale_from_browser
@@ -35,7 +35,8 @@ module ActionController
35
35
 
36
36
  def extract_locale_from_headers
37
37
  preferred_locales = request.headers['HTTP_ACCEPT_LANGUAGE'].split(',').map { |l| l.split(';').first }
38
- preferred_locales.select { |l| I18n.available_locales.include?(l.to_sym) } || nil
38
+ accepted_locales = preferred_locales.select { |l| I18n.available_locales.include?(l.to_sym) }
39
+ accepted_locales.empty? ? nil : accepted_locales.first
39
40
  end
40
41
 
41
42
  # Get locale from top-level domain or return nil if such locale is not available
@@ -44,7 +45,7 @@ module ActionController
44
45
  # in your /etc/hosts file to try this out locally
45
46
  def extract_locale_from_tld
46
47
  parsed_locale = request.host.split('.').last
47
- (I18n.available_locales.include? parsed_locale) ? parsed_locale : nil
48
+ (I18n.available_locales.include? parsed_locale) ? parsed_locale.to_sym : nil
48
49
  end
49
50
 
50
51
  # Get locale code from request subdomain (like http://it.application.local:3000)
@@ -53,7 +54,7 @@ module ActionController
53
54
  # in your /etc/hosts file to try this out locally
54
55
  def extract_locale_from_subdomain
55
56
  parsed_locale = request.subdomains.first
56
- (I18n.available_locales.include? parsed_locale) ? parsed_locale : nil
57
+ (I18n.available_locales.include? parsed_locale.to_sym) ? parsed_locale.to_sym : nil
57
58
  end
58
59
 
59
60
  def setup_paging
data/muck-engine.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{muck-engine}
5
- s.version = "0.1.8"
5
+ s.version = "0.1.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Justin Ball"]
9
- s.date = %q{2009-06-24}
9
+ s.date = %q{2009-06-25}
10
10
  s.description = %q{The base engine for the muck system. Contains common tables, custom for, css and javascript.}
11
11
  s.email = %q{justinball@gmail.com}
12
12
  s.extra_rdoc_files = [
@@ -147,7 +147,6 @@ Gem::Specification.new do |s|
147
147
  "locales/zh.yml",
148
148
  "locales/zh.yml",
149
149
  "muck-engine.gemspec",
150
- "pkg/muck-engine-0.1.7.gem",
151
150
  "public/images/arrow_down.gif",
152
151
  "public/images/arrow_left.gif",
153
152
  "public/images/arrow_right.gif",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-24 00:00:00 -06:00
12
+ date: 2009-06-25 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -101,7 +101,6 @@ files:
101
101
  - locales/zh-TW.yml
102
102
  - locales/zh.yml
103
103
  - muck-engine.gemspec
104
- - pkg/muck-engine-0.1.7.gem
105
104
  - public/images/arrow_down.gif
106
105
  - public/images/arrow_left.gif
107
106
  - public/images/arrow_right.gif
Binary file