Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer Insights - Journeys forum

Multi language marketing form?

(0) ShareShare
ReportReport
Posted on by 195

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?

  • Suggested answer
    Megan V. Walker Profile Picture
    1,808 Most Valuable Professional on at
    RE: Multi language marketing form?

    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.

    • You must get the ID of each form field you wish to translate
    • Set the label of each field for each language (including option set field)
    • Define the placeholder text for each field (should you wish to use them)
    • Translate the submit button in to each language

    < 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>

  • Marcin Bielak Profile Picture
    10 on at
    RE: Multi language marketing form?

    Hi, do you have any news regarding showing translated Multi-options values or other staff ? 

  • Community Member Profile Picture
    on at
    RE: Multi language marketing form?

    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. 

  • Community members1327 Profile Picture
    5 on at
    RE: Multi language marketing form?

    Hi Clofly,

    How about the option set values that are present on the marketing page?

    Can you please help in this also

    Regards,

    Sam

  • cloflyMao Profile Picture
    25,208 on at
    RE: Multi language marketing form?

    Hi Erik, 

    From this article:

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/marketing/create-deploy-marketing-pages#privacy-notice,  

    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.

    k4.png

    Then you need to give your customized name to elements(labels) in their class attribute in marketing form

    k2.png

    Below is my JS code for implementation.

    k3.png

    Result

    k4.png

    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

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at
    RE: Multi language marketing form?

    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.

  • Suggested answer
    Christian Abeln Profile Picture
    on at
    RE: Multi language marketing form?

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Customer Insights - Journeys forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans