微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails-3 – 未在Rails 3.1.3中设置默认语言环境

没有在Rails 3.1.3中设置default_locale

application.rb中:

config.i18n.default_locale = :en

我有3个语言环境(en,es和ca)
当我去我的控制台时:

I18n.locale => :ca # I guess the first one in the array

我正在使用Gettext.有人知道它可能是什么?

束:

Using rake (0.9.2.2) 
Using Ascii85 (1.0.1) 
Using ZenTest (4.5.0) 
Using multi_json (1.0.4) 
Using activesupport (3.1.3) 
Using builder (3.0.0) 
Using i18n (0.6.0) 
Using activemodel (3.1.3) 
Using erubis (2.7.0) 
Using rack (1.3.6) 
Using rack-cache (1.1) 
Using rack-mount (0.8.3) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.0.3) 
Using actionpack (3.1.3) 
Using mime-types (1.17.2) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.3.0) 
Using actionmailer (3.1.3) 
Using arel (2.2.1) 
Using tzinfo (0.3.31) 
Using activerecord (3.1.3) 
Using activeresource (3.1.3) 
Using addressable (2.2.6) 
Using adyen (1.3.0) 
Using airbrake (3.0.5) 
Using ansi (1.3.0) 
Using autotest (4.4.6) 
Using xml-simple (1.1.1) 
Using aws-ses (0.4.4) 
Using bcrypt-ruby (3.0.1) 
Using bluecloth (2.2.0) 
Using bulksms (0.5.2) 
Using bundler (1.0.21) 
Using highline (1.6.2) 
Using net-ssh (2.2.1) 
Using net-scp (1.0.4) 
Using net-sftp (2.0.5) 
Using net-ssh-gateway (1.1.0) 
Using capistrano (2.9.0) 
Using capistrano-ext (1.2.1) 
Using nokogiri (1.5.0) 
Using ffi (1.0.9) 
Using childprocess (0.2.2) 
Using json_pure (1.6.1) 
Using rubyzip (0.9.4) 
Using selenium-webdriver (2.8.0) 
Using xpath (0.1.4) 
Using capybara (1.1.1) 
Using carrierwave (0.5.8) 
Using chunky_png (1.2.5) 
Using coffee-script-source (1.1.2) 
Using execjs (1.2.9) 
Using coffee-script (2.2.0) 
Using fssm (0.2.7) 
Using sass (3.1.10) 
Using compass (0.12.alpha.0) 
Using compass-960-plugin (0.10.4) 
Using rest-client (1.6.7) 
Using couchrest (1.1.2) 
Using couchrest_model (1.1.2) 
Using daemons (1.0.10) 
Using diff-lcs (1.1.3) 
Using e164 (0.3.1) 
Using excon (0.7.12) 
Using factory_girl (2.3.0) 
Using rack-ssl (1.3.2) 
Using json (1.6.5) 
Using rdoc (3.12) 
Using thor (0.14.6) 
Using railties (3.1.3) 
Using factory_girl_rails (1.4.0) 
Using multipart-post (1.1.3) 
Using faraday (0.7.5) 
Using faraday_middleware (0.7.0) 
Using fast_gettext (0.6.2) 
Using formatador (0.2.1) 
Using ruby-hmac (0.4.0) 
Using fog (1.1.1) 
Using rails (3.1.3) 
Using formtastic (2.0.0.rc5) 
Using gem_plugin (0.2.3) 
Using geocoder (1.1.0) 
Using geokit (1.6.0) 
Using locale (2.0.5) 
Using gettext (2.1.0) 
Using gettext_i18n_rails (0.3.0) 
Using gravatar (1.0) 
Using guard (1.0.0) 
Using guard-rspec (0.6.0) 
Using haml (3.1.4) 
Using haml-rails (0.3.4) 
Using hashie (1.1.0) 
Using jquery-rails (1.0.17) 
Using kaminari (0.12.4) 
Using kgio (2.6.0) 
Using launchy (2.0.5) 
Using libv8 (3.3.10.2) 
Using Metaclass (0.0.1) 
Using subexec (0.1.0) 
Using mini_magick (3.3) 
Using mocha (0.10.0) 
Using money (4.0.1) 
Using mongrel (1.2.0.pre2) 
Using multi_xml (0.4.1) 
Using nifty-generators (0.4.6) 
Using ruby-rc4 (0.1.3) 
Using pdf-reader (1.0.0) 
Using ttfunk (1.0.3) 
Using prawn (0.12.0) 
Using rack-protection (1.1.4) 
Using raindrops (0.8.0) 
Using redis (2.2.2) 
Using redis-namespace (1.0.3) 
Using sinatra (1.3.1) 
Using vegas (0.1.8) 
Using resque (1.19.0) 
Using resque_mailer (2.0.2) 
Using rspec-core (2.8.0) 
Using rspec-expectations (2.8.0) 
Using rspec-mocks (2.8.0) 
Using rspec (2.8.0) 
Using rspec-rails (2.8.1) 
Using ruby-ole (1.2.11.2) 
Using sexp_processor (3.0.7) 
Using ruby_parser (2.3.1) 
Using sass-rails (3.1.5) 
Using simple_oauth (0.1.5) 
Using spreadsheet (0.6.5.9) 
Using state_machine (1.0.2) 
Using steak (2.0.0) 
Using therubyracer (0.9.8) 
Using turn (0.8.3) 
Using twitter (1.7.2) 
Using uglifier (1.0.3) 
Using unicorn (4.1.1) 
Using useragent (0.4.6)

解决方法

添加到application.rb这一行config.i18n.locale =:ca和Rails将设置认语言环境.它在生产服务器上为我工作,但我设置:ru locale

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐