-
Notifications
You must be signed in to change notification settings - Fork 536
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
do not downcase model name in errors (fixes #260) #261
Conversation
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.
This would be unexpected, at least for English. I would not accept this change as is, but would accept something a bit smarter (either a built-in method that determines this, or at worst a method with a list of locales where capitalization changes should/should not happen). |
Understandable. Right now, I lack the smartness. The problem would also arise if e.g. the en-GB translation would resemble the German one: There is |
something like this? def maybe_downcase(noun)
[:de].include(i18n.locale) ? noun : noun.downcase
end (kind of pseudo-code, not knowing wether |
Yeah that's what I'm thinking for my "at worst" case. I wonder though - is that even the right thing to do for German? What if the model name is multiple words (like "Admin User" or "User Of Admin" or equivalents in German)? Would that end up correct? |
If its understood as a noun or a compound noun (cow milk, milk of cows) it
will be written with a capital letter. It is a pretty safe bet that more
than 75% of model names will be translated with a noun.
But again, another specific in the German translation of aforementioned
string is that it is a sentence in which the first word is the resource
name. In that case the word "class" (noun, adjective, ...) is irrelevant
and it has to be uppercased.
…On Sat, Mar 16, 2019 at 1:35 AM Jason Barnabe ***@***.***> wrote:
Yeah that's what I'm thinking for my "at worst" case.
I wonder though - is that even the right thing to do for German? What if
the model name is multiple words (like "Admin User" or "User Of Admin" or
equivalents in German)? Would that end up correct?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANY7VuuxmzN6kTR5hPfaGql_GvM-41zks5vXDw2gaJpZM4b2eTj>
.
|
See heartcombo/devise#4834 . I assume that the German equivalent of "Invalid email or password" also has incorrect capitalization. Go ahead with something like your suggested code. Let's not let perfect get in the way of better. |
smartness arrived maybe: |
No it is correct as-is: "E-Mail oder Passwort ungültig. " |
I don't think having a full separate template would be appropriate. This PR as submitted would break other languages. Passing it through a helper that would do something different for German would work. If you come up with something like that, please create a new PR. |
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 thisworking out of the box, but cannot judge the implications for other
locales.