Automatic translation

The automatic translation feature of Seamly allows you to seaminglessly machine-translate chat messages to another language in bot conversation as well as livechat. This allows you to scale to multiple languages without having to have agents or bots in different languages. In this guide we will describe what to consider when using the automatic translation features and how you can offer translation to your users.

Considerations

While using the automatic translation feature there are some things to consider:

  1. Translation may not work well when using personalisation as the location of the personalisation is static and the personalisation itself is not translated.
  2. Be wary when using translation with transactional services where you require user input. Refer to our support for advice on how to set this up correctly.
  3. Translation in itself does not offer a solution for localization (for instance if the opening hours in Germany differ from those in The Netherlands). In most services it is however possible to give contextually different answers based on whether or not translation has been turned on in a specific language.
  4. The quality of the translation may vary based on the chosen language and used back-end translation service.

Triggering translation

User initiated

Translation initiated by the user is by far the easiest to support as it does not require any code changes in the implementation. The user chooses "Translate" from the bottom menu, chooses their preferred language and enables the translation.

Trigger a windowed chat with translation enabled

This scenario is most suited if you have a button on your site that you want to start or open the chat with a specific language enabled. For instance "Chatten Sie mit uns auf Deutsch" to start a chat that will automatically enable translation to German.

window.seamly = window.seamly || []

// By doing this first, pre-chat messages will also be translated (including FAQ/suggestions)
window.seamly.push({
    action: 'setTranslation',
    args: {
        enabled: true,
        locale: 'de'
    }
})

// If not yet initialized. Skip this step if you already initialized the UI somewhere else
window.seamly.push({
    action: 'init',
    args: {
        layoutMode: 'window'
    }
})

window.seamly.push({
    action: 'setVisibility',
    args: 'open'
})

Make sure the locale you set is available in the translation back-end used in your account.

This setup will also work if the chat is already active. If the code above is triggered it will start the translation from that point in time.

Have an inline chat with translation enabled

This works best if you have a separate page for an inline variant.

window.seamly = window.seamly || []

window.seamly.push({
    action: 'setTranslation',
    args: {
        enabled: true,
        locale: 'de'
    }
})

// Init the inline Seamly UI as usual
window.seamly.push({
    action: 'init',
    args: {
        //....
    }
})

Trigger translation from a bot

This scenario is useful if you have language choices in your flow or if you have recognition on certain phrases in other languages where you can suggest turning on translation in a specific language. Enabling translation in such a case can only be done by services that expose metadata to the front-end on the message level.

In the example below we assume the service exposes a metadata field additions which in turn has a field enableTranslationTo set with the requested language.

window.seamly = window.seamly || []

window.seamly.push({
    action: 'on',
    args: [
      'message',
      function(message) {
        var targetLocale = message && message.service && message.service.meta && message.service.meta.additions && message.service.meta.additions.enableTranslationTo
        if(targetLocale) {
          window.seamly.push({
              action: 'setTranslation',
              args: {
                  enabled: true,
                  locale: targetLocale
              }
          })
        }
      }
    ]
})