web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Suggested answer
    Haig Liu Profile Picture
    Microsoft Employee on at

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 137 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans