# Separating views by locale?

**URL:** <https://www.ruby-forum.com/t/separating-views-by-locale/157741>\
**Category:** Rails\
**Created:** [January 14, 2009, 10:55pm UTC](https://www.ruby-forum.com/t/separating-views-by-locale/157741 "2009-01-14T22:55:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmorin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@dmorin](https://www.ruby-forum.com/u/dmorin)\
**Post date:** [January 14, 2009, 10:55pm UTC](https://www.ruby-forum.com/t/separating-views-by-locale/157741/1 "2009-01-14T22:55:11Z")

</div>

I’m thinking this has to be a common question, but thus far I haven’t  
found it, maybe somebody can point me in the right direction.

If I’ve got a controller Foo, and a page views/foo/index.rhtml, and I  
want to handle multiple languages, I’m thinking that one way to go would  
be to create views/foo/en/index.rhtml, views/foo/fr/index.rhtml, … and  
so on for each supported locale. Then instead of the default:  
def index  
render :action=\>:index  
end

I could do something like this:  
def index  
render :action=\>"#{locale}/index"  
end

Question 1 is, would that work? I’m hacking on the code now so I’m sure  
I’ll find out in two minutes.

Question 2 is, assuming that this does work, what would be the best way  
to chain in at a higher level so I didn’t have to do this for every  
single method of every controller? I’m reading the docs on  
ActionController and ActionView but not seeing any obvious places.

Please note that I am already in the process of doing string  
externalization into config/locales/fr.yml and so on. I’m just  
exploring this different strategy for situations where I’ve got  
substantial blocks of content in the views that might be better served  
with a clone of the entire page.
