lib/refinery/i18n.rb in refinerycms-i18n-0.9.9.1 vs lib/refinery/i18n.rb in refinerycms-i18n-0.9.9.2
- old
+ new
@@ -9,10 +9,14 @@
require File.expand_path('../i18n-filter', __FILE__)
require File.expand_path('../i18n-js', __FILE__)
require File.expand_path('../translate', __FILE__)
end
+ initializer "serve static assets" do |app|
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
+ end
+
config.to_prepare do
::ApplicationController.class_eval do
def default_url_options(options={})
::Refinery::I18n.enabled? ? { :locale => ::I18n.locale } : {}
end
@@ -23,11 +27,11 @@
if ::Refinery::I18n.enabled?
if ::Refinery::I18n.has_locale?(locale = params[:locale].try(:to_sym))
Thread.current[:globalize_locale] = ::I18n.locale = locale
elsif locale.present? and locale != ::Refinery::I18n.default_frontend_locale
Thread.current[:globalize_locale] = params[:locale] = I18n.locale = ::Refinery::I18n.default_frontend_locale
- redirect_to(params, :notice => "The locale '#{locale.to_s}' is not supported.") and return
+ redirect_to(params, :notice => "The locale '#{locale}' is not supported.") and return
else
Thread.current[:globalize_locale] = ::I18n.locale = ::Refinery::I18n.default_frontend_locale
end
end
end
@@ -59,11 +63,11 @@
config.after_initialize do
::Refinery::I18n.setup! if defined?(RefinerySetting) and RefinerySetting.table_exists?
Refinery::Plugin.register do |plugin|
plugin.name = "refinery_i18n"
- plugin.version = %q{0.9.9.1}
+ plugin.version = %q{0.9.9.2}
plugin.hide_from_menu = true
plugin.always_allow_access = true
end
end
@@ -174,11 +178,11 @@
else
RefinerySetting.find_by_name_and_scoping('i18n_translation_locales', 'refinery').try(:value)
end
if locales.present? and locales.is_a?(Hash) and locales.keys.exclude?(self.built_in_locales.keys.last)
- value = {:value => nil, :scoping => 'refinery'}
+ value = {:value => locales.dup.deep_merge(self.built_in_locales), :scoping => 'refinery'}
if RefinerySetting.respond_to?(:set)
RefinerySetting.set(:i18n_translation_locales, value)
else
RefinerySetting[:i18n_translation_locales] = value
end
@@ -219,14 +223,15 @@
:da => 'Dansk',
:nb => 'Norsk Bokmål',
:sl => 'Slovenian',
:es => 'Español',
:it => 'Italiano',
- :'zh-CN' => 'Simple Chinese',
:de => 'Deutsch',
:lv => 'Latviski',
:ru => 'Русский',
:sv => 'Svenska',
- :pl => 'Polski'
+ :pl => 'Polski',
+ :'zh-CN' => 'Simple Chinese',
+ :'zh-TW' => 'Traditional Chinese'
}
end
-end
\ No newline at end of file
+end