让 Rails 2.3.x 忽略 i18n gem

发布于 2024-09-03 20:49:35 字数 535 浏览 1 评论 0原文

我有一个 Rails 2.3.5 项目,它使用 Rails 的本地化功能。我也碰巧安装了 Rails 3 beta(这取决于 i18n gem)。 Rails 2.3.5 很乐意自行处理本地化(无需安装 i18n),但是如果 i18n gem 可用,它就会使用它。

最近我升级了 gems,现在安装了 i18n 0.3.7 和 0.4.0 版本。当然,Rails 想要加载并使用最新版本,这导致我的项目出现错误。我尝试将 gem 版本设置为 0.3.7,这可以解决网络应用程序中的错误。但是,我们使用 resque 和 resque_mailer 来延迟消息的发送。当工作人员从队列中获取邮件程序作业时,它会忽略environment.rb 中的 config.gem 要求并使用 0.4.0 版本。

理想情况下,我想告诉 Rails 根本不要使用 i18n gem。我该怎么做?

更新:从 beta 4 开始,Rails 3 现在需要 i18n 版本 0.4.1。我不明白有多少人没有遇到这个问题,因为现在看来,如果您同时安装了 Rails 2 和 Rails 3,您就会遇到这个问题。

I have a Rails 2.3.5 project that uses the localization features of Rails. I also happen to have Rails 3 beta installed (which depends on the i18n gem). Rails 2.3.5 will happily handle localization on it's own (without i18n installed), however if the i18n gem is available, it makes use of it.

Recently I upgraded my gems and now have version 0.3.7 and 0.4.0 of i18n installed. Rails, of course, wants to load and use the latest version which is causing errors in my project. I tried setting the gem version to 0.3.7 which gets around the errors in the web app. However, we're using resque and resque_mailer to delay the sending of messages. When the worker picks up the mailer job from the queue, it ignores my config.gem requirement in environment.rb and uses version 0.4.0 anyway.

Ideally, I'd like to tell Rails to just not use the i18n gem at all. How do I do that?

Update: As of beta 4, Rails 3 now requires i18n version 0.4.1. I don't see how more people aren't running into this problem as it would seem now if you have both Rails 2 and Rails 3 installed, you're going to run into this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

残疾 2024-09-10 20:49:35

我按照此处定义的说明进行操作:

http://gembundler.com/rails23.html

并且它有效。

I followed instructions as defined here:

http://gembundler.com/rails23.html

and it worked.

笑红尘 2024-09-10 20:49:35

您可以使用 Bundler 或 RVM 的 Gemsets 使 i18n gem 在您的应用程序中不可用。或者您可以升级您的 Rails 应用程序。

You could use Bundler or RVM's Gemsets to make the i18n gem unavailable from within your app. Or you could upgrade your Rails app.

带刺的爱情 2024-09-10 20:49:35
  1. 冻结rails版本:rake VERSION=2.3.5rails:freeze:gems
  2. 将文件vendor/rails/activesupport/lib/active_support/vendor.rb第24行中的版本修复为:gem 'i18n', '>= 0.1.3', '< 0.4.0'
  1. Freeze the rails version: rake VERSION=2.3.5 rails:freeze:gems
  2. Fix the version in the file vendor/rails/activesupport/lib/active_support/vendor.rb line 24 to: gem 'i18n', '>= 0.1.3', '< 0.4.0'
极度宠爱 2024-09-10 20:49:35

或者只需编辑: /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/vendor.rb

并将 gem 'i18n', '>; = 0.1.3'

进入gem 'i18n', '0.1.3'

Or just edit: /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/vendor.rb

And turn gem 'i18n', '>= 0.1.3'

Into gem 'i18n', '0.1.3'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文