{"id":86,"date":"2020-05-19T14:10:27","date_gmt":"2020-05-19T14:10:27","guid":{"rendered":"https:\/\/doc.dialogity.com\/index.php\/docs\/test-doc-site\/multi-language-setup\/"},"modified":"2021-02-10T21:37:55","modified_gmt":"2021-02-10T21:37:55","slug":"multi-language-setup","status":"publish","type":"docs","link":"https:\/\/doc.dialogity.com\/index.php\/docs\/test-doc-site\/multi-language-setup\/","title":{"rendered":"Multi language setup"},"content":{"rendered":"\n<p class=\"ticss-5dd9e318 wp-block-paragraph\">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.<\/p>\n\n\n\n<h5 class=\"ticss-99307207 wp-block-heading\">Original snippet<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n&lt;script>\n  window._chb_mainColor = '#16519F';\n  window._chb_uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';\n  window._chb_lang_code = 'EN';\n&lt;\/script>\n&lt;script src=\"\/\/js.dialogity.com\/main.js\" async=\"true\">&lt;\/script><\/code><\/pre>\n\n\n\n<p class=\"ticss-51eeea6d wp-block-paragraph\">This snippet contains the used language in the line <em>&#8220;window._chb_lang_code = &#8216;EN&#8217;;&#8221;<\/em>. In the followings we will add a few line code to select the language code dynamically based on the site URL.<\/p>\n\n\n\n<h5 class=\"ticss-7c4598a6 wp-block-heading\">Modified snippet<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n&lt;script>\n  window._chb_mainColor = '#16519F';\n  window._chb_uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';\n  window._chb_lang_code = 'HU';\n  if (window.location.href.includes('en_US')) {\n    window._chb_lang_code = 'EN';\n  }\n&lt;\/script>\n&lt;script src=\"\/\/js.dialogity.com\/main.js\" async=\"true\">&lt;\/script><\/code><\/pre>\n\n\n\n<p class=\"ticss-dc628a1b wp-block-paragraph\">In this example the default language is set to <strong>HU<\/strong> (Hungarian) and if the site URL contains the text <strong>&#8220;en_US&#8221;<\/strong> we replace the language to <strong>EN<\/strong> (English). If you apply this on your own site, most probably you&#8217;ll need to modify the pattern (&#8220;en_US&#8221;) to fit your site URL structure.<\/p>\n\n\n\n<p class=\"ticss-fe807131 wp-block-paragraph\">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. <em>If you need help, just write us in the chat \ud83d\ude09<\/em><\/p>\n\n\n\n<h5 class=\"ticss-6fe75744 wp-block-heading\">Supported languages<\/h5>\n\n\n\n<p class=\"ticss-9c18872b wp-block-paragraph\">Currently the following languages are supported:<\/p>\n\n\n\n<ul class=\"ticss-3288d3f3 wp-block-list\"><li>EN &#8211; English<\/li><li>HU &#8211; Hungarian<\/li><li>(DIY &#8211; your own translation)<\/li><\/ul>\n\n\n\n<p class=\"ticss-fc8c3b88 wp-block-paragraph\">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: <a href=\"https:\/\/app.dialogity.com\/settings\/language\">https:\/\/app.dialogity.com\/settings\/language<\/a><\/p>\n","protected":false},"featured_media":0,"parent":11,"menu_order":1,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-86","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/docs\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":6,"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/docs\/86\/revisions"}],"predecessor-version":[{"id":176,"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/docs\/86\/revisions\/176"}],"up":[{"embeddable":true,"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/docs\/11"}],"next":[{"title":"Hide chat on selected pages","link":"https:\/\/doc.dialogity.com\/index.php\/docs\/test-doc-site\/hide-chat-on-selected-pages\/","href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/docs\/144"}],"prev":[{"title":"Installation","link":"https:\/\/doc.dialogity.com\/index.php\/docs\/test-doc-site\/install\/","href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/docs\/64"}],"wp:attachment":[{"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/doc.dialogity.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}