我正在尝试设置tolk来源: http://github.com/dhh/tolk
我正处于跑步的地步:
$ rake tolk:sync
和
$ rake tolk:import
但两者都不会起作用。我收到以下错误
~/Rails/appname: rake tolk:sync --trace
(in /Users/username/Rails/appname)
** Invoke tolk:sync (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute tolk:sync
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
/Users/username/Rails/appname/vendor/plugins/tolk/lib/tolk/sync.rb:24:in `flat_hash'
/Users/username/Rails/appname/vendor/plugins/tolk/lib/tolk/sync.rb:14:in `load_translations'
/Users/username/Rails/appname/vendor/plugins/tolk/lib/tolk/sync.rb:9:in `sync!'
/Users/username/Rails/appname/vendor/plugins/tolk/tasks/tolk_tasks.rake:4
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19
我有一个部分填充的en,fr和另一个misc语言环境文件,但它似乎无法导入或同步。任何建议将不胜感激。
答案 0 :(得分:0)
之前的教程让我创建了一个'pt'的默认语言环境,并对其进行了更正:
config / initializer / locale.rb 中的
告诉I18n图书馆在哪里找到您的翻译 如果您对英语作为默认语言环境感到满意,可以省略此项I18n.load_path += Dir[ File.join(RAILS_ROOT, 'lib', 'locale', '*.{rb,yml}') ]
I18n.default_locale = "pt-BR" #changed to 'en'