Skip to content

Commit

Permalink
[padrino-core] Removed auto_locale, we need a core smaller and faster…
Browse files Browse the repository at this point in the history
…, so people that need it can easly use a extension/initializer.
  • Loading branch information
DAddYE committed Feb 18, 2010
1 parent fec74bf commit 7771e66
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 43 deletions.
1 change: 0 additions & 1 deletion padrino-admin/lib/padrino-admin/generators/app/app.rb.tt
Expand Up @@ -9,7 +9,6 @@ class Admin < Padrino::Application
# set :reload, false # Reload application files (default in development)
# set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
# set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
# enable :auto_locale # Auto Set locale if url match /:locale/foo/bar (disabled by default)
# disable :padrino_helpers # Disables padrino markup helpers (enabled by default if present)
# disable :padrino_mailer # Disables padrino mailer (enabled by default if present)
# disable :flash # Disables rack-flash (enabled by default)
Expand Down
19 changes: 0 additions & 19 deletions padrino-core/lib/padrino-core/application.rb
Expand Up @@ -183,7 +183,6 @@ def default_configuration!
set :authentication, false
# Padrino locale
set :locale_path, Proc.new { Dir[File.join(self.root, "/locale/**/*.{rb,yml}")] }
set :auto_locale, false
# Plugin specific
set :padrino_mailer, defined?(Padrino::Mailer)
set :padrino_helpers, defined?(Padrino::Helpers)
Expand Down Expand Up @@ -468,24 +467,6 @@ def route!(base=self.class, pass_block=nil)
route_missing
end
end

##
# When we set :auto_locale, true then if we use param locale like:
#
# ==== Examples
#
# get "/:locale/some/foo" do; ...; end
#
# we automatically set the I18n locale to params[:locale]
#
def route_eval(&block)
if options.auto_locale
if params[:locale]
I18n.locale = params[:locale].to_sym rescue options.locale
end
end
super(&block)
end

##
# Hijacking the sinatra render for do three thing:
Expand Down
21 changes: 0 additions & 21 deletions padrino-core/test/test_application.rb
Expand Up @@ -147,25 +147,4 @@ class PadrinoTestApp < Padrino::Application; end
end
end
end

context 'for application i18n functionality' do

should 'have auto_locale disabled' do
mock_app do
assert !auto_locale
end
end

should 'set locale when auto_locale is enabled' do
mock_app do
enable :auto_locale
get("/:locale"){ I18n.locale.to_s }
end

%w(it de fr).each do |lang|
get("/#{lang}")
assert_equal lang, body
end
end
end
end
1 change: 0 additions & 1 deletion padrino-gen/lib/padrino-gen/generators/app/app.rb.tt
Expand Up @@ -9,7 +9,6 @@ class <%= @class_name %> < Padrino::Application
# set :reload, false # Reload application files (default in development)
# set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
# set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
# enable :auto_locale # Auto Set locale if url match /:locale/foo/bar (disabled by default)
# disable :padrino_helpers # Disables padrino markup helpers (enabled by default if present)
# disable :padrino_mailer # Disables padrino mailer (enabled by default if present)
# disable :flash # Disables rack-flash (enabled by default)
Expand Down
Expand Up @@ -9,7 +9,6 @@ class <%= @class_name %> < Padrino::Application
# set :reload, false # Reload application files (default in development)
# set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
# set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
# enable :auto_locale # Auto Set locale if url match /:locale/foo/bar (disabled by default)
# disable :padrino_helpers # Disables padrino markup helpers (enabled by default if present)
# disable :padrino_mailer # Disables padrino mailer (enabled by default if present)
# disable :flash # Disables rack-flash (enabled by default)
Expand Down

0 comments on commit 7771e66

Please sign in to comment.