I'm using devise gem to implement authentication in my Ruby On Rails application. Sometimes error messages are displayed such as:
Prohibited an error being wellness saved from this user: Password is
too short (minimum is 6 characters)
What is the best way to translate these messages to another language?
Go to config/locales and copy devise.en.yml, giving the file a name like devise.other_language_initials.yml. Then add your own translations.
For more info on how to translate your application, go here.
The fastest way is downloading a translation file to the language you want. You can find more about in this link.
What you are going to find there is a bunch of files in different languages for Devise flash notifications that you can download and add to you application under config/locales.
Hope that helps you! :)
Related
I'm using Rails 4 and Devise 3.4.1
I would like to change the messages sentences that appear in case of an error or a notification in the devise_error_messages. How can I do that?
Thank you
Corresponding I18n translation-files are located in config/locales folder (devise.en.yml for ex). You can make changes there.
When I start my Rails application I'm getting warning like this
Symmetric Encryption config not found.
To generate one for the first time: rails generate symmetric_encryption:config
I don't know why it's showing
If I generate symmetric_encryption:config nothing happened.
What is the use of 'symmetric_encryption:config'
Where it will use? What it will do?
Anything we have to configure, and what it will encrypt?
It is mean that your application using symmetric-encryption gem. Here is detail information about configuration of this gem.
I recently make a decision to translate my tiny rails app with I18n gem as it described here.
While a testing, as it expected, I got a error messages from activerecord and devise:
translation missing: ru.devise.failure.user.not_found_in_database
translation missing: ru.activerecord.errors.models.user.attributes.name.taken
At this moment I know only one way to set up massages with custom locale - simply copy en.yml file which contains messages into my custom ru.yml, but it's weird way.
Maybe I missed something?
Cheers!
You can use the default option (related question)
I also advise you to look into the rails-18n gem for common translations
Devise provide common translations on their wiki
You can also set up a fallback locale to avoid missing translations (related question)
I just discovered the Cane gem but it doesn't work with Rails, there is a way to make it work with Rails?
Update
I'm using rails 3.2.1 and It doesn't produce any error message
I'm the author of this gem.
How do you mean "doesn't work"? It's possible you just write good code :) The default options aren't too strict. Can you please post the output of:
cane --style-glob '**/*.rb' --style-measure 1
This should error on every line in the project, to verify whether cane is "working". And also
find . app
When run from within your rails directory.
I'm using rails 2.3.5 and devise 1.0.6.
I'm having users confirm account's with email.
However, when a new user sign's up the flash notice says "The user was successfully created" which it was but it doesn't tell the user that they need to confirm their their email unless they try to log in and devise's flash notice still doesn't explain that they have to confirm through email.
Where is this flash notice located in the gem and how can I change it? Or what is a better way to fix this problem.
Just enable i18n in your project and edit the default locale (en.devise.yml) or download new ones from
https://github.com/plataformatec/devise/wiki/i18n
Flash messages for the devise gem can be altered in the locales directory (YourRailsApp/config/locales/devise.en.yml).
Just change the devise.en.yml to your liking, it doesn't really take any programming knowledge.
If you are new to rails the locales directory is for I18n translations which is rails way of translating words albeit statically but it works well for simple projects.