verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
96 stars 72 forks source link

Submission Message not translated #2168

Open anchovy opened 3 days ago

anchovy commented 3 days ago

Describe the bug

We've got a multi-lingual site and I've set a placeholder for the submission and error messages as per the below snap. Screenshot 2024-12-02 at 2 04 32 pm

The placeholder for the submission error is working as expected: Screenshot 2024-12-02 at 2 04 04 pm

But for the success message I'm just getting the string: Screenshot 2024-12-02 at 2 08 11 pm

Steps to reproduce

Form settings

Craft CMS version

Craft Pro 4.13.3

Plugin version

2.1.34

Multi-site?

Yes

Additional context

So that I don't have to have multiple language files with duplicate language keys for email, password, submit etc I've got the following for my formie.php language file:

<?php

// formie needs some of their translations in this file and doesn't pick up from the site.php.
// to keep things simple, we'll just include the site.php translations so they are only set in one place.
// https://github.com/verbb/formie/issues/60
$siteTranslations = require __DIR__ . '/site.php';

return $siteTranslations;
engram-design commented 2 days ago

Do note that this is a rich text string, so you'll need to translate it including any HTML in the output. So by default, this would be:

'<p>Submission saved.</p>' => '<p>Test!</p>',

Which is working on my end.

anchovy commented 1 day ago

Great, thanks for that.

Isn't the error message a rich text string as well? The only difference I can see between the two is the success messages allows for inserting site/form variables.

engram-design commented 1 day ago

Yep, both those fields act the same, are you seeing something different?

Using the default messages as an example:

'Submission saved.' => 'This won’t be translated.',
'Couldn’t save submission due to errors.' => 'This won’t be translated.',

'<p>Submission saved.</p>' => 'This will be translated.',
'<p>Couldn’t save submission due to errors.</p>' => 'This will be translated.',