0

Is it possible to switch off I18n/Globalize3 fallbacks per Rails model basis? I.e. some models use fallback, some don't.

1 Answers1

1

Yes, it is possible by overriding the globalize_fallbacks method in your model. Take for example a post model with translated title and content:

class Post < ActiveRecord::Base

  translates :title, :content

  # Disable fallbacks for this model
  def globalize_fallbacks(locale)
    [locale]
  end

end

You simply specify that the requested locale can only fallback to itself, no matter what is defined in your global configuration.

lawitschka
  • 745
  • 3
  • 9