Reputation: 21577
haven't found anything about localized views in rails3. what do i need to get views like
index.en.html.erb
index.de.html.erb
working? how to set the routes?
thanks!
Upvotes: 1
Views: 828
Reputation: 27961
Your own settings in your config/application.rb
file will provide the default locale (it's en
if not set, so that index.en.html.erb
view will already work right now).
The only thing you need to do is to provide some mechanism for your users to select/change their locale, either something manual that the user triggers eg. a link on your pages that allows them to change languages or something more automatic, eg. the user's language preferences in their profile/session or something like that.
Either way, I strongly recommend using a subdomain - it's simple to set up, stays put once you've set it up, and allows a user to send their own language link to others without having to do anything special.
Check the Rails Guides, for more on how to do this.
Upvotes: 1