Skip to content

Calc guard error message displays in wrong translation #265

@janherman

Description

@janherman

Describe the bug
I discovered if I fill wrong result in calc guard field, calc guard shows error message in English, even though my site is in Czech. This is the relevant part of the controller:

$form = new Form([
     // other rules ...
    "captcha" => [
        "rules" => ["required", "num"],
        "message" => "Vyplňte pole"
    ],
]);

This is the template:

<label>
    Vypňte výsledek příkladu <?= uniform_captcha() ?> =
    <?= captcha_field("", "contact-form__field"); ?>
</label>
<?php if(array_key_exists("captcha", $form->errors())): ?>
	<p class="contact-form__error"><?= $form->errors()["captcha"][0] ?></p>
<?php endif; ?>

Now, when I leave the captcha field blank, the returned error message is as defined in new Form().

But when I fill wrong result (let's say 3 + 3 = 77), English error message 'Please solve the arithmetic problem.' is returned.

Expected behavior
Czech error message should be shown.

Additional context
I tried it in Kirby 4.6.1 plainkit with the latest Uniform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions