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

Email translation missing: en.neo4j.errors.models.user.attributes.email.taken #12

Open
johannesE opened this issue Feb 23, 2015 · 8 comments

Comments

@johannesE
Copy link

When I try to register a user which already exists, I get the following error:
Email translation missing: en.neo4j.errors.models.user.attributes.email.taken

I am using
devise-neo4j (2.0.0)
bcrypt-ruby (> 3.0)
devise (
> 3.0)
neo4j (>= 3.0.0.alpha.6)
orm_adapter (> 0.5.0)
railties (>= 3.1)
warden (
> 1.2.1)

@subvertallchris
Copy link
Contributor

@johannesE
Copy link
Author

That looks good and I can probably fix the error myself in this way.
But shouldn't the english version already be coming with the gem? This is the first time that I come across the need for a manual translation in an english RoR application. However, this might be because I am still pretty new, so..

@subvertallchris
Copy link
Contributor

I've never run into it, either. What version of Rails, Neo4j gem, etc,...? Neo4j.rb has basic support for i18n in the sense that it'll load a config file if it finds it, but it doesn't get involved beyond that. By default, it looks like it's going into config/locales and loading all Ruby and YML files it can find.

@johannesE
Copy link
Author

Rails 4.1.6, Neo4j: 4.1.6, devise-neo4j: 2.0.0
I don't know where it finds the key "en.neo4j.errors.models.user.attributes.email.taken", but maybe we could change it to: "en.errors.messages.taken", which should return "has already been taken" from neo4j-4.1.2/config/locales/en.yml. Would that work?

devise.en.yml does not have an entry like that.

If you think that this bug is not worth the trouble if it comes alone, then I don't mind. I doubt that anyone will even recognize it in my project. Just wanted to help.

@subvertallchris
Copy link
Contributor

I think it's worth figuring out, you are definitely helping. Maybe the settings in Neo4j.rb's en.yml are from an old version of... something? It might be better to add the new message than remove the old one.

@benjackson
Copy link
Contributor

I think that the issue might be that in the Rails-specific ActiveRecord-like part of neo4j, it's trying to mimic the way ActiveRecord handles internationalisation and localisation, but is not conforming to the complete spec maybe?

The way ActiveRecord localisation works is it looks for translation keys starting with the most detailed ("en.neo4j.errors.models.user.attributes.email.taken") and then works backwards if keys are blank until it would reach the top level ("en.errors.messages.taken").

So the quick fix would be: Add the full translation key ("en.neo4j.errors.models.user.attributes.email.taken") to @johannesE's project (because adding the full key to devise-neo4j would only work if the model is always going to be named, 'User').

The 'proper' fix would be: Alter the neo4j gem so it handles translations in that fallback way like ActiveRecord does.

@johannesE
Copy link
Author

That sounds good and makes sense. The quick fix works for me. So I suppose we can close this issue here and open up a new one in the neo4j gem?

@ernestoe
Copy link

I'm having the same issue while using simple_form in my application. Has this issue been open in the neo4j gem repository?

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

4 participants