This project is archived and is in readonly mode.

#6411 open
Ola Tuvesson

i18n fallback doesn't work for localized views

Reported by Ola Tuvesson | February 11th, 2011 @ 09:30 AM

Given that I have set i18n to fall back (e.g. from "fr-Fr" to just "fr"):

I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)

And I have created a localized view (e.g. /help/

When i18n locale is set to "fr-FR", then the localized view is not found - yet the language file fr.yml is found.

Can I monkey patch this somehow?

Comments and changes to this ticket

  • Ola Tuvesson

    Ola Tuvesson February 12th, 2011 @ 05:54 AM

    Could someone at least confirm if this is the expected behaviour or not?

  • Josh Kalderimis

    Josh Kalderimis February 13th, 2011 @ 02:13 PM

    • Tag changed from i18n fallbacks views to action_pack, action_view, i18n
    • Assigned user set to “Josh Kalderimis”
    • Importance changed from “” to “Low”

    Hi Ola,

    I have spoken to José about this issue and it does seem to be a bug when using I18n Fallbacks.

    Thanks for reporting the issue, I will take a look at creating a patch for master this week.



  • Ola Tuvesson

    Ola Tuvesson February 13th, 2011 @ 04:11 PM

    • Assigned user cleared.

    Thanks Josh! I need this as I'm working on a site which is available in both France and Canada, as well as in French language in other countries. So I en up with lots of language-country combinations; fr-FR, fr-CA, fr-CH, fr-UK - I really don't want to have separate help files for all of them!

  • Ola Tuvesson

    Ola Tuvesson February 13th, 2011 @ 05:49 PM

    • Assigned user set to “Josh Kalderimis”
  • Ola Tuvesson

    Ola Tuvesson February 17th, 2011 @ 12:51 PM

    While waiting for this to be patched, does anyone have any suggestions how I might implement a temporary fix for this? I need to do a new release of my project within the next day or so and this has to include the help pages.

  • Josh Kalderimis

    Josh Kalderimis February 17th, 2011 @ 12:57 PM

    • State changed from “new” to “open”

    Hey Ola,

    Sorry for the delay, is eating up my time. I have one patch I need to attend to first, then this one.

    The temp fix could be to check if the file exists and render it if it does, otherwise strip off the country portion. This is a hack and ugly controller code, but it should work.



  • Ola Tuvesson

    Ola Tuvesson February 18th, 2011 @ 09:22 AM

    Thanks, that makes sense. But I was wondering which method it is I need to override? I've been digging around in the ActionView source, PathResolver and other places but I can't seem to locate the relevant locale based view lookup - though admittedly I'm not very well traveled in the Rails source. Could you drop me a hint?



  • Ola Tuvesson

    Ola Tuvesson February 18th, 2011 @ 10:23 AM

    For example, putting this in an initializer does not give me the German help view:

    module ActionView
    class LookupContex

    module Details
      def locale

    end end

  • Ola Tuvesson

    Ola Tuvesson March 3rd, 2011 @ 05:13 PM

    Any thoughts on this, anyone?

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>