Hi guys,
I just saw that localized templates is now part of rails core (http://
github.com/rails/rails/commit/
a98cd7ca9b2f24a4500963e58ba5c37d6bdf9259). But I would like to discuss
how it was implemented.
I'm the maintainer of Localized Templates plugin (
http://github.com/
josevalim/localized_templates/) and before implement it we had a
discussion on I18n group how it should work.
The first version of Localized Templates had the same "schema" as in
Rails core. Assuming MessagesController, index action and locale pt-
BR, our localized file would be:
app/views/messages/index.pt-BR.html.erb (controller/action.locale)
But the suggestions in I18n group defined a schema like this:
app/views/pt-BR/messages/index.html.erb (locale/controller/
action)
I already worked with both schemas and I personally think that "locale/
controller/action" is much better. I've talked with 5 or 6 other
people that were also using Localized Templates and they all had the
same point of view.
There are two main reasons:
1. It's easier to translate: in "locale/controller/action" schema,
to create a new language we just have to copy and paste the locale
root and start to translate. When using Rails current schema, we have
to go in each controller folder and rename all files... at the end I
was seriously thinking in developing a rake task that could do it for
me.
2. It's easier to mantain: in Rails current schema we usually end up
with our controllers folders full of files (4 locales x 4 files = 16
files). In the second schema everything is organized by locale roots.
Anyway, I brought this discussion to know what people think about both
schemas and which one would be the best for Rails core.
Well, that's all. :)
Cheers,
José Valim.