lib/refinery/i18n.rb in refinerycms-i18n-0.9.9.13 vs lib/refinery/i18n.rb in refinerycms-i18n-0.9.9.14
- old
+ new
@@ -28,16 +28,16 @@
def find_or_set_locale
if ::Refinery::I18n.enabled?
::I18n.locale = ::Refinery::I18n.current_locale
if ::Refinery::I18n.has_locale?(locale = params[:locale].try(:to_sym))
- Thread.current[:globalize_locale] = locale
+ ::I18n.locale = locale
elsif locale.present? and locale != ::Refinery::I18n.default_frontend_locale
- params[:locale] = Thread.current[:globalize_locale] = ::Refinery::I18n.default_frontend_locale
+ params[:locale] = ::I18n.locale = ::Refinery::I18n.default_frontend_locale
redirect_to(params, :notice => "The locale '#{locale}' is not supported.") and return
else
- Thread.current[:globalize_locale] = ::Refinery::I18n.default_frontend_locale
+ ::I18n.locale = ::Refinery::I18n.default_frontend_locale
end
end
end
prepend_before_filter :find_or_set_locale
@@ -125,18 +125,12 @@
:scoping => 'refinery'
}).to_sym
end
def current_frontend_locale
- if Thread.current[:globalize_locale].present?
- if Thread.current[:globalize_locale].to_s != ::Refinery::I18n.default_frontend_locale.to_s
- Thread.current[:globalize_locale]
- else
- ::Refinery::I18n.default_frontend_locale
- end
- elsif ::I18n.locale.present? && ::I18n.locale.to_s != ::Refinery::I18n.default_frontend_locale.to_s
- ::I18n.locale
+ if Globalize.locale.present? && Globalize.locale.to_s != ::Refinery::I18n.default_frontend_locale.to_s
+ Globalize.locale
elsif ::Refinery::I18n.default_frontend_locale.present?
::Refinery::I18n.default_frontend_locale
else
::I18n.locale
end
@@ -206,10 +200,11 @@
:'zh-CN' => 'Simplified Chinese',
:'zh-TW' => 'Traditional Chinese',
:el => 'Ελληνικά',
:rs => 'Srpski',
:cs => 'Česky',
- :sk => 'Slovenský'
+ :sk => 'Slovenský',
+ :jp => '日本語'
}
end
end