Project

General

Profile

Download (982 Bytes) Statistics
| Branch: | Tag: | Revision:
b689e231 Marc Dequènes (Duck)
require 'mycyma/info'

require 'ostruct'
require 'singleton'
73f2fc18 Marc Dequènes (Duck)
require 'gettext'
b689e231 Marc Dequènes (Duck)
module MyCyma

class Config < OpenStruct
include Singleton
73f2fc18 Marc Dequènes (Duck)
include GetText
b689e231 Marc Dequènes (Duck)
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

73f2fc18 Marc Dequènes (Duck)
# should be guessed
def available_languages
{
'' => _("Browser preference"),
'en' => _("English"),
'fr' => _("French")
}
end
b689e231 Marc Dequènes (Duck)
73f2fc18 Marc Dequènes (Duck)
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
b689e231 Marc Dequènes (Duck)
end