[Solved] Can't always get the language with $_GET['glang']

Popular automatic website translation tool

[Solved] Can't always get the language with $_GET['glang']

Postby makane » Wed Nov 28, 2012 10:39 am

Hi,

At the bottom of every page on my site (http://taulia.com) I'm calling a JavaScript function with the current language, but quite often, even when the site is displaying German, the language is blank. It is almost always blank if you are on any page on the site and click the logo to return to the home page.

The code at the bottom of each page looks like this:
Code: Select all
<script type="text/javascript">fPageLoaded('<?php echo $_GET['glang']; ?>');</script>


And I have these lines in my .htaccess file:
Code: Select all
# gtranslate config
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2&glang=$1 [L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1&glang=$1 [L,QSA]


Any idea how I can always know what language is displaying?

Thanks.
Last edited by makane on Thu Nov 29, 2012 10:01 pm, edited 1 time in total.
makane
 
Posts: 12
Joined: Wed Aug 15, 2012 6:57 am

Re: Can't always get the language with $_GET['glang']

Postby Yana » Wed Nov 28, 2012 9:23 pm

Hi,
joomla holds the language in the session of variable glang. You will be able to get the current language with $_GET['glang']
Regards,

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
Yana
 
Posts: 4135
Joined: Thu Jan 12, 2012 6:21 pm

Re: Can't always get the language with $_GET['glang']

Postby makane » Wed Nov 28, 2012 9:47 pm

Hi Yana,

Sometimes that variable is blank even when the page is in German. Do you know why that might be?

If you go to http://www.taulia.com/de/about and look at the bottom of the page source you will see this: <script type="text/javascript">fPageLoaded('de');</script>

If you then click on the Taulia logo in the upper left to return to the homepage, the page is still in German but at the bottom of the source you see this: <script type="text/javascript">fPageLoaded('');</script>

The variable <?php echo $_GET['glang']; ?> is not being filled in.

Do you know why that might be?

Thanks
makane
 
Posts: 12
Joined: Wed Aug 15, 2012 6:57 am

Re: Can't always get the language with $_GET['glang']

Postby Edvard » Thu Nov 29, 2012 7:34 pm

Hi,

You are using the plugin which holds the variable in session. You need to use JSession::get('glang');
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: 4185
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Can't always get the language with $_GET['glang']

Postby makane » Thu Nov 29, 2012 10:00 pm

Thank you Yana! That did the trick!
makane
 
Posts: 12
Joined: Wed Aug 15, 2012 6:57 am


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux