lib/zen/controller/base_controller.rb in zen-0.2.4.1 vs lib/zen/controller/base_controller.rb in zen-0.2.5

- old
+ new

@@ -1,9 +1,9 @@ #:nodoc: module Zen #:nodoc: - module Controllers + module Controller ## # The BaseController is extended by both the FrontendController and the # BackendController. This controller is mostly used to set and retrieve data that's # used in both the backend and the frontend. # @@ -22,18 +22,23 @@ # @author Yorick Peterse # @since 1.0 # def initialize super - - # Get all settings - if !@settings - @settings = ::Settings::Models::Setting.get_settings + + # Store the settings data if this is the first time we're loading the controller + if ::Zen::Settings.empty? + ::Settings::Model::Setting.get_settings.each do |k, v| + ::Zen::Settings[k] = v + end end - + # Override the language - ::Zen::Language.options.language = @settings[:language] - ::Zen::Language.load('zen_general') + if ::Zen::Settings[:language] != ::Zen::Language.options.language + # Reload the language pack + ::Zen::Language.options.language = ::Zen::Settings[:language] + ::Zen::Language.load('zen_general') + end end end end end