Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Translate Marketing Formular

(0) ShareShare
ReportReport
Posted on by 5

Hello,

I have a Custom Marketing Form in German, what is the best way to translate the fields on the form to English?

The form is embedded on a website and creates leads in Dynamics Sales.

Form:

pastedimage1668074353524v1.png

  • Suggested answer
    Haig Liu Profile Picture
    Microsoft Employee on at
    RE: Translate Marketing Formular

    Hi Niko_2109,

    If you want to translate the marketing list according to the browser language you can do this by inserting the marketing page using Jscript.

    This script can translate the label (the first one in Field properties) to other language according to your browser language. Put it behind the </body> in the marketing page HTML.

    <script>

    // Do translation after marketing form is loaded

    MsCrmMkt.MsCrmFormLoader.on("afterFormLoad", function (event) {

        // Detect current user language

        var langName = detectLanguage();

        // Only do translation if current language is not German

        if (langName !== "deu") {

            // Field name are saved in label element

           // See Field label: Outbound marketing -> Marketing templates -> Form fields

            var labels = document.getElementsByTagName("label");

            labels[0].innerText = translation[langName].firstname;

            labels[1].innerText = translation[langName].lastname;

            labels[2].innerText = translation[langName].gender;

            labels[3].innerText = translation[langName].email;

            labels[4].innerText = translation[langName].phonenumber;

            labels[5].innerText = translation[langName].companyname;

            labels[6].innerText = translation[langName].country;

            labels[7].innerText = translation[langName].jobtitle;

        }

    });

     

    function detectLanguage() {

        var userLanguage = navigator.language.slice(0, 2);

        /**

         * You can extend more translation texts,

         * For example, if contact speaks spanish, then userLanguage should be "es",

         * you can add case "es": return "Spanish"; then add new spanish translation in translation variable.

         * Currently it'll only translate fields for English and German contacts, if he/she is a Spanish or Italian,

         * he/she will still see form default language (Such as your form is German, which means not translate, it is still expressed as German)

         **/

        switch (userLanguage) {

            case "en":

                return "english";

            case "de":

                return "German";

            default:

                return "deu";

        }

    }

     

    var translation = {

        english: {

            firstname: "firstname",

            lastname: "lastname",

            gender:"gender",

            email: "email",

            phonenumber:"phonenumber",

            companyname:"companyname",

            country:"country",

            jobtitle: "jobtitle"

        },

        German: {

            firstname: "Vorname",

            lastname: "Nachname",

            gender:"Geschlecht",

            email: "E-Mail",

            phonenumber:"Telefonnummer",

            companyname:"Name des Unternehmens",

            country:"land",

            jobtitle: "Position"

        }

        // Extend translation here, each translation should be separated with comma, but comma is not required for final item

    };

    </script>

    For more information, please refer to the original article:    

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Product updates

Dynamics 365 release plans