Rails 3 和 Gettext (fast_gettext) 非常奇怪,未定义方法“add”;对于字符串
我在 Mac OS 上运行 Rails 3.1.1 和 ruby 1.9.2,刚刚启动了一个新项目,我想在其中使用 gettext 进行翻译。
我遵循此处描述的使用 fast_gettext 时的每一个步骤: https://github.com/grosser/gettext_i18n_rails
安装并一切正常。但是,当我尝试 rake gettext:find 时,我收到此错误消息:
$ bundle exec rake gettext:find
rake aborted!
undefined method `add' for "/Users/Olaf/.rvm/gems/ruby-1.9.2-p0":String
Tasks: TOP => gettext:find
在执行任何类型的 rake 任务时,我还必须使用bundle exec,我遇到了此处描述的问题:
也许这是相关的。
有谁知道发生了什么事吗?我有点绝望,坐在这里几个小时试图弄清楚。谷歌没有提供任何提示。
谢谢! 奥拉夫
I'm running on Rails 3.1.1 and ruby 1.9.2 on Mac OS and just started a new project where I want to use gettext for translations.
I followed every step when using fast_gettext described here: https://github.com/grosser/gettext_i18n_rails
The installation and everything works find. But when I try to rake gettext:find I get this error message:
$ bundle exec rake gettext:find
rake aborted!
undefined method `add' for "/Users/Olaf/.rvm/gems/ruby-1.9.2-p0":String
Tasks: TOP => gettext:find
I also have to use bundle exec when performing any kind of rake task, I have the problem described here:
Maybe that is related.
Has anyone an idea what is going on? I'm a bit desperate, sitting here since hours trying to figure it out. Google doesn't deliver any hints.
Thanks!
Olaf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有类似的问题。我相信这可以归结为
gettext
和更新版本的 RubyGems (1.8+) 之间的不兼容性。有一个解决此问题的拉取请求,但不幸的是它尚未合并。同时,您可以尝试将 fork(以及解决问题的提交)添加为 Gemfile 中的依赖项:
I was having similar issues. I believe it comes down to an incompatibility between
gettext
and more recent versions of RubyGems (1.8+). There is a pull request that addresses this issue, but unfortunately it hasn't been merged yet.In the meantime you can try adding the fork (and the commit that resolves the issue) as a dependency in your Gemfile:
安装
gem 'gettext', '>=3.0.2'
正如在 https://github.com 上指定的那样/grosser/gettext_i18n_rails#可选
Install
gem 'gettext', '>=3.0.2'
As it is specified on https://github.com/grosser/gettext_i18n_rails#optional