8

I created a Sitecore Form in Korean language (ko-Kr) version.

For an Email field on this form, we used Email Validator and updated the error message on this path /sitecore/system/Settings/Forms/Validations/Email Validator to Korean language.

Now if I type "" or if i enter an invalid email id, it is showing the validation error message in English language.

Whereas if I type "sd@s", I am getting error message which I configured for the validation item path /sitecore/system/Settings/Forms/Validations/Email Validator

enter image description here

If I type Alphanumeric character, it is showing error message in English.

Can someone suggest why I am getting the error message in English in this scenario?

enter image description here

  • I have done few major edits to your question. Please have a look to make sure the edits are not changing the context of your problem. – Amitabh Vyas Apr 3 '19 at 20:21
  • Is there any option to fix this issue? – PKH Apr 10 '19 at 12:25
  • What kind of validations do you have set for this field? Take a look here -> imgur.com/IxAkCLK – Peter Procházka Apr 12 '19 at 6:12
  • 3
    I think the only reliable answer to this will be from Sitecore Support. You should raise a ticket. – Mark Cassidy Apr 12 '19 at 6:16
  • @PeterProcházka - using Email validator for validation – PKH Apr 12 '19 at 6:18
8
+50

This is a known issue in Forms as it uses the default jQuery validation and there are no any localized scripts on custom language translations ootb. The issue is seen on the email validator - as long as jquery thinks it is a bad email, you will see the English text. After that you can see the translated text (the regex from Sitecore is different from the jquery one). There is a "wish" report to add support for the ootb languages and at least add documentation on how to fix this for other languages: https://kb.sitecore.net/articles/482062

I was told (by Support - thx to them) this should do it:

  1. Download jquery-validation source and extract the zip file
  2. Copy the jquery-validation-master\src\localization folder to the \sitecore modules\Web\ExperienceForms\scripts folder.
  3. Include the following script below the @RenderBody() helper in the \Views\Shared\MVCOuterLayout.cshtml file:

    <script type="text/javascript">
    var lang = '@Sitecore.Context.Language.Name';
    var script = document.createElement("script");
    if (lang == 'ko-KR')
    {
        script.src = "/sitecore%20modules/Web/ExperienceForms/scripts/localization/messages_ko.js";
        $("head").append(script);
    }
    </script>
    
  4. Find the error message in the \sitecore modules\Web\ExperienceForms\scripts\localization\messages_ko.js file and translate as desired. Should be something with email: "..."

You can also create a messages_<languageCode>.js file in the \sitecore modules\Web\ExperienceForms\scripts\localization folder and modify the script logic to handle other language translation.

Edit: Just verified this and it does seem to work fine.

If you need to do this in a SXA environment: https://ggullentops.blogspot.com/2019/04/sitecore-9-forms-translating-client-error.html

| improve this answer | |
2

@Gatogordo - Thanks for sharing.

Easiest way we can fix for this issue.
Step 1 : Copy the "messages_ko.js" file and paste the to the \sitecore modules\Web\ExperienceForms\scripts folder.
Step 2 : Give the "messages_ko.js" file name to script field in sitecore form and publish item.
Ex: enter image description here

Now it's reflecting the korean language for email validation.
this is the custom message enter image description here


Custom message: enter image description here

| improve this answer | |
  • 1
    Glad to be of assistance ;) Didn't test it in the scripts field yet as that is shared. Curious how that behaves in a multi-lingual environment.. – Gatogordo Apr 16 '19 at 7:17
  • We tested in multi-lingual environment. it will cause the translate content issue. correct solution -- we need to update script either sitecore form wrapper or layout. – PKH May 6 '19 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.