How do I change the iframe url for each GTranslated site?

Popular automatic website translation tool

How do I change the iframe url for each GTranslated site?

Postby ferryto.com » Mon Aug 22, 2016 2:35 pm

How do I change the iframe url for each GTranslated site?
Our original site ferryto.com is copying the same iframe to all language sites - ok so far.
So we need to keep the iframe on the .com site as it is.
But have a different iframe string on each of the GTranslated language sites.
Is that possible?

Example:
Original iframe for ferryto.com:
http://www.aferry.co.uk/SearchFerries/? ... ode=SCFT03
Language iframe for Albania:
http://www.aferry.co.uk/SearchFerries/? ... ode=SCFTAL

Thanks in advance for any help.
ferryto.com
 
Posts: 29
Joined: Mon Aug 15, 2016 4:59 pm

Re: How do I change the iframe url for each GTranslated site

Postby Edvard » Mon Aug 22, 2016 11:38 pm

Hi,

You can detect the current selected language and change the iframe src based on it. Here is the documentation:

Detecting selected language
If you want to code something special for individual language you can detect the current selected language and write your code based on that.

You can find the current selected language code from X-GT-Lang request header. If your site is written in PHP you can find it in _SERVER['HTTP_X_GT_LANG'] variable.
Regards,

Edvard Ananyan - 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
Edvard
Site Admin
 
Posts: 4403
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: How do I change the iframe url for each GTranslated site

Postby ferryto.com » Tue Aug 23, 2016 12:27 pm

Hi there,
Good to know i can code something special for the individual language thanks.
However the site is plain .html not written in php.
Where can i find the X-GT-Lang request header on the translated site if i still should look for that?

thanks again
ferryto.com
 
Posts: 29
Joined: Mon Aug 15, 2016 4:59 pm

Re: How do I change the iframe url for each GTranslated site

Postby Edvard » Tue Aug 23, 2016 11:44 pm

Hi,

I do not think it is possible to access request headers with javascript.

However if you have lang attribute for your html tag:
Code: Select all
<html lang="en">

it will be changed when the language changes, so for Spanish it will be:
Code: Select all
<html lang="es">

so you can detect the current language code from there and do the changes with javascript depending on it:
Code: Select all
jQuery('html').attr('lang')


Thanks!
Regards,

Edvard Ananyan - 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
Edvard
Site Admin
 
Posts: 4403
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 2 guests