Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1491976

    Hi,

    I’m using the Custom Pop-up Window Content option.
    I tried editing theme from the English language and I reviewed your documentation https://kriesi.at/documentation/enfold/privacy-cookies/
    without success.
    How can I adapt the messages according to the chosen language, please?

    Thank you for your attention.

    Best regards

    Rolland

    #1492025

    Hey RollandH,

    Thank you for the inquiry.

    Unfortunately, it’s not possible to translate the content of the cookie or privacy options using Loco Translate. As a solution, we added this code to the functions.php file.

    function av_lang_cb( $atts, $content = null ) {
        $atts = shortcode_atts(
            array(
                'only' => '',
            ),
            $atts
        );
    
        $current_locale = get_locale();
    
        if ( strtolower( $current_locale ) === strtolower( $atts['only'] ) ) {
            return do_shortcode( $content );
        }
    
        return '';
    }
    add_shortcode( 'av_lang', 'av_lang_cb' );
    

    You can now use these shortcodes to control the visibility of content in different languages.

    [av_lang only="en_US"]
    This text is visible only on English pages.
    [/av_lang]
    [av_lang only="fr_FR"]
    Ce texte n'est visible que sur les pages en francais.
    [/av_lang]
    

    Best regards,
    Ismael

    #1492029

    Hey Ismael,

    Thank you for your response.
    I understand the situation and the approach. I’m very busy with other projects today, but I’ll get back to you tomorrow if necessary.

    Have a good day.

    Best regards,

    Rolland

    #1492050

    Hey Ismael,

    A very effective function for texts. It doesn’t work for buttons or alerts, but it did the job and it will be useful…
    Thanks again.

    Best regards,

    Rolland

    #1492096

    Hi,

    You’re welcome! Please don’t hesitate to open another thread if you have more questions.

    Have a nice day.

    Best regards,
    Ismael

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Multilingual cookie policy with Loco Translate’ is closed to new replies.