• Hello, we had the gtranslate shortcode working fine, until we tried updating to v3. We were using the Widget Code code, as it allowed us to add an additional language flag for a language we didn’t want gTranslate to translate, instead it linked to a specific URL where we collected manually translated content for that language.

    In this post https://www.ads-software.com/support/topic/development-version-3-0-1-broke-our-site-dropdown-menu/#post-16519833, you write that Widget Code is gone and not coming back, what would be the alternative for our scenario? We have five languages, our “manual language” was in position 2, so we would like to get it back into the list of languages.

    Any solutions would be much appreciated!

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter KS

    (@karl19)

    I could get it to work with:

    <?php echo do_shortcode('[gt-link lang="en" label="" widget_look="flags_name"]'); ?>
    <a href="#" onclick="doGTranslate('en|en');location.;return false;" class="glink nturl notranslate"><img src="/wp-content/plugins/gtranslate/flags/24/fr.png" height="24" width="24" alt="Fran?ais"></a>
    <?php echo do_shortcode('[gt-link lang="de" label="" widget_look="flags_name"]'); ?>
    <?php echo do_shortcode('[gt-link lang="it" label="" widget_look="flags_name"]'); ?>
    <?php echo do_shortcode('[gt-link lang="sv" label="" widget_look="flags_name"]'); ?>

    but it doesn’t look very clean. But perhaps this is the only way to do it, if Widget Code is gone?

    Thread Starter KS

    (@karl19)

    I do still have one problem. Previously I could wrap the gTranslate inside another shortcode – for Borlabs Cookies – like this:

    <?php echo do_shortcode('[borlabs-cookie id="google-translate" type="cookie"][gtranslate][/borlabs-cookie]'); ?>

    and it was possible to show or hide flags, depending on whether cookies were accepted. If I run this now, with gt-link:

    <?php echo do_shortcode('[borlabs-cookie id="google-translate" type="cookie"][gt-link lang="en" label="" widget_look="flags_name"][/borlabs-cookie]'); ?>

    the flags show if I allow cookies, but nothing happens if I click on them. If I look at the HTML, it looks like this:

    <a href="#" data-gt-lang="en" class="gt-current-lang"><img src="/wp-content/plugins/gtranslate/flags/24/en.png" width="24" height="24" alt="en" loading="lazy"> <span></span></a>

    If I don’t wrap the gTranslate shortcode in the Borlabs shortcode, instead it outputs this:

    <a href="#" data-gt-lang="en" class="glink nturl notranslate gt_raw_link-xxjexk gt-current-lang" title="English"><img src="/wp-content/plugins/gtranslate/flags/24/en.png" width="24" height="24" alt="en" loading="lazy"> <span></span></a>

    which works fine. I don’t know if it’s Borlabs or gTranslate that doesn’t play nice with the other plugin?

    Thread Starter KS

    (@karl19)

    Just as a bit of additional info: since I updated both the Borlabs Cookie and gTranslate plugins, I wasn’t sure which plugin caused issues. Keeping Borlabs updated to latest version, but rolling gTranslate back to 2.9.13 and then running:

    <?php echo do_shortcode('[borlabs-cookie id="google-translate" type="cookie"][gtranslate][/borlabs-cookie]'); ?>

    works fine. Running the same code on gTranslate 3.0.3 (or 3.0.1 which I also tried), nothing is output. So it does seem like gTranslate doesn’t cope well being loaded inside another shortcode. And as mentioned above, if running:

    <?php echo do_shortcode('[borlabs-cookie id="google-translate" type="cookie"][gt-link lang="en" label="" widget_look="flags_name"][/borlabs-cookie]'); ?>

    the flags show, but nothing happens if they get clicked. I don’t know what technically is causing this, but it seems like gTranslate doesn’t fully load all its code, when getting loaded inside another shortcode.

    Plugin Author edo888

    (@edo888)

    Hi,

    Using the shortcode to create individual language links is the way to go as you have already done.

    Please consult with Borlabs Cookie for your next question.

    Thanks! ??

    Thread Starter KS

    (@karl19)

    Hi @edo888 many thanks for the reply!

    I was in contact with Borlabs, they said their shortcode doesn’t modify anything that their shortcode blocks. So it’s not their plugin that actively strips out the glink nturl notranslate gt_raw_link-xxjexk classes.

    Their guess was that gTranslate sets these classes with JavaScript on page load, and while in our case the flags only show after cookies are confirmed, this doesn’t happen.

    Could that be the reason? Is there anyway to delay the gTranslate function, until after cookies are confirmed?

    Thread Starter KS

    (@karl19)

    Hello @edo888, would be great with some input on whether GTranslate sets the above classes on page load and if so, if there is a way to delay this process until cookies are confirmed, or a way to reset them. Thanks!

    I have the same question. I can’t get Borlabs Cookie to work with Gtranslate with nested shortcode as mentioned in the comment above. We need a way to reinitialize Gtranslate after consent. Is there any function for this?

    • This reply was modified 1 year, 8 months ago by fruchtfliege.
    Thread Starter KS

    (@karl19)

    Hi @fruchtfliege , did you ever manage to figure this out? There hasn’t been any more input from gTranslate.

    Hi @karl19, no. I have to prevent updates for gtranslate where my clients use it in combination with borlabs cookie, which is a huge security issue.

    Support has to find a way to use gtranslate like in the early releases. This couldn’t be that hard… Please fix this!

    Plugin Author edo888

    (@edo888)

    Hi,

    Please direct your questions about Borlabs Cookie to Borlabs support.

    They are the ones who should investigate why their plugin causes conflicts with GTranslate and offer you a solution.

    Thanks! ??

    Thread Starter KS

    (@karl19)

    Hi @edo888 thanks for the reply, but please see above https://www.ads-software.com/support/topic/widget-code-replacement/#post-16839734.

    Borlabs did look into it and said their shortcode doesn’t block anything.

    Their guess was that gTranslate loads the relevant classes on page load and when it’s delayed through a cookie function, it doesn’t load the correct classes as the page has already loaded. So it seems like gTranslate is causing the issue here, not Borlabs, as they just provide a standard cookie functionality.

    Plugin Author edo888

    (@edo888)

    Hi,

    There shouldn’t be any guesses. They need to find out the root cause specifically.

    I’m not spending my time debugging their plugin.

    Thanks! ??

    @edo888 you are wrong: borlabs cookie just blocks the execution of gtranslate until the user grant consent. To make this work, you have to put your shortcode into the wrapper shortcode of borlabs, like this:

    [borlabs-cookie id="gtranslate" type="cookie"][gtranslate][/borlabs-cookie]

    From gtranslate release 2.9.12 on, this method is not working anymore. It seems that your shortcode can not be initialized “live” after consent. There must have been some changes in newer releases of gtranslate regarding initialization or something. After all, it is nothing borlabs cookie can fix, since it only blocks the shortcode, which worked fine until 2.9.12.

    Maybe you don’t care about GDPR that much, but there are a lot of users in europe who need borlabs cookie to work with gtranslate. I wouldn’t care if it NEVER worked, but it did, as I already mentioned.

    If you are not willed to dive deep in this issue, maybe you could just tell us what changed from 2.9.12 on in a few words.

    Thread Starter KS

    (@karl19)

    I can only concur with @fruchtfliege. It used to work, Borlabs hasn’t changed their setup and I find it a bit disappointing that you get hung up on me saying “Borlabs’ guess is .. ” – they just gave their opinion on why the combination of the two plugins doesn’t work any longer. It doesn’t mean that their plugins breaks the functionality and they have something to fix or that somehow you need to debug their plugin.

    This functionality used to work, for both me and @fruchtfliege , later versions of gTranslate seem to have changed how it gets initialised and this causes issues in relation to cookie control and the GDPR.

    Why is this thread marked as resolved? It isn’t. There were plenty updates for this plugin, but even latest update doesn’t fix this problem.

    @edo888: Please tell me if this topic over for you, so I can give up hope and watch out for another plugin.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Widget code replacement’ is closed to new replies.