Skip Navigation

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 topic contains 1 reply, has 2 voices.

Last updated by Mohamed Sayed 1 year, 2 months ago.

Assisted by: Mohamed Sayed.

Author Posts
March 7, 2024 at 4:50 pm #15386043

mercedesA-2

I have a chatbot plugin collect.chat now working in Spanish, how can I make it work in the translated languages?

March 8, 2024 at 12:47 pm #15389296

Mohamed Sayed

Hi,

According to the authors, the plugin doesn't support having one chatbot in multiple languages hidden link

Please also check this thread: https://wordpress.org/support/topic/wpml-integration-18/

This means that the plugin might not be compatible with WPML and you need to create a different chatbot for each language which can be achieved with custom code.

Unfortunately, we do not provide support for custom coding. Kindly check our support policy:(https://wpml.org/purchase/support-policy/)

However, I will try to point you in the right direction. You can use the wpml_current_language hook with "if/elseif" statement as in the below example to execute different codes depending on the language:

function custom_head_scripts_based_on_language() {
    // Get the current language using WPML's wpml_current_language function
    $current_language = apply_filters( 'wpml_current_language', NULL );

    // Check the current language and output language-specific script tags accordingly
    if ( $current_language === 'en' ) {
        echo 'The English chatbot script code goes here';
    } elseif ( $current_language === 'es' ) {
        echo 'The Spanish chatbot script code goes here';
    }
    // Add more languages and their script URLs using additional else if statements as needed
}
add_action( 'wp_head', 'custom_head_scripts_based_on_language' );

More info:

- https://wpml.org/faq/how-to-get-current-language-with-wpml/
- hidden link

DISCLAIMER:

Note: The possible solution provided is to be used just as an informational one. Please remember that custom coding is out of the scope of our support, so we can't create, debug or modify code for you and it's your responsibility to maintain it. We hope the one we used as an example could point you in the right direction.

Kind regards,
Mohamed