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

Add comment in Customer registration form, add better error message #14138

Merged
merged 1 commit into from
Jun 12, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion classes/ValidateConstraintTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,32 @@ public function __construct(TranslatorInterface $translator)
*/
public function translate($validator)
{
if ($validator === 'isName' || $validator === 'isCustomerName') {
if ($validator === 'isName') {
return $this->translator->trans(
'Invalid name',
[],
'Shop.Forms.Errors'
);
}

if ($validator === 'isCustomerName') {
return $this->translator->trans(
'Invalid name',
[],
'Shop.Forms.Errors'
) . PHP_EOL .
$this->translator->trans(
'Invalid characters: 0-9!<>,;?=+()@#"°{}_$%/\^*`',
[],
'Shop.Forms.Errors'
) . PHP_EOL .
$this->translator->trans(
'A space is required after . and 。',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be written with quotation marks? Example: A space is required after "." and "。"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what is the best practice.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tristan was for the ""

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you mean using 'A space is required after "." and "。"'
(Isn't the space after 。 weird in this case?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: the space can't be removed, it's part of the character

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, then @PierreRambaud can you re-approve this PR please? ^^

Copy link
Contributor

@matks matks Jun 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe some email browsers simplify them and convert them into regular . thus creating a clickable url

I confirm, try visiting https://www.apple。com 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But... this PR has been merged without the fix on the wording?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, then @PierreRambaud can you re-approve this PR please? ^^

@LouiseBonnard we've been tricked !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups my bad, I was too quick and thought I had already added it
Here's a PR to fix this ^^
#14163

[],
'Shop.Forms.Errors'
);
}

if ($validator === 'isBirthDate') {
return $this->translator->trans(
'Format should be %s.',
Expand Down
2 changes: 1 addition & 1 deletion themes/classic/templates/_partials/form-errors.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{block name='form_errors'}
<ul>
{foreach $errors as $error}
<li class="alert alert-danger">{$error}</li>
<li class="alert alert-danger">{$error|nl2br nofilter}</li>
{/foreach}
</ul>
{/block}
Expand Down