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

The format of the error messages are not unified (ending period) #613

Closed
greyli opened this issue May 30, 2020 · 1 comment · Fixed by #620
Closed

The format of the error messages are not unified (ending period) #613

greyli opened this issue May 30, 2020 · 1 comment · Fixed by #620

Comments

@greyli
Copy link
Member

greyli commented May 30, 2020

In general, some error messages end with a period:

#: src/wtforms/validators.py:269 src/wtforms/validators.py:294
msgid "This field is required."
msgstr ""

#: src/wtforms/validators.py:327
msgid "Invalid input."
msgstr ""

#: src/wtforms/validators.py:387
msgid "Invalid email address."
msgstr ""

#: src/wtforms/validators.py:423
msgid "Invalid IP address."
msgstr ""

#: src/wtforms/validators.py:466
msgid "Invalid Mac address."
msgstr ""

but some don't:

#: src/wtforms/csrf/core.py:96
msgid "Invalid CSRF Token"
msgstr ""

#: src/wtforms/csrf/session.py:63
msgid "CSRF token missing"
msgstr ""

#: src/wtforms/csrf/session.py:71
msgid "CSRF failed"
msgstr ""

#: src/wtforms/csrf/session.py:76
msgid "CSRF token expired"
msgstr ""

#: src/wtforms/fields/core.py:534
msgid "Invalid Choice: could not coerce"
msgstr ""

#: src/wtforms/fields/core.py:538
msgid "Choices cannot be None"
msgstr ""

#: src/wtforms/fields/core.py:545
msgid "Not a valid choice"
msgstr ""

source: https://github.com/wtforms/wtforms/blob/master/src/wtforms/locale/wtforms.pot

This make the UI look a little inconsistent when these messages show together.

image

Do we need to add periods for these messages? If yes, I can submit a PR to fix this. This PR may involve these changes:

  • Update the messages in the source
  • Regenerate the pot file
  • Update the messages in the test
  • Maybe also update all the translations (some translation adds the missing period for the target language, some don't)?
@azmeuk
Copy link
Member

azmeuk commented Jun 14, 2020

Thank you for your reporting.
I suppose it would make sense to have periods everywhere. Your PR is welcome!

pypingou pushed a commit to Pagure/pagure that referenced this issue Feb 13, 2023
In wtforms version >= 2.3.2 localizations where unified with ending dots.
From version >=3.0.0 also the english localization was adjusted.
'Not a valid choice' became 'Not a valid choice.', logic added to assert based on version.

References:
wtforms/wtforms#613
wtforms/wtforms#620
wtforms/wtforms@2.3.2...master
wtforms/wtforms@514a972
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants