Module: Middleman::CoreExtensions::I18n

Defined in:
middleman-core/lib/middleman-core/core_extensions/i18n.rb

Defined Under Namespace

Modules: InstanceMethods Classes: Localizer

Class Method Summary (collapse)

Class Method Details

+ (Object) registered(app) Also known as: included

Once registerd



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'middleman-core/lib/middleman-core/core_extensions/i18n.rb', line 10

def registered(app)
  app.set :locales_dir, "locales"

  app.send :include, InstanceMethods
      
  # Needed for helpers as well
  app.after_configuration do
    # This is for making the tests work - since the tests
    # don't completely reload middleman, I18n.load_path can get
    # polluted with paths from other test app directories that don't 
    # exist anymore.
    ::I18n.load_path.delete_if {|path| path =~ %r{tmp/aruba}}
    ::I18n.load_path += Dir[File.join(root, locales_dir, "*.yml")]
    ::I18n.reload!
  end
end