aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/paths.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-01-25 22:50:02 -0600
committerJoshua Peek <josh@joshpeek.com>2009-01-25 22:51:21 -0600
commita98cd7ca9b2f24a4500963e58ba5c37d6bdf9259 (patch)
treed9c51d0de740f371c745a859afd043aa6f0b85a0 /actionpack/lib/action_view/paths.rb
parent5c062bf1000886d26b3a4c3b08dfb6618a4adcdf (diff)
downloadrails-a98cd7ca9b2f24a4500963e58ba5c37d6bdf9259.tar.gz
rails-a98cd7ca9b2f24a4500963e58ba5c37d6bdf9259.tar.bz2
rails-a98cd7ca9b2f24a4500963e58ba5c37d6bdf9259.zip
Add localized templates
# Default locale app/views/messages/index.html.erb # I18n.locale is set to :da (Danish) app/views/messages/index.da.html.erb
Diffstat (limited to 'actionpack/lib/action_view/paths.rb')
-rw-r--r--actionpack/lib/action_view/paths.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb
index 19207e7262..cb351620d2 100644
--- a/actionpack/lib/action_view/paths.rb
+++ b/actionpack/lib/action_view/paths.rb
@@ -37,7 +37,11 @@ module ActionView #:nodoc:
template_path = original_template_path.sub(/^\//, '')
each do |load_path|
- if format && (template = load_path["#{template_path}.#{format}"])
+ if format && (template = load_path["#{template_path}.#{I18n.locale}.#{format}"])
+ return template
+ elsif format && (template = load_path["#{template_path}.#{format}"])
+ return template
+ elsif template = load_path["#{template_path}.#{I18n.locale}"]
return template
elsif template = load_path[template_path]
return template