From 897671c2fdfb4093422352d8cab774cf8e9f2b8d Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Sat, 9 May 2009 14:37:48 -0700 Subject: [PATCH] Adding forced-load of I18n to ensure translations are loaded before models. Thanks to Dr Mark Lane --- README.textile | 1 + rails/init.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.textile b/README.textile index 3097a5579..a2ebe9dc7 100644 --- a/README.textile +++ b/README.textile @@ -121,3 +121,4 @@ Since I first released this library, there's been quite a few people who have su * Max Lapshin * Martin Emde * David Wennergren +* Mark Lane diff --git a/rails/init.rb b/rails/init.rb index 82ea0eecc..5e6fb2685 100644 --- a/rails/init.rb +++ b/rails/init.rb @@ -2,5 +2,13 @@ require 'action_controller/dispatcher' ActionController::Dispatcher.to_prepare :thinking_sphinx do + # Force internationalisation to be loaded. + if Rails::VERSION::STRING.to_f > 2.2 + I18n.backend.reload! + I18n.backend.available_locales + elsif Rails::VERSION::STRING.to_f > 2.1 + I18n.backend.load_translations(*I18n.load_path) + end + ThinkingSphinx::Configuration.instance.load_models end