[Resolved]URL Language Code

Popular automatic website translation tool

[Resolved]URL Language Code

Postby [email protected] » Mon Mar 28, 2011 12:00 am

how do i get the current url language code, when i use $_SERVER['REQUEST_URI'] it brings up everything but that part
Last edited by [email protected] on Thu Mar 31, 2011 1:07 am, edited 1 time in total.
[email protected]
Posts: 11
Joined: Thu Mar 10, 2011 3:34 am

Re: URL Language Code

Postby Edvard » Tue Mar 29, 2011 6:43 pm

You can try to add another language code in the rewrite rules, that might work:

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]

In that case you will be able to get the current language with $_GET['glang']

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

Re: URL Language Code

Postby [email protected] » Tue Mar 29, 2011 8:55 pm

that did the trick thanks :D
[email protected]
Posts: 11
Joined: Thu Mar 10, 2011 3:34 am

Re: [Resolved]URL Language Code

Postby [email protected] » Fri Jun 10, 2011 5:09 pm

Great. It took me a really long time to find this, it would be a great FAQ.

For those following along, in my very recent version of gTranslate for Joomla, my .htaccess already had two very similar lines to the ones Edvard added. Overwrite those with his two. More simlply, you might copy the entire section he provided, and paste it over that section of your .htaccess.

[email protected]
Posts: 28
Joined: Fri Jun 10, 2011 2:43 pm

URL Language Code

Postby andykoa » Fri Feb 17, 2012 4:14 pm

Does not work for me correctly - If I access the current language via $_GET['glang'] it works only for some languages.
Im my case I use DE, EN, FR, SV as selectable languages - it works only if I select FR or SV - otherwise the varibale is empty.
Any suggestions?
Posts: 4
Joined: Fri Feb 10, 2012 6:40 pm

  • Related Topics
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests