Conversation
config/application.rb
Outdated
| config.load_defaults 7.0 | ||
|
|
||
| # translate to PT-br | ||
| config.i18n.available_locales = %w[pt-BR en] |
There was a problem hiding this comment.
I think we should create a separate file for this configuration.
config/initializers/i18n.rb
frozen_string_literal: true
I18n.load_path += Rails.root.glob("/config/locales/**/*.{rb,yml}")
I18n.available_locales = :"pt-BR"
I18n.default_locale = :"pt-BR"
| @@ -0,0 +1,147 @@ | |||
| pt-BR: | |||
There was a problem hiding this comment.
This file can be located at:
config/locales/pt-BR/devise.yml
| # devise-api authenticate API requests [https://github.com/nejdetkadir/devise-api] | ||
| gem "devise-api", github: "nejdetkadir/devise-api", branch: "main" | ||
| # Add devise-i18n for automatic translation of Devise views and messages | ||
| gem "devise-i18n", "~> 1.10" |
There was a problem hiding this comment.
why do we need this gem?
I believe we can do this without adding another gem.
There was a problem hiding this comment.
You're right that it's possible to translate Devise manually. I actually tested that approach without using the devise-i18n gem, but it didn’t translate everything, only any messages.
That’s because we didn’t generate the Devise views, so it kept using the default ones from the gem, which are hardcoded in English and don’t use t() for translations.
…ckend into fix-translate-devise-pt
Context
Solution