1. Home
  2. Docs
  3. Installation
  4. Multi language setup

Multi language setup

If you have a multi language site, you can display the chat according to your site language. The only thing to do is adding a few extra line to the loading code snippet.

Original snippet
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
  window._chb_mainColor = '#16519F';
  window._chb_uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
  window._chb_lang_code = 'EN';
</script>
<script src="//js.dialogity.com/main.js" async="true"></script>

This snippet contains the used language in the line “window._chb_lang_code = ‘EN’;”. In the followings we will add a few line code to select the language code dynamically based on the site URL.

Modified snippet
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
  window._chb_mainColor = '#16519F';
  window._chb_uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
  window._chb_lang_code = 'HU';
  if (window.location.href.includes('en_US')) {
    window._chb_lang_code = 'EN';
  }
</script>
<script src="//js.dialogity.com/main.js" async="true"></script>

In this example the default language is set to HU (Hungarian) and if the site URL contains the text “en_US” we replace the language to EN (English). If you apply this on your own site, most probably you’ll need to modify the pattern (“en_US”) to fit your site URL structure.

This solution works easily if the language of the site can be find out from the site URL, which is the case for most of the sites, but can be adjusted to other multi language sites too. If you need help, just write us in the chat 😉

Supported languages

Currently the following languages are supported:

  • EN – English
  • HU – Hungarian
  • (DIY – your own translation)

If you need more, please contact us. There is also a possibility to make your own translation or just adjust the system messages according your preferences on the admin interface: https://app.dialogity.com/settings/language