Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### Unreleased

* bug fixes
* Fix translation issue with German `E-Mail` on invalid authentication messages caused by previous fix for incorrect grammar [#5822](https://github.com/heartcombo/devise/pull/5822)

### 5.0.0 - 2026-01-23

no changes
Expand Down
4 changes: 3 additions & 1 deletion lib/devise/failure_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def i18n_message(default = nil)
options[:default] = [message]
auth_keys = scope_class.authentication_keys
human_keys = (auth_keys.respond_to?(:keys) ? auth_keys.keys : auth_keys).map { |key|
scope_class.human_attribute_name(key).downcase
# TODO: Remove the fallback and just use `downcase_first` once we drop support for Rails 7.0.
human_key = scope_class.human_attribute_name(key)
human_key.respond_to?(:downcase_first) ? human_key.downcase_first : human_key[0].downcase + human_key[1..]
}
options[:authentication_keys] = human_keys.join(I18n.t(:"support.array.words_connector"))
options = i18n_options(options)
Expand Down
5 changes: 5 additions & 0 deletions test/failure_app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ def call_failure(env_params = {})

assert_equal 'Email ou senha inválidos.', @request.flash[:alert]
assert_equal 'http://test.host/users/sign_in', @response.second["Location"]

call_failure('warden' => OpenStruct.new(message: :invalid), 'warden.options' => { locale: :de })

assert_equal 'E-Mail oder Passwort ist ungültig.', @request.flash[:alert]
assert_equal 'http://test.host/users/sign_in', @response.second["Location"]
end

test 'uses the proxy failure message as string' do
Expand Down
12 changes: 12 additions & 0 deletions test/support/locale/de.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
de:
activerecord:
attributes:
user:
email: E-Mail
mongoid:
attributes:
user:
email: E-Mail
devise:
failure:
invalid: "%{authentication_keys} oder Passwort ist ungültig."