Forum Archive - [Resolved]URL Language Code

[Resolved]URL Language Code
Mar 27, 2011 8:00 pm by [email protected]
how do i get the current url language code, when i use $_SERVER['REQUEST_URI'] it brings up everything but that part
Re: URL Language Code
Mar 29, 2011 2:43 pm by Edvard
You can try to add another language code in the rewrite rules, that might work: # 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']
Re: URL Language Code
Mar 29, 2011 4:55 pm by [email protected]
that did the trick thanks :D
Re: [Resolved]URL Language Code
Jun 10, 2011 1:09 pm by [email protected]
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. Enjoy!
URL Language Code
Feb 17, 2012 12:14 pm by andykoa
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? Thanks!


Large numbers of crawl errors with double language codeJan 24, 2019 1:43 amReplies: 1Post by: natastna2
Translate website to any specific language, on page loadJan 19, 2019 6:49 amReplies: 1Post by: Leaon7756
Graphic translation for every language is missingDec 19, 2018 7:54 amReplies: 1Post by: Daryl Dixon
How to remove mobile Language Select Button transparencyDec 5, 2018 10:06 pmReplies: 10Post by: JeffTR
Change language automaticallyNov 26, 2018 9:29 pmReplies: 3Post by: Antilb

Try GTranslate with a free 15 day trial