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

shared error message downcases model #260

Closed
fwolfst opened this issue Mar 15, 2019 · 0 comments · Fixed by #336
Closed

shared error message downcases model #260

fwolfst opened this issue Mar 15, 2019 · 0 comments · Fixed by #336

Comments

@fwolfst
Copy link

fwolfst commented Mar 15, 2019

The shared error message downcases the resource class human name. In German, nouns are capitalized, leading to wrong spelling. I don't really know how to handle this case gracefully (probably there is some rails i18n stuff for that already prepared?) and will provide a PR that handles the situation "correctly" for German.

fwolfst added a commit to fwolfst/devise-i18n that referenced this issue Mar 15, 2019
I don't know what is the "right" way to define keys in vanilla rails
i18n model translations regarding uppercased/downcased model names.

In German, all Nouns start with a capital Letter, thus for correct
German spelling without this patch you need to `rails g devise:views`
and adjust the `_error_messages.html.erb` template.  I'd prefer this
working out of the box, but cannot judge the implications for other
locales.
JasonBarnabe added a commit that referenced this issue Feb 27, 2023
Previously, we would always downcase the model name in the error partial. In some languages, this is not appropriate. For example, in German, nouns are always capitalized. In addition, the translated string might put the model name first, so it should still be capitalized.

There's not an elegant way to handle these kinds of rules, so we now define a helper devise_i18n_fix_model_name_case which capitalizes appropriately for the situation. The current implementation downcases in all cases, except in the error partial in German.

Fixes #260
JasonBarnabe added a commit that referenced this issue Mar 2, 2023
Previously, we would always downcase the model name in the error partial. In some languages, this is not appropriate. For example, in German, nouns are always capitalized. In addition, the translated string might put the model name first, so it should still be capitalized.

There's not an elegant way to handle these kinds of rules, so we now define a helper devise_i18n_fix_model_name_case which capitalizes appropriately for the situation. The current implementation downcases in all cases, except in the error partial in German.

Fixes #260
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

Successfully merging a pull request may close this issue.

1 participant