lib/refinery/i18n.rb in refinerycms-i18n-0.9.8.5 vs lib/refinery/i18n.rb in refinerycms-i18n-0.9.8.6
- old
+ new
@@ -46,15 +46,15 @@
end
protected :find_or_set_locale
}
end
-
+
config.after_initialize do
::Refinery::I18n.setup! if defined?(RefinerySetting) and RefinerySetting.table_exists?
end
-
+
end
class << self
attr_accessor :enabled, :current_locale, :locales, :default_locale, :default_frontend_locale
@@ -83,14 +83,21 @@
end
end
def current_locale=(locale)
@current_locale = locale.to_sym
- RefinerySetting[:i18n_translation_current_locale] = {
+ value = {
:value => locale.to_sym,
:scoping => 'refinery',
:callback_proc_as_string => %q{::Refinery::I18n.setup!}
}
+ # handles a change in Refinery API
+ if RefinerySetting.methods.map(&:to_sym).include?(:set)
+ RefinerySetting.set(:i18n_translation_current_locale, value)
+ else
+ RefinerySetting[:i18n_translation_current_locale] = value
+ end
+
::I18n.locale = locale.to_sym
end
def default_locale
@default_locale ||= RefinerySetting.find_or_set(:i18n_translation_default_locale,
\ No newline at end of file