Project

General

Profile

Download (982 Bytes) Statistics
| Branch: | Tag: | Revision:

require 'mycyma/info'

require 'ostruct'
require 'singleton'
require 'gettext'

module MyCyma

class Config < OpenStruct
include Singleton
include GetText

def initialize
str = File.read(File.join(RAILS_ROOT, "config", "settings.yml"))
conf_doc = YAML.load(str)
super(conf_doc)
end

def thumbnail_param_list
list = {}
self.thumbnail_sizes.each_pair do |name, params|
key = ("thumb_" + name).to_sym
list[key] = params
end
list
end

# should be guessed
def available_languages
{
'' => _("Browser preference"),
'en' => _("English"),
'fr' => _("French")
}
end

def switch_locale(locale = nil)
# if unspecified, use browser prefered langage
if locale.nil?
cgi = nil
if defined? request.cgi
cgi = request.cgi
end
set_cgi(cgi)
else
set_locale(locale)
end
end
end
end

(2-2/5)