2012-09-05 128 views
0

錯誤,開始當我試圖啓動控制檯,我得到Rails的控制檯從失敗的I18n

/home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n/backend/base.rb:158:in `load_file': can not load translations from /var/www/railsapp/config/locales/ru.yml, expected it to return a hash, but does not (I18n::InvalidLocaleData) 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n/backend/base.rb:15:in `block in load_translations' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n/backend/base.rb:15:in `each' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n/backend/base.rb:15:in `load_translations' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n/backend/simple.rb:57:in `init_translations' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n/backend/simple.rb:71:in `lookup' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n/backend/base.rb:26:in `translate' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n.rb:156:in `block in translate' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n.rb:152:in `catch' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/i18n-0.6.1/lib/i18n.rb:152:in `translate' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.1.0/lib/active_record/railtie.rb:102:in `block in <class:Railtie>' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:34:in `call' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:42:in `each' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `block in run_initializers' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing' 
from /var/www/railsapp/config/environment.rb:6:in `<top (required)>' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/application.rb:78:in `require' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/application.rb:78:in `require_environment!' 
from /home/username/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/commands.rb:39:in `<top (required)>' 
from script/rails:6:in `require' 
from script/rails:6:in `<main>' 

我的應用程序工作正常,唯一的控制檯不啓動。 可能是這個問題與從第二個rails版本升級有關。但是一年來它一直很好。

我ru.yml:

ru: 
activerecord: 
    attributes: 
    user: 
    password: "Пароль" 
    login: "Имя пользователя" 
    password_confirmation: "Повтор пороля" 
    models: 
    user: "пользователь" 

這是一個FANTOM錯誤。從ru.yml刪除評論後,一切正常。

+4

yml文件的格式是否正確?我不知道它是否重要,但我在rails 3中使用的yml文件有2個空格縮進,看起來像你的空間縮進。 – agmcleod

+0

我正在使用標籤並更改爲2空間縮進爲我工作 – jmosesman

回答

0

ru.yml似乎並不正確,你可能需要一個雙空格縮進,軌道不看你的翻譯爲散列,嘗試改變你的陽明使用兩個空格。