localite 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -18,17 +18,20 @@ module Localite::Filter
18
18
  filter_response controller
19
19
  end
20
20
  rescue
21
- controller.response.body = "Caught exception: " + CGI::escapeHTML($!.inspect) if Rails.env.development?
21
+ if Rails.env.development?
22
+ controller.response.body = "Caught exception: " + CGI::escapeHTML($!.inspect)
23
+ STDERR.puts $!.to_s + "\n\t" + $!.backtrace.join("\n\t")
24
+ end
22
25
  raise
23
26
  end
24
27
 
25
28
  def self.filter_response(controller)
26
- next unless controller.response.headers["Content-Type"] =~ /text\/html/
29
+ return unless controller.response.headers["Content-Type"] =~ /text\/html/
27
30
  controller.response.body = filter_lang_nodes(controller.response.body)
28
31
  end
29
32
 
30
33
  def self.filter_lang_nodes(body)
31
- doc = Nokogiri.XML "<filter-outer-span>#{body}</filter-outer-span>"
34
+ doc = Nokogiri.XML "<filter-outer-span xmlns:fb='http://facebook.com/'>#{body}</filter-outer-span>"
32
35
 
33
36
  doc.css("[lang]").each do |node|
34
37
  if Localite.locale.to_s != node["lang"]
@@ -8,7 +8,7 @@ module Localite::Settings
8
8
  #
9
9
  # returns the current locale; defaults to the base locale
10
10
  def locale
11
- @locale || base
11
+ I18n.locale
12
12
  end
13
13
 
14
14
  #
@@ -22,7 +22,7 @@ module Localite::Settings
22
22
  # the locale to the default locale.
23
23
  def locale=(locale)
24
24
  locale = locale.to_sym
25
- @locale = available?(locale) ? locale : base
25
+ I18n.locale = available?(locale) ? locale : base
26
26
  end
27
27
 
28
28
  #
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{localite}
5
- s.version = "0.2.0"
5
+ s.version = "0.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["pboy"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - pboy