refinerycms-i18n 0.9.8.1 → 0.9.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/gemspec.rb +1 -1
  2. data/lib/refinery/i18n.rb +8 -15
  3. metadata +3 -3
data/lib/gemspec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- version = '0.9.8.1'
2
+ version = '0.9.8.2'
3
3
  raise "Could not get version so gemspec can not be built" if version.nil?
4
4
  files = Dir.glob("**/*").flatten.reject do |file|
5
5
  file =~ /\.gem(spec)?$/
data/lib/refinery/i18n.rb CHANGED
@@ -8,21 +8,14 @@ module Refinery
8
8
  require File.expand_path('../i18n-filter', __FILE__)
9
9
  require File.expand_path('../i18n-js', __FILE__)
10
10
  require File.expand_path('../translate', __FILE__)
11
-
12
- # TODO: Use new method available_locales once Rails is upgraded, see:
13
- # http://github.com/svenfuchs/i18n/commit/411f8fe7c8f3f89e9b6b921fa62ed66cb92f3af4
14
- def I18n.valid_locales
15
- I18n.backend.send(:init_translations) unless I18n.backend.initialized?
16
- backend.send(:translations).keys.reject { |locale| locale == :root }
17
- end
18
11
  end
19
12
 
20
13
  config.to_prepare do
21
- ::Refinery::ApplicationController.class_eval do
14
+ ::Refinery::ApplicationController.class_eval %{
22
15
  def default_url_options(options={})
23
- ::Refinery::I18n.enabled? ? { :locale => I18n.locale } : {}
16
+ ::Refinery::I18n.enabled? ? { :locale => ::I18n.locale } : {}
24
17
  end
25
-
18
+
26
19
  prepend_before_filter :find_or_set_locale
27
20
 
28
21
  def find_or_set_locale
@@ -31,7 +24,7 @@ module Refinery
31
24
  ::I18n.locale = locale
32
25
  elsif locale.present? and locale != ::Refinery::I18n.default_frontend_locale
33
26
  params[:locale] = I18n.locale = ::Refinery::I18n.default_frontend_locale
34
- redirect_to(params, :notice => "The locale '#{locale.to_s}' is not supported.") and return
27
+ redirect_to(params, :notice => "The locale '\#{locale.to_s}' is not supported.") and return
35
28
  else
36
29
  ::I18n.locale = ::Refinery::I18n.default_frontend_locale
37
30
  end
@@ -39,20 +32,20 @@ module Refinery
39
32
  end
40
33
 
41
34
  protected :default_url_options, :find_or_set_locale
42
- end
35
+ }
43
36
 
44
- ::Refinery::AdminBaseController.class_eval do
37
+ ::Refinery::AdminBaseController.class_eval %{
45
38
  def find_or_set_locale
46
39
  if (params[:set_locale].present? and ::Refinery::I18n.locales.include?(params[:set_locale].to_sym))
47
40
  ::Refinery::I18n.current_locale = params[:set_locale].to_sym
48
41
  redirect_back_or_default(admin_dashboard_path) and return
49
42
  else
50
- I18n.locale = ::Refinery::I18n.current_locale
43
+ ::I18n.locale = ::Refinery::I18n.current_locale
51
44
  end
52
45
  end
53
46
 
54
47
  protected :find_or_set_locale
55
- end
48
+ }
56
49
 
57
50
  ::Refinery::I18n.setup! if defined?(RefinerySetting) and RefinerySetting.table_exists?
58
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-i18n
3
3
  version: !ruby/object:Gem::Version
4
- hash: 37
4
+ hash: 35
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
9
  - 8
10
- - 1
11
- version: 0.9.8.1
10
+ - 2
11
+ version: 0.9.8.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Resolve Digital