user3334278
user3334278

Reputation: 15

:en is not a valid locale when running "rails generate ims_lti:install"

I'm pretty inexperienced with both stackoverflow and Ruby. Please help me to help you to help me.

I'm trying to implement ims-lti in an open source Rails application. When I run rails generate ims_lti:install I get the following error.

/usr/local/rvm/gems/ruby-2.4.10/gems/i18n-0.9.5/lib/i18n.rb:295:in `enforce_available_locales!': :en is not a valid locale (I18n::InvalidLocale)
    from /usr/local/rvm/gems/ruby-2.4.10/gems/i18n-0.9.5/lib/i18n.rb:163:in `translate'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/activesupport-5.1.6/lib/active_support/core_ext/array/conversions.rb:68:in `to_sentence'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/railties-5.1.6/lib/rails/generators.rb:274:in `invoke'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/railties-5.1.6/lib/rails/commands/generate/generate_command.rb:24:in `perform'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/railties-5.1.6/lib/rails/command/base.rb:63:in `perform'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/railties-5.1.6/lib/rails/command.rb:44:in `invoke'
    from /usr/local/rvm/gems/ruby-2.4.10/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Here is what already existed in config/application.rb and presumably works fine because this is an application used daily at several universities.

 module Recaptcha
  class Application < Rails::Application
   # Settings in config/environments/* take precedence over those specified here.
   # Application configuration should go into files in config/initializers
   # -- all .rb files in that directory are automatically loaded.

   # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
   # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
   # config.time_zone = 'Central Time (US & Canada)'

   # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
   # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]

   # Languages for the application

   config.i18n.enforce_available_locales = true
   config.i18n.available_locales = %i[en_US hi_IN]
   config.i18n.default_locale = :en_US # english

   # Do not swallow errors in after_commit/after_rollback callbacks.
   # config.active_record.raise_in_transactional_callbacks = true
  end
 end

The associated en_US and hi_IN yaml files are within config/locales. There is no en file. I tried creating a copy of en_US and naming it en, and replacing en_us with en within the file to no avail.

Additional info: Ruby 2.4.10 Rails 5.1.6

Upvotes: 0

Views: 24

Answers (0)

Related Questions