Ruby on Rails flash messages in French

2019-05-27 22:10发布

问题:

Working on a rails app in French, however whenever i include an accent on the flash messages it breaks the site.

For example

format.html {redirect_to @message.annonce, notice:"Votre message a été envoyé"}
format.html {redirect_to @message.annonce, notice:"Votre email n'a pas pu être envoyer à cause d'une erreur."}

my config/application.rb looks like this

 config.i18n.default_locale = :fr
 config.encoding = "utf-8"

How does one do about this?

回答1:

You should add # encoding: UTF-8 as the first line of your file to add accent in it.

If this is not working please give us the exception raised.