Caching and gTranslate

Popular automatic website translation tool

Caching and gTranslate

Postby challisc » Thu May 03, 2018 6:08 pm

Hi there

I want to show a different image on each translated page.

For example, I want to show a Spanish shopping cart in Spanish, an English shopping cart in English, a French shopping cart in French etc.

The way I have implemented this is to add backend code that determines the language and displays the correct image accordingly

The problems occur when I try to cache these pages. The pages aren’t dynamic at all - static pages with no dynamic elements. But caching using cloudflare, comet cache or any other caching mechanism displays the same shopping cart on all translated page, regardless of the language.
Posts: 6
Joined: Fri Jan 19, 2018 12:40 am

Re: Caching and gTranslate

Postby Yana » Tue May 08, 2018 8:40 pm

This option is available for paid versions. In order to load different images, pdf files or links for each translated language you should add the path of the translated version in tag with data-gt-href-xx attribute where xx is the language code. Here is an example :

For links
<a href="" data-gt-href-fr="" data-gt-href-pt="">Test</a>

For PDF files

<a href="/link-to.pdf" data-gt-href-es="/link-to-Spanish.pdf data-gt-href-ru="/link-to-Russian.pdf ">pdf file</a>

For Images (Images can be changed on GTranslate edit mode also)
<img src="example.jpg" src-fr="example-french.jpg" ... />

Yana Ghahramanyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Posts: 4547
Joined: Thu Jan 12, 2012 6:21 pm

  • Related Topics
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests