Hubspot form Lithuanian translations

Hi,
I am trying to integrate hubspot form using

js.hsforms.net/forms/embed/v2.js script and

hbspt.forms.create method. I add property locale with value ‘lt’ and I provide translations object with the same key.
Translations work correctly, but when I type anything into the form, hubspot makes a request to url forms-na1.hubspot.com/submissions-validation/v1/validate
I get a response with code 400 and message: “Invalid input JSON on line 1, column 11: Cannot deserialize value of type `com.hubspot.linguine.core.Locale` from String \“LT\”: not one of the values accepted for Enum class: [DE, FI, VI_VN, BG, DA_DK, HR, FR, HU, UK, SL, ID, ZH_CN, LT_LT, KO_KR, SV, HE_IL, MS, EN, PT_BR, ES, CA_ES, ET_EE, EN_GB, ZH_HK, JA, TL, PL, RO, NL, NO, RU, BN, ES_MX, PT_PT, HI_IN, IT, AR_EG, ZH_TW, TR, SK_SK, CS, FR_CA, EL_GR, TH, AF_ZA]”
I have tried passing values “LT_LT”, “lt_lt”, “lt-lt”, “lt_LT”, but I always get the same error. It looks like somewhere in the script the value I provide gets changed from expected “LT_LT” to just “LT”.
Please advice how to fix it. Maybe I need to provide locale in specifinc format I haven’t tried yet? Or maybe I can disable these validation calls?

Hey @DBriedis! Welcome to the Community and thanks so much for your post :blush:

Are you using this documentation to add internationalization to your embedded forms? If so, please share the exact script you are using. This will give us some more context to keep investigating that error.

Best,
Kennedy

Hi @kennedyp,

Thank you for a timely reply!
Yes, I am using this documentation together with this one: https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options

Here is my code

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>HubSpot Form</title>
</head>
<body>
 <div id="hubspot-form"></div>
 <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
 <script>
 const translations = {
 'lt': {
 uploadText: 'Įkelti dokumentą',
 submitText: 'Siųsti',
 required: 'Laukelis privalomas',
 fieldLabels: {
 'TICKET.subject': 'Tema',
 'TICKET.content': 'Žinutė',
 'TICKET.hs_file_upload': 'Pridėti failą arba ekrano vaizdą (neprivaloma)',
 }
 },
 en: {
 uploadText: 'Attach a file'
 }
 };

 window.addEventListener('message', function(event) {
 if (event.data.type === 'PREFILL_FORM') {
 const { email, fullName, tenantName, locale, theme } = event.data;

 hbspt.forms.create({
 region: "na1",
 portalId: "7123428",
 formId: "5c30fa34-5ce8-4a51-bb90-d4d70b244223",
 target: '#hubspot-form',
 redirectUrl: 'hubspot-form-success.html',
 locale,
 css,
 translations,
 onReady: function(form) {
 // Prefill fields
 const nameField = form.querySelector('[name="firstname"]');
 if (nameField) {
 nameField.autocomplete = 'off';
 nameField.value = fullName;
 nameField.parentElement.parentElement.style = 'display: none';
 }
 const emailField = form.querySelector('#email-5c30fa34-5ce8-4a51-bb90-d4d70b244223');
 if (emailField) {
 emailField.value = email;
 emailField.parentElement.parentElement.style = 'display: none';
 }
 const tenantField = form.querySelector('[name="tenant_name"]')
 if (tenantField) {
 tenantField.value = tenantName;
 }

 // Custom file upload button
 const fileInput = form.querySelector('[name="TICKET.hs_file_upload"]');
 if (fileInput) {
 fileInput.classList.add('hidden-file-input');
 const fileUploadSection = document.createElement('div');
 fileUploadSection.classList.add('file-upload-section');

 const uploadButton = document.createElement('button');
 uploadButton.type = 'button';
 console.log(locale, translations[locale]);
 uploadButton.textContent = translations[locale].uploadText;
 uploadButton.classList.add('custom-upload-button');
 uploadButton.addEventListener('click', () => fileInput.click());

 const fileNameSpan = document.createElement('span');
 fileNameSpan.classList.add('file-name');

 fileInput.addEventListener('change', (event) => {
 const target = event.target;
 if (target.files && target.files[0]) {
 fileNameSpan.textContent = target.files[0].name;
 }
 });

 fileUploadSection.appendChild(uploadButton);
 fileUploadSection.appendChild(fileNameSpan);
 fileInput.parentElement.appendChild(fileUploadSection);
 }
 },
 onFormSubmit: function() {
 window.parent.postMessage('FORM_SUBMITED', '*');
 }
 });
 }
 });
 </script>
</body>
</html>

Thanks for that context @DBriedis!

Let’s invite some of our experts to see if they have any advice. Hey @TomM2 , @BarryGrennan , @GiantFocal do y’all have any troubleshooting recommendations or insight into why these translations are not working as expected on our embedded form here? Thanks!

Best,
Kennedy