Localized views fallbacks

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.

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs