Goodday!
We've successfully created a Marketing form which is now hosted on a test website as a contact form which can create leads in our CRM system.
What I can't figure out is if one Form can be used in different languages. Or do we need to create a form per Language and manually translate the labels + placeholder values?
This script should give you an idea of how to do the following thing, and gets the language code from the URL where the form has been added.
< script language = "javascript"
type = "text/javascript" >
function setLangLabel() {
// get language code from URL
var lang = location.pathname.split('/')[1];
// define form fields
var formFields = [{
id: '3f746946-34b4-442c-a677-e232cdd2bc40',
label: {
en: 'First Name',
de: 'Vorname',
es: 'Nombre de pila',
fr: 'Prenom'
}
},
{
id: 'e1dfc514-f301-4cb2-855a-4c8fa8331207',
label: {
en: 'Last Name',
de: 'Nachname',
es: 'Apellido',
fr: 'Nom de famille'
}
},
{
id: '7f685ebb-7c54-4cff-a1bc-772562d25c38',
label: {
en: 'Email Address',
de: 'Email Address',
es: 'Email Address',
fr: 'Email Address'
}
},
{
id: '358bf879-463e-ec11-8c63-000d3add2274',
label: {
en: 'How did you hear about us?',
de: 'Geschlecht',
es: 'Género',
fr: 'Comment avez-vous entendu parler de nous ?'
},
options: {
en: ['Search Engine', 'Recommended', 'Social Media', 'Event', 'Other'],
de: ['Suchmaschine', 'Recommended', 'Sozialen Medien', 'Fall','Andere'],
es: ['Buscador', 'Recomendado', 'Social Media','Evento', 'Otro'],
fr: ['Moteur de recherche', 'Recommandation', 'Réseaux sociaux', 'Évènement', 'Autre']
}
}
];
// define placeholder texts for each field
var placeholderTexts = [{
id: '3f746946-34b4-442c-a677-e232cdd2bc40',
text: {
en: 'Enter your first name',
de: 'Geben Sie Ihren Vornamen ein',
es: 'Ingrese su nombre',
fr: 'Entrez votre prénom'
}
},
{
id: 'e1dfc514-f301-4cb2-855a-4c8fa8331207',
text: {
en: 'Enter your last name',
de: 'Geben Sie Ihren Nachnamen ein',
es: 'Ingrese su apellido',
fr: 'Entrez votre nom de famille'
}
},
{
id: '7f685ebb-7c54-4cff-a1bc-772562d25c38',
text: {
en: 'Enter your email address',
de: 'Geben Sie Ihre E-Mail-Adresse ein',
es: 'Ingrese su dirección de correo electrónico',
fr: 'Entrez votre adresse e-mail'
}
}
];
// update labels for each field
formFields.forEach(function(field) {
var element = document.getElementById(field.id);
var labels = document.querySelectorAll('label[for="' + field.id +
'"]');
labels.forEach(function(label) {
label.textContent = field.label[lang] || field.label.en;
});
if (field.options) {
var options = element.querySelectorAll('option');
options.forEach(function(option, index) {
option.textContent = field.options[lang][index] || field
.options.en[index];
option.selected =
false; // Set selected to false for all options
});
}
});
// update placeholder text for each field
placeholderTexts.forEach(function(field) {
var element = document.getElementById(field.id);
element.placeholder = field.text[lang] || field.text.en;
});
// update submit button label
var submitButton = document.querySelector('button[type="submit"]');
submitButton.textContent = lang === 'en' ? 'Submit' : lang === 'de' ?
'Einreichen' : lang === 'es' ? 'Enviar' : lang === 'fr' ? 'Envoyer' : 'Submit';
}
MsCrmMkt.MsCrmFormLoader.on('afterFormLoad', setLangLabel);
</script>
Hi, do you have any news regarding showing translated Multi-options values or other staff ?
Hello Christian Abeln
Do you have any update on this point?
Any idea if the feature will be developed soon?
The solution with the coding which is provided in the answers above is ok with simple forms but it gets tougher when a complex form will be created.
Hi Clofly,
How about the option set values that are present on the marketing page?
Can you please help in this also
Regards,
Sam
Hi Erik,
From this article:
you could develop your own JavaScript code to the section of your pages using the HTML editor of the page designer.
For me, I'm using jQuery and create a static translation dictionary, because marketing form has limitted data.
I created a Select List for recipient to select preferred language.
Then you need to give your customized name to elements(labels) in their class attribute in marketing form
Below is my JS code for implementation.
Result
Perhaps it's not so flexible. However, there is no need to create more marketing forms for multi languages and you could take it as a reference.
Regards,
Clofly
Hi,
If it is CRM form (which is created through forms customizations), then there will not be any need to create multiple forms as the system will automatically convert the labels and description/ tooltips to selected UI language but in case of .net or any other custom form, the coding needs to be done to display the labels based on the local language selected for the user. If the form data is posted in CRM through the website, then the labels and placeholders can be of base language.
Hello,
For different languages you will need to create different email marketing message and translate the content.
In a future release will also enhance the language awareness for marketing messages such that customers will be able to specify the language / local of the message such that all content will be shown correctly formatted and we will be able to develop further for smart selection of the right email for audiences.
For now you would split your audience into segments for different content language and use parallel streams for those in your customer journey.