i'm trying internacionalize application made devise, i'm struggling in points. i've installe i18n gem , created devise.pt-br.yml
file , wrote inside application.rb
config.i18n.default_locale = :'pt-br'
ok, when try inside application, following error message:
undefined method `default_locale=' nil:nilclass
rails.root: /home/ubuntu/workspace/aqueleprojetoprivate/medicos application trace | framework trace | full trace
app/controllers/application_controller.rb:8:in
<class:applicationcontroller>' app/controllers/application_controller.rb:1:in
' activesupport (4.2.4) lib/active_support/dependencies.rb:457:inload' activesupport (4.2.4) lib/active_support/dependencies.rb:457:in
block in load_file' activesupport (4.2.4) lib/active_support/dependencies.rb:647:innew_constants_in' activesupport (4.2.4) lib/active_support/dependencies.rb:456:in
load_file' activesupport (4.2.4) lib/active_support/dependencies.rb:354:inrequire_or_load' activesupport (4.2.4) lib/active_support/dependencies.rb:494:in
load_missing_constant' activesupport (4.2.4) lib/active_support/dependencies.rb:184:inconst_missing' app/controllers/home_controller.rb:1:in
' activesupport (4.2.4) lib/active_support/dependencies.rb:457:inload' activesupport (4.2.4) lib/active_support/dependencies.rb:457:in
block in load_file' activesupport (4.2.4) lib/active_support/dependencies.rb:647:innew_constants_in' activesupport (4.2.4) lib/active_support/dependencies.rb:456:in
load_file' activesupport (4.2.4) lib/active_support/dependencies.rb:354:inrequire_or_load' activesupport (4.2.4) lib/active_support/dependencies.rb:494:in
load_missing_constant' activesupport (4.2.4) lib/active_support/dependencies.rb:184:inconst_missing' activesupport (4.2.4) lib/active_support/inflector/methods.rb:261:in
const_get' activesupport (4.2.4) lib/active_support/inflector/methods.rb:261:inblock in constantize' activesupport (4.2.4) lib/active_support/inflector/methods.rb:259:in
each' activesupport (4.2.4) lib/active_support/inflector/methods.rb:259:ininject' activesupport (4.2.4) lib/active_support/inflector/methods.rb:259:in
constantize' activesupport (4.2.4) lib/active_support/dependencies.rb:566:inget' activesupport (4.2.4) lib/active_support/dependencies.rb:597:in
constantize' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:72:incontroller_reference' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:62:in
controller' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:41:inserve' actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in
block in serve' actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:ineach' actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in
serve' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:incall' warden (1.2.4) lib/warden/manager.rb:35:in
block in call' warden (1.2.4) lib/warden/manager.rb:34:incatch' warden (1.2.4) lib/warden/manager.rb:34:in
call' rack (1.6.4) lib/rack/etag.rb:24:incall' rack (1.6.4) lib/rack/conditionalget.rb:25:in
call' rack (1.6.4) lib/rack/head.rb:13:incall' actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in
call' actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:incall' rack (1.6.4) lib/rack/session/abstract/id.rb:225:in
context' rack (1.6.4) lib/rack/session/abstract/id.rb:220:incall' actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in
call' activerecord (4.2.4) lib/active_record/query_cache.rb:36:incall' activerecord (4.2.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in
call' activerecord (4.2.4) lib/active_record/migration.rb:377:incall' actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in
block in call' activesupport (4.2.4) lib/active_support/callbacks.rb:88:in__run_callbacks__' activesupport (4.2.4) lib/active_support/callbacks.rb:778:in
_run_call_callbacks' activesupport (4.2.4) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in
call' actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:incall' actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in
call' actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:incall' web-console (2.2.1) lib/web_console/middleware.rb:31:in
call' actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:incall' railties (4.2.4) lib/rails/rack/logger.rb:38:in
call_app' railties (4.2.4) lib/rails/rack/logger.rb:20:inblock in call' activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in
block in tagged' activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:intagged' activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in
tagged' railties (4.2.4) lib/rails/rack/logger.rb:20:incall' actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in
call' rack (1.6.4) lib/rack/methodoverride.rb:22:incall' rack (1.6.4) lib/rack/runtime.rb:18:in
call' activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall' rack (1.6.4) lib/rack/lock.rb:17:in
call' actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:incall' rack (1.6.4) lib/rack/sendfile.rb:113:in
call' railties (4.2.4) lib/rails/engine.rb:518:incall' railties (4.2.4) lib/rails/application.rb:165:in
call' rack (1.6.4) lib/rack/lock.rb:17:incall' rack (1.6.4) lib/rack/content_length.rb:15:in
call' rack (1.6.4) lib/rack/handler/webrick.rb:88:inservice' /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:138:in
service' /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:94:inrun' /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:294:in
block in start_thread'
how fix it?
it looks rails version 4.2.
if case, should not use config.i18n
i18n
.
see here:
# in config/initializers/locale.rb # tell i18n library find translations i18n.load_path += dir[rails.root.join('lib', 'locale', '*.{rb,yml}')] # set default locale other :en i18n.default_locale = :pt
Comments
Post a Comment