forked from godfat/jin-rou
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.rb
34 lines (25 loc) · 948 Bytes
/
start.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'rubygems'
require 'ramaze'
# Add directory start.rb is in to the load path, so you can run the app from
# any other working path
# $LOAD_PATH.unshift(__DIR__)
# this would take care of load path without requiring ramaze,
# plus other utility like relative file reading.
require "#{File.expand_path(File.dirname(__FILE__))}/init"
# require YAML based localization
require 'ramaze/tool/localize'
# Activate localization
# Setup localization options
class Ramaze::Tool::Localize
Ramaze::Dispatcher::Action::FILTER << self
trait :mapping => { /^en/ => 'en_US', /^zh/ => 'zh_TW' }
trait :default_language => 'en_US',
:languages => %w[ en_US zh_TW ],
:file => lambda{ |locale| JinRou.expand("locale/#{locale}.yaml") }
# alternative, problematic if you want to run from another pwd.
# :file => "locale/%s.yaml"
end
# Initialize controllers and models
require 'controller/init'
require 'model/init'
Ramaze.start