• Resolved joinso

    (@joinso)


    Hi!

    We are using this shortcode [cmplz-manage-consent] in privacy page.
    The categories are not translated.
    We use WPML and we translated all string that we need, and also the categories, but always show the spanish translation, not the catalan one.

    Regards,
    Jordi
    JOINSO

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Aert Hulsebos

    (@aahulsebos)

    Hi @joinso,

    I will have a look if I can reproduce the issue. regards Aert

    Plugin Author Aert Hulsebos

    (@aahulsebos)

    Hi @joinso,

    I can’t reproduce the issue. Did you complete translations on the string with the identifier “category_all”?

    In your case I would presume:

    ES = Marketing
    CA = Marqueting

    If so, please try to clear cache and try again.

    regards Aert

    Thread Starter joinso

    (@joinso)

    Yes, I do.
    I translate this ones:
    category_stats
    category_all
    category_functional
    Empty cache, and then it show the spanish translations in different language page:
    ES:https://www.saate.es/politica-de-privacidad/
    CA: https://www.saate.es/ca/politica-de-privacitat/
    Regards,
    Jordi
    JOINSO

    Thread Starter joinso

    (@joinso)

    I just taking a look in the output of the shortcode, and I see that an AJAX call is done:

    https://www.saate.es/administracio/admin-ajax.php?action=cmplz_manage_consent_html_ajax

    This returns the spanish string in the page and does not take care of the language of the page.

    But….

    If I try this in the browser:

    https://www.saate.es/administracio/admin-ajax.php?action=cmplz_manage_consent_html_ajax&lang=ca

    I get this response:

    `html “<div><label for=\”cmplz_functional_document\”><input type=\”checkbox\” id=\”cmplz_functional_document\” tabindex=\”0\” class=\”cmplz-consent-checkbox cmplz-svg-checkbox cmplz-square-checkbox cmplz_functional\” checked disabled data-category=\”cmplz_functional\”><div class=\”cc-check\”><svg width=\”16px\” height=\”16px\” viewBox=\”0 0 18 18\” class=\”cmplz-square\”><path d=\”M1,9 L1,3.5 C1,2 2,1 3.5,1 L14.5,1 C16,1 17,2 17,3.5 L17,14.5 C17,16 16,17 14.5,17 L3.5,17 C2,17 1,16 1,14.5 L1,9 Z\”></path><polyline points=\”1 9 7 14 15 4\”></polyline></svg></div><span class=\”cc-category\” style=\”\”>Funcional</span></label></div><div><label for=\”cmplz_stats_document\”><input type=\”checkbox\” id=\”cmplz_stats_document\” tabindex=\”0\” class=\”cmplz-consent-checkbox cmplz-svg-checkbox cmplz-square-checkbox cmplz_stats\” data-category=\”cmplz_stats\”><div class=\”cc-check\”><svg width=\”16px\” height=\”16px\” viewBox=\”0 0 18 18\” class=\”cmplz-square\”><path d=\”M1,9 L1,3.5 C1,2 2,1 3.5,1 L14.5,1 C16,1 17,2 17,3.5 L17,14.5 C17,16 16,17 14.5,17 L3.5,17 C2,17 1,16 1,14.5 L1,9 Z\”></path><polyline points=\”1 9 7 14 15 4\”></polyline></svg></div><span class=\”cc-category\” style=\”\”>Estadístiques</span></label></div><div><label for=\”cmplz_marketing_document\”><input type=\”checkbox\” id=\”cmplz_marketing_document\” tabindex=\”0\” class=\”cmplz-consent-checkbox cmplz-svg-checkbox cmplz-square-checkbox cmplz_marketing\” data-category=\”cmplz_marketing\”><div class=\”cc-check\”><svg width=\”16px\” height=\”16px\” viewBox=\”0 0 18 18\” class=\”cmplz-square\”><path d=\”M1,9 L1,3.5 C1,2 2,1 3.5,1 L14.5,1 C16,1 17,2 17,3.5 L17,14.5 C17,16 16,17 14.5,17 L3.5,17 C2,17 1,16 1,14.5 L1,9 Z\”></path><polyline points=\”1 9 7 14 15 4\”></polyline></svg></div><span class=\”cc-category\” style=\”\”>Marqueting</span></label></div><style>#cc-window.cc-window .cmplz-categories-wrap .cc-check svg {stroke: #191e23}</style>”

    And as you can see the translations are present…

    Regards,
    Jordi
    JOINSO

    Plugin Author Aert Hulsebos

    (@aahulsebos)

    Hi @joinso,

    I tried to replicate it here: https://333.abrahamendeleeuw.nl/

    I can’t. So I would suggest deleting all translated Complianz strings, and reset Complianz. Go to cookie banner settings and save the default Spanish banner.

    Then proceed to translate the newly registered strings. If that doesn’t work, I think it might be useful to get WPML involved,

    regards Aert

    Thread Starter joinso

    (@joinso)

    Hi!

    I tested your test and It fails in my side:

    https://pasteboard.co/JulspLo.png

    As you can see the url ends in “ca”, and some strings are translated, but not the categories one.

    I think that the problem is the AJAX call. I think that the language that need to translate the string when the ajax call is processed in backend is not catched properly.
    I debug also the Ajax Call in your side:

    https://333.abrahamendeleeuw.nl/wp-admin/admin-ajax.php?action=cmplz_manage_consent_html_ajax

    And returns always the same (in Catalan or Spanish):

    html: <div><label for="cmplz_functional_document"><input type="checkbox" id="cmplz_functional_document" tabindex="0" class="cmplz-consent-checkbox cmplz-svg-checkbox cmplz-square-checkbox cmplz_functional" checked disabled data-category="cmplz_functional"><div class="cc-check"><svg width="16px" height="16px" viewBox="0 0 18 18" class="cmplz-square"><path d="M1,9 L1,3.5 C1,2 2,1 3.5,1 L14.5,1 C16,1 17,2 17,3.5 L17,14.5 C17,16 16,17 14.5,17 L3.5,17 C2,17 1,16 1,14.5 L1,9 Z"></path><polyline points="1 9 7 14 15 4"></polyline></svg></div><span class="cc-category" style="">Funcional</span></label></div><div><label for="cmplz_stats_document"><input type="checkbox" id="cmplz_stats_document" tabindex="0" class="cmplz-consent-checkbox cmplz-svg-checkbox cmplz-square-checkbox cmplz_stats" data-category="cmplz_stats"><div class="cc-check"><svg width="16px" height="16px" viewBox="0 0 18 18" class="cmplz-square"><path d="M1,9 L1,3.5 C1,2 2,1 3.5,1 L14.5,1 C16,1 17,2 17,3.5 L17,14.5 C17,16 16,17 14.5,17 L3.5,17 C2,17 1,16 1,14.5 L1,9 Z"></path><polyline points="1 9 7 14 15 4"></polyline></svg></div><span class="cc-category" style="">Estadísticas</span></label></div><div><label for="cmplz_marketing_document"><input type="checkbox" id="cmplz_marketing_document" tabindex="0" class="cmplz-consent-checkbox cmplz-svg-checkbox cmplz-square-checkbox cmplz_marketing" data-category="cmplz_marketing"><div class="cc-check"><svg width="16px" height="16px" viewBox="0 0 18 18" class="cmplz-square"><path d="M1,9 L1,3.5 C1,2 2,1 3.5,1 L14.5,1 C16,1 17,2 17,3.5 L17,14.5 C17,16 16,17 14.5,17 L3.5,17 C2,17 1,16 1,14.5 L1,9 Z"></path><polyline points="1 9 7 14 15 4"></polyline></svg></div><span class="cc-category" style="">Mercadeo</span></label></div><style>#cc-window.cc-window .cmplz-categories-wrap .cc-check svg {stroke: #191e23}</style>

    Also, I do your suggestion but it does not work.

    Regards,
    Jordi
    JOINSO

    Thread Starter joinso

    (@joinso)

    Hi!

    I just debuged your code and I can send you more info:

    In /wp-content/plugins/complianz-gdpr/cookiebanner|class-cookiebanner.php

    In this function:

    private function translate( $value, $fieldname)…

    error_log(“Translate (before):”.$value.” – “.$fieldname . $key);
    $value = apply_filters( ‘wpml_translate_single_string’, $value,
    ‘complianz’, $fieldname . $key );
    error_log(“Translate (after):”.$value);
    ….

    And I get this:

    [06-Oct-2020 06:50:36 UTC] Translate (before):Estadístiques – category_stats
    [06-Oct-2020 06:50:36 UTC] Translate (after):Estadístiques

    So, the string are translated.

    So, i repeat, I thin that the problem is in the Ajax Call.

    Regards,
    Jordi
    JOINSO

    Plugin Contributor Rogier Lankhorst

    (@rogierlankhorst)

    We finally were able to reproduce the problem. It appears it always works when logged in, which is why we couldn’t reproduce before, apparently WPML uses the user login to get the language.

    Even when logged out, it was hard to reproduce. But I found a relatively simple fix, by passing the lang parameter with the admin-ajax.php URL.

    You can get the fix from github here:
    https://github.com/Really-Simple-Plugins/complianz-gdpr/tree/pass-lang-parameter-with-ajax-calls

    It will be shipped with the next update.

    Let me know if this works for you!

    Rogier

    Thread Starter joinso

    (@joinso)

    Ok.
    Now it works as expected.
    About this:
    “apparently WPML uses the user login to get the language.”: that’s not true.
    All my tests are done without login.

    Regards,
    Jordi
    JOINSO

    Plugin Contributor Rogier Lankhorst

    (@rogierlankhorst)

    Hi @joinso,

    Thanks for confirming the fix! What I meant is: it works always for me when I’m logged in. I guess WPML uses the user language to set the locale in that case.

    When not logged in, WPML does not do this, so I was able to reproduce the issue on one setup after logging out. On another it still worked. Which is why it was difficult to reproduce.

    Thread Starter joinso

    (@joinso)

    Ok.
    And why the categories that are shown in the banner are translated and this ones, no?
    Regards,
    Jordi
    JOINSO

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Category Stats not translated’ is closed to new replies.