[Resolved]URL Language Code
Mar 27, 2011 8:00 pm by [email protected]
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
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: [Resolved]URL Language Code
Jun 10, 2011 1:09 pm by [email protected]
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
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!
SIMILAR TOPICS
Large numbers of crawl errors with double language code | Jan 24, 2019 1:43 am | Replies: 1 | Post by: natastna2 |
Translate website to any specific language, on page load | Jan 19, 2019 6:49 am | Replies: 1 | Post by: Leaon7756 |
Graphic translation for every language is missing | Dec 19, 2018 7:54 am | Replies: 1 | Post by: Daryl Dixon |
How to remove mobile Language Select Button transparency | Dec 5, 2018 10:06 pm | Replies: 10 | Post by: JeffTR |
Change language automatically | Nov 26, 2018 9:29 pm | Replies: 3 | Post by: Antilb |