Forum: Rails I18n Localized views fallbacks

8eb5c03e6d9821dea136041a4a78af47?d=identicon&s=25 djhunx (Guest)
on 2011-01-19 10:55
(Received via mailing list)
I am using Rails 2.3.8 and have setup in config/initializers/i18n.rb

I18n.backend.class.send(:include, I18n::Backend::Fallbacks)
I18n.fallbacks.map(:tc => [:sc, :en])

so that if there is no translation in tc, the sc translation is used.

Text translations works ok.

I was kind of expecting the same thing should apply to views. For
example, in the index action,  if the current locale is 'tc' and
index.tc.html.erb does not exist, the application should use
index.sc.html.erb if it is present. But currently it falls back to
index.en.html.erb or index.html.erb because my default_locale is en.

Does anybody experience the same thing? Or is there something I am
doing wrong.
47a10d1d0d09b5a2f6c4444c55cfe41d?d=identicon&s=25 Andrew Porter (Guest)
on 2011-03-15 20:52
(Received via mailing list)
Same thing, here. I want to use I18n not only for translation, but for
a degree of content management, as well. For example, I have three
product lines that are sold in the US and Canada, but only one product
line that is sold in Europe, and two product lines that are sold in
Asia and the Pacific Rim.

So I need the views to follow a fallback chain as well as the YAML
files (i.e., [:"es-ES", :es, :"en-GB", :en] or [:"fr-BE", :fr, :"en-
GB", :en]--sending all european locales through :"en-GB" before
defaulting to :en, etc.).

How do I configure a custom fallback chain, and how do I get the views
to follow that fallback chain?

Using Rails 3.0.4 and I18n 0.5.0.
This topic is locked and can not be replied to.