Sha256: 5a003e04931afb2b5413c5072caf7744f78334377d62e616cfcefa2625bba499

Contents?: true

Size: 963 Bytes

Versions: 2

Compression:

Stored size: 963 Bytes

Contents

# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'

class LocalizationExtension < Spree::Extension
  version "0.1.1"
  description "Localization support for Spree"
  url "http://support.spreehq.org/wiki/1/I18n"

  define_routes do |map|
    map.set_locale '/locale/set', :controller => 'locale', :action => 'set', :method => :get
    map.namespace :admin do |admin|
      admin.resource :localization, :controller => 'admin/localization'
    end  
  end
  
  def activate
    # load extensions lang/ui
    Globalite.add_localization_source(File.join(SPREE_ROOT, 'vendor/extensions/**/lang/ui'))

    ApplicationController.class_eval do
      include Localization
      helper_method :t
      helper_method :flag
    end

    User.class_eval do
      include Localization::UserPreferences
    end

    # admin.tabs.add "Localization", "/admin/localization", :after => "Layouts", :visibility => [:all]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree-0.5.0 vendor/extensions/localization/localization_extension.rb
spree-0.5.1 vendor/extensions/localization/localization_extension.rb