Templates Localization

Is an interest of Rails Core to have Localized Templates?

It would look for the locale set and try to load the template based on the locale. So rendering an action called index when locale is "fr", it would first search for the file "index.fr.html.erb". If it's not found, it will load the default "index.html.erb".

Then we could have different files for each locale:

index.fr.html.erb index.pt-br.html.erb index.it.html.erb

Another correlated feature is Localized Rescue, that would allow the same with 404.html e 500.html files on public dir.

I've been using and collaborating to a localization plugin called Simple Localization (http://simple-localization.arkanis.de/) where those features were implemented a long time ago and are working perfectly.

Complexity and performance won't be a problem since Rails cache templates filename in an array and we will just have to check for the locale filenames in the array.

I'm prone to implement such features and create tests if it's a main interest!

Regards!

José Valim.

http://josevalim.blogspot.com/

I'm prone to implement such features and create tests if it's a main interest!

I'm a little scared to add that for this release cycle. But we could investigate making sure it's easy for you to add it to the template locating code through a plugin? Before we added anything l10n related I'd want to let the new i18n stuff bake for a release or two.

Hey José,

over at rails-i18n [1] we definitely have an interest in this feature.
We just haven't had any time to investigate that, yet.

It's kind of on our list for the next "I18n'ize Rails dev cycle",
which would involve implementing the feature as a plugin first, have
it battle-tested and then finally look at it in the context of other
or related solutions (if any) and _maybe_ get a core patch ready.

So, it would be awesome if you'd register. We'd certainly help out if
we can.

[1] http://groups.google.com/group/rails-i18n