运行rails 2.0.0时出错。 "德"不是有效的区域设置(I18n :: InvalidLocale)

时间:2015-04-02 09:38:45

标签: ruby-on-rails ruby ruby-on-rails-3

何在一起,

我在utf8和ascii方面遇到了一些问题,如果是这样的话,我试图从ruby 1.9.3更新到ruby 2.0.0

虽然有效,但现在当我想启动我的应用程序时,我收到了这个错误:

/home/felix/.rvm/gems/ruby-2.0.0-p643/gems/i18n-0.7.0/lib/i18n.rb:284:in `enforce_available_locales!': :"de-DE" is not a valid locale (I18n::InvalidLocale)
    from /home/felix/.rvm/gems/ruby-2.0.0-p643/gems/i18n-0.7.0/lib/i18n/config.rb:34:in `default_locale='
    from /home/felix/.rvm/gems/ruby-2.0.0-p643/gems/i18n-0.7.0/lib/i18n.rb:35:in `default_locale='
    from /var/www/xyz/xyz/config/application.rb:79:in `<top (required)>'
    from /home/felix/.rvm/gems/ruby-2.0.0-p643/gems/railties-3.2.12/lib/rails/commands.rb:53:in `require'
    from /home/felix/.rvm/gems/ruby-2.0.0-p643/gems/railties-3.2.12/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /home/felix/.rvm/gems/ruby-2.0.0-p643/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
    from /home/felix/.rvm/gems/ruby-2.0.0-p643/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我已经设置了

default_locale: de 

在settings.yml

出了什么问题?我该如何解决?我在debian 7和rails 3.2.12下运行

2 个答案:

答案 0 :(得分:1)

你可以尝试一下:

config.i18n.enforce_available_locales = false
config.i18n.available_locales = ["de_DE", :en]
config.i18n.default_locale = :'de_DE'

请告诉我这是否有帮助?

答案 1 :(得分:0)

尝试将版本降级为 - &gt;在gemfile上创建gem'i18n','0.6.0',然后运行'bundle update i18n'