aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/lookup_context.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-29 23:46:55 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-29 23:48:35 -0300
commitecb1981bfd3ffaca3a3efd110fc85380ece8191d (patch)
tree1b48cc326ad1c3ea800967a66cd106525e42e573 /actionview/lib/action_view/lookup_context.rb
parentd9b080bf3b1f28a52a2020c5c4b106cddf0303e0 (diff)
downloadrails-ecb1981bfd3ffaca3a3efd110fc85380ece8191d.tar.gz
rails-ecb1981bfd3ffaca3a3efd110fc85380ece8191d.tar.bz2
rails-ecb1981bfd3ffaca3a3efd110fc85380ece8191d.zip
Template lookup now respect default locale and I18n fallbacks.
Given the following templates: mailer/demo.html.erb mailer/demo.en.html.erb mailer/demo.pt.html.erb Before this change for a locale that doesn't have its related file the `mailer/demo.html.erb` will be rendered even if `en` is the default locale. Now `mailer/demo.en.html.erb` has precedence over the file without locale. Also, it is possible to give a fallback. mailer/demo.pt.html.erb mailer/demo.pt-BR.html.erb So if the locale is `pt-PT`, `mailer/demo.pt.html.erb` will be rendered given the right I18n fallback configuration. Fixes #11884.
Diffstat (limited to 'actionview/lib/action_view/lookup_context.rb')
-rw-r--r--actionview/lib/action_view/lookup_context.rb9
1 files changed, 1 insertions, 8 deletions
diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb
index ea687d9cca..36855ec3d0 100644
--- a/actionview/lib/action_view/lookup_context.rb
+++ b/actionview/lib/action_view/lookup_context.rb
@@ -191,7 +191,6 @@ module ActionView
def initialize(view_paths, details = {}, prefixes = [])
@details, @details_key = {}, nil
- @skip_default_locale = false
@cache = true
@prefixes = prefixes
@rendered_format = nil
@@ -213,12 +212,6 @@ module ActionView
super(values)
end
- # Do not use the default locale on template lookup.
- def skip_default_locale!
- @skip_default_locale = true
- self.locale = nil
- end
-
# Override locale to return a symbol instead of array.
def locale
@details[:locale].first
@@ -233,7 +226,7 @@ module ActionView
config.locale = value
end
- super(@skip_default_locale ? I18n.locale : default_locale)
+ super(default_locale)
end
# Uses the first format in the formats array for layout lookup.