views:

499

answers:

2

So that's the problem. In my application globalize2 returns a NIL string if there's no translation on some record, instead of falling back to default_locale. I wonder how to enable thin functionality? Does anyone figured that out?

+3  A: 

Install sven fuchs's i18n library from http://github.com/svenfuchs/i18n

Then, in your environment.rb :

require "i18n/backend/fallbacks" 
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)

using :"en-US" as a default locale:

I18n.default_locale = :"en-US" 
I18n.fallbacks[:ca] # => [:ca, :"en-US", :en]
I18n.fallbacks :dk => [:"se-FI", :"fi-FI"] # => [:dk, :"se-FI", :se, :"fi-FI", :fi, :"en-US", :en]
Joris
Thanks man, but I ran into some problems using thin plugin I18n. But your answer is correct.
Filip
A: 

This worked for me (i18n gem version 0.4x didn't work).

# config/environment.rb
config.gem 'i18n', :version => '0.3.7'

# config/initializers/i18n.rb
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
Zubin