This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem:Integrate Tawk chat window in different languages.

Solution:
First, do not use the Tawk WordPress plugin. Instead, use Tawk's embed code and implement it using the following code in your theme's footer.php file:

<?php

$current_language_code = apply_filters( 'wpml_current_language', null );
if($current_language_code == 'en'): 
?>
<script>
//javacode for English script here
</script>

<?php
elseif($current_language_code == 'fr'):
?>
<script>
// javascript code for French
</script>

<?php
elseif($current_language_code == 'nl'):
?>

<script>
// javascript code for Dutch
</script>
<?php
endif;
?>

Relevant Documentation:

This topic contains 4 replies, has 2 voices.

Last updated by indiaH 1 year ago.

Assigned support staff: Ricardo Alday.

Author Posts
October 11, 2018 at 1:04 pm #2808294

indiaH

Tell us what you are trying to do? For now the chat window (tawk plugin) is only available in french but I'd like to put the widget in dutch when I'm on the dutch version of the website as well as the english version

October 11, 2018 at 5:20 pm #2809278

Ricardo Alday

Hi,

Thank you for contacting WPML Support.

You can try the following hook and code for this purpose:

<?php

$current_language_code = apply_filters( 'wpml_current_language', null );
if($current_language_code == 'en'): 
?>
<script>
//javacode for English script here
</script>

<?php
elseif($current_language_code == 'fr'):
?>
<script>
// javascript code for French
</script>

<?php
elseif($current_language_code == 'nl'):
?>

<script>
// javascript code for Dutch
</script>
<?php
endif;
?>

Hope it helps,
Ricardo

October 11, 2018 at 5:40 pm #2809333

indiaH

Hello,
Thanks for your answer.
Where do I need to put this code ? Do I still need to activate the plugin because i can choose only one chatbox i created via the settings of the plugin.
Kind regards,
India

October 11, 2018 at 5:49 pm #2809351

Ricardo Alday

You can put that in your theme's footer.php file and don't use the plugin because it will load the script twice. Use the embed code instead.

October 14, 2018 at 12:32 pm #2815410

indiaH

Perfect. My issue is resolved now. Thanks for your help !