Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translation missing: en.errors.messages.extension_whitelist_error #2173

Closed
jdzak opened this issue May 8, 2017 · 4 comments
Closed

translation missing: en.errors.messages.extension_whitelist_error #2173

jdzak opened this issue May 8, 2017 · 4 comments

Comments

@jdzak
Copy link

jdzak commented May 8, 2017

I'm using carrierwave (1.1.0) and rails (5.0.2) and i'm getting translation missing: en.errors.messages.extension_whitelist_error when I try an upload a file that isn't in the whitelist. I looked at the i18n load path and don't see carrierwave in the load path. Any ideas?

My uploader has:

class UserProfilePhotoUploader < CarrierWave::Uploader::Base
  def extension_whitelist
    %w[jpg jpeg gif png]
  end
end
@jdzak
Copy link
Author

jdzak commented May 8, 2017

So I just stumbled upon this discussion about carrierwave-i18n and a corresponding PR.

Seems to me the intent was to keep carrierwave/locale/en.yml in the carrierwave repo and pull all the other localizations into carrierwave-i18n repo. It looks like the PR did that, but it also removed part of the initializer that includes carrierwave in i18n load path making the carrierwave/locale/en.yml file unloadable.

Should the code to add the carrierwave localizations directory to the i18n load path be re-added?

@leoskyrocker
Copy link

Running into the exact same error. Looks right to me that we need to add it back..

@leoskyrocker
Copy link

leoskyrocker commented Jun 1, 2017

Don't have time to send a PR to fix this yet, but currently I'm deploying a VERY HACKY workaround using Bundler (>1.3) (please refrain to use):
In config/initializers/carrierwave.rb:

CarrierWave.configure do |config|
  ...
  carrierwave_gem = Bundler.rubygems.find_name('carrierwave').first
  I18n.load_path.prepend(File.join(carrierwave_gem.full_gem_path, 'lib', 'carrierwave', 'locale', "en.yml")) if carrierwave_gem.present?
  ...
end

@johnfoley3
Copy link

For anyone else running into this issue, the better answer is to add

gem 'carrierwave-i18n'

to your gem file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants