Installation workaround for i18n gem 0.3.5 on rails 2.3.4 not working

I am using the installation description on

where I have downloaded the gem into vendor/plugins/i18 and added the
following lines, as suggested, to an intitializer (i18n.rb):

def reload_i18n!
raise “Move to i18n version 0.2.0 or greater” if Rails.version >
“2.3.4”
$:.grep(/i18n/).each { |path| $:.delete(path) }
I18n::Backend.send :remove_const, “Simple”
$: << Rails.root.join(‘vendor’, ‘plugins’, ‘i18n’, ‘lib’).to_s
end
reload_i18n!

Then in the console I18n.t :hello would returns “Translation missing”

Unfortunately, due to other incompatibilities (Unicorn), I don’t want
to upgrade to rails 2.3.5.

P.S. Working on a plugin that offers a migration path from Globalize1
apps to I18n+Globalize2

Below I copied the installation instructions from

It does not work with either version of the i18n gem.

Any help to get the i18n gem work on rails 2.3.4 is highly
appreciated.

Kind regards,

Juergen


Installation on Rails < 2.3.5 (deprecated)
Up to version 2.3.4 Rails will not accept i18n gems > 0.1.3. There is
an unpacked
gem inside of active_support/lib/vendor which gets loaded unless gem
‘i18n’, ‘~> 0.1.3’.
This requirement is relaxed in 6da03653

The new i18n gem can be loaded from vendor/plugins like this:

def reload_i18n! raise “Move to i18n version 0.2.0 or greater” if
Rails.version > “2.3.4” $:.grep(/i18n/).each { |path|
$:.delete(path) } I18n::Backend.send :remove_const, “Simple” $: <<
Rails.root.join(‘vendor’, ‘plugins’, ‘i18n’, ‘lib’).to_s end
Then you can reload_i18n! inside an i18n initializer.

Hi Sven,

thanks for your quick reply. That is an option I had considered, but
was way too overconfident that the published code must have worked.

Anyway, all is good now, thanks again.

Kind regards,
Juergen

Juergen,

I’m not sure how this has made it into the readme, but … it might be
easier for you to just patch Rails here. You could just freeze Rails to
vendor/rails and apply some patch that changes these lines:

to match these:

After that Rails should pick up whatever I18n gem version you’ve
installed as long as it’s >= 0.1.3