ibm-watsonwatson-assistant

Change the Watson Assistant confirm modal language (Exit Button Confirmation)


I have a Watson Assistant integrated on a web-page using the following block:

const customLanguagePack = {
            "options_select": "Wählen Sie eine Option aus",
        };

        window.watsonAssistantChatOptions = {
            integrationID: "xxx-xxx-xxx-xxx", // The ID of this integration.
            region: "eu-de", // The region your integration is hosted in.
            serviceInstanceID: "xxxx", // The ID of your service instance.
            showCloseAndRestartButton: true,
            onLoad: function(instance : any) {
                instance.updateUserID(String(context.user?.user_id));
                instance.render();
                instance.updateLanguagePack(customLanguagePack);
            }
        };
        setTimeout(function(){
            const t=document.createElement('script');
            t.src="https://web-chat.global.assistant.watson.appdomain.cloud/versions/" + (window.watsonAssistantChatOptions.clientVersion || 'latest') + "/WatsonAssistantChatEntry.js";
            document.head.appendChild(t);
        });

As you can see, I render the close and reset button. My problem is, that when clicking on the exit button, the following modal appears with english Text:

Confirmation_Modal

I want to change the egnlish text into some custom german text. In the best case I want to customize the title, the text and the button text.

How can I change the Text of those three elements? I tried to add the following keys to the customLanguagePack, but those do not apply, probably because the keys are not correct. I think I just need the right keys, but I can not find them on the documentation.

Thanks in advance.


Solution

  • try this

     const customLanguagePack = {
          "closeAndRestartModal_message": "put your German text here"
        };
        instance.updateLanguagePack(customLanguagePack);
    

    You can find all the texts here: https://github.com/watson-developer-cloud/assistant-web-chat/blob/main/languages/en.json