Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Generate locales automatically at initialization with Rails engine.

  • Loading branch information...
commit 35d4bb89fcf9fa35cba0825f498abf96d28fd285 1 parent 8a010cc
Peter Zotov whitequark authored

Showing 3 changed files with 9 additions and 4 deletions. Show diff stats Hide diff stats

  1. +1 4 README
  2. +1 0  lib/babilu.rb
  3. +7 0 lib/babilu/engine.rb
5 README
@@ -41,9 +41,6 @@ layout. It will expand to javascript_include_tag 'babilu' on Rails <3.1, and to
41 41 empty string on Rails 3.1, but is still required to regenerate the file in
42 42 development mode.
43 43
44   -For Babilu to work in production mode, you need to add an initializer like this:
45   -
46   - # config/initializers/babilu.rb
47   - Babilu::Generator.generate
  44 +In production mode, locales.js will be generated automatically at startup.
48 45
49 46 Copyright (c) 2008 Tore Darell, released under the MIT license
1  lib/babilu.rb
@@ -2,6 +2,7 @@
2 2 require "babilu/i18n_extensions"
3 3 require "babilu/generator"
4 4 require "babilu/include_tag_helper"
  5 +require "babilu/engine"
5 6
6 7 ActionController::Base.send(:include, Babilu::Generator)
7 8 ActionView::Base.send(:include, Babilu::IncludeTagHelper)
7 lib/babilu/engine.rb
... ... @@ -0,0 +1,7 @@
  1 +module Babilu
  2 + class Engine < Rails::Engine
  3 + initializer 'babilu.generate_locales' do
  4 + Babilu::Generator.generate
  5 + end
  6 + end
  7 +end

0 comments on commit 35d4bb8

Please sign in to comment.
Something went wrong with that request. Please try again.