宝石文件:
gem 'spree', '1.2.0' #:git => 'git://github.com/spree/spree.git'
gem 'spree_auth_devise', :git => 'git://github.com/spree/spree_auth_devise'
# original repository not compatible at the moment, use fork
# gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git'
gem 'spree_i18n', :git => 'git://github.com/kares/spree_i18n.git'
应用程序.rb:
config.i18n.default_locale = :de
Spree.rb:(初始化器)
Spree.config do |config|
...
config.default_locale = "de"
end
还有什么:
- 我已将所有可能的语言 yml 文件复制到 app/config/locale
- 我已经跑了“
rake spree_i18n:update_default
” - 我已经跑了“
rake spree_i18n:sync
”
错误:
$ rails s
=> Booting WEBrick
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server Exiting c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/base.rb:158:in ` load_file': can not load translations from c:/Ruby193/lib/ruby/gems/1.9.1/bundle r/gems/spree_i18n-d0ce127166d0/config/locales/cs-CZ.yml, expected it to return a hash, but does not (I18n::InvalidLocaleData)
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/bas e.rb:15:in `block in load_translations'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/bas e.rb:15:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/bas e.rb:15:in `load_translations'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/sim ple.rb:57:in `init_translations'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/sim ple.rb:71:in `lookup'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n/backend/bas e.rb:26:in `translate'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n.rb:156:in ` block in translate'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n.rb:152:in ` catch'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-0.6.1/lib/i18n.rb:152:in ` translate'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/devise-2.0.4/lib/devise/rails.r b:99:in `block (2 levels) in <class:Engine>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_ support/lazy_load_hooks.rb:34:in `call'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_ support/lazy_load_hooks.rb:34:in `execute_hook'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_ support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_ support/lazy_load_hooks.rb:42:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_ support/lazy_load_hooks.rb:42:in `run_load_hooks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/applic ation/finisher.rb:59:in `block in <module:Finisher>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initia lizable.rb:30:in `instance_exec'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initia lizable.rb:30:in `run'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initia lizable.rb:55:in `block in run_initializers'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initia lizable.rb:54:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initia lizable.rb:54:in `run_initializers'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/applic ation.rb:136:in `initialize!'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/railti e/configurable.rb:30:in `method_missing'
from c:/RoRDev/dip/config/environment.rb:5:in `<top (required)>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/polyglot-0.3.3/lib/polyglot.rb: 63:in `require'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/polyglot-0.3.3/lib/polyglot.rb: 63:in `require'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_ support/dependencies.rb:251:in `block in require'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_ support/dependencies.rb:236:in `load_dependency'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_ support/dependencies.rb:251:in `require'
from c:/RoRDev/dip/config.ru:4:in `block in <main>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb: 51:in `instance_eval'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb: 51:in `initialize'
from c:/RoRDev/dip/config.ru:1:in `new'
from c:/RoRDev/dip/config.ru:1:in `<main>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb: 40:in `eval'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb: 40:in `parse_file'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:2 00:in `app'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/comman ds/server.rb:46:in `app'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:3 01:in `wrapped_app'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:2 52:in `start'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/comman ds/server.rb:70:in `start'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/comman ds.rb:55:in `block in <top (required)>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/comman ds.rb:50:in `tap'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/comman ds.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
问题:
- 他为什么要寻找 cs-CZ.yml?
- 为什么他不能加载翻译?cs-CZ.yml 文件存在于 app/config/locale 下