Language Redirection according to visitator country
Language Redirection according to visitator country
is there a way to make Language Redirection when a visitator from England visit my site to be automaticly redirected to english version of my site?
http://www.mysite.com/index.php?en_home
or if he comes from germany to be redirected automaticly to : http://www.mysite.com/index.php?de_home
how can I do that?
http://www.mysite.com/index.php?en_home
or if he comes from germany to be redirected automaticly to : http://www.mysite.com/index.php?de_home
how can I do that?
Packging design,labels, catalogs,postcards,
Re: Language Redirection according to visitator country
well it seams that this is not a interesting topic ... or function to discuss about it
Packging design,labels, catalogs,postcards,
Re: Language Redirection according to visitator country
well, this is an interesting question - indeed!
And there is a solution:
Please have a look at /template/inc_scripts/frontend_init/disabled/domaincheck.php
and edit it to your needs. In case you don't succeed just ask again - then instant relief will be yours
And there is a solution:
Please have a look at /template/inc_scripts/frontend_init/disabled/domaincheck.php
and edit it to your needs. In case you don't succeed just ask again - then instant relief will be yours
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Re: Language Redirection according to visitator country
Ah- well, I just detected that you mean the country the visitor is coming from - hmmm, there should be a possibility to check the browser language for example... redirecting per browser language. This would mean that I'll never be able to visit your german part of the site because my browser language is en-US english by default.... hmmmm
Please forget my previous posting for a while
Please forget my previous posting for a while
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Re: Language Redirection according to visitator country
so what is this i18n stuff all about?claus wrote:... would mean that I'll never be able to visit your german part of the site because my browser language is en-US english by default ...
Re: Language Redirection according to visitator country
Hi,
I made this like that:
Make a lang_redirect.php
fit it to your needs and place it where you want eg. /scripts.
Make a new article in the home category and write in the summary:
Enjoy...
This is working here.
Heiko...
I made this like that:
Make a lang_redirect.php
Code: Select all
<?php
if(!$GLOBALS['aktion'][0]) {
switch( strtolower( substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 ) ) ) {
//deutsch
case 'de': header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'de_start.phtml');
exit();
break;
//tschechisch
case 'cs': header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'cs_start.phtml');
exit();
break;
//französisch
case 'fr': header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'fr_start.phtml');
exit();
break;
//japanisch
case 'ja': header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'ja_start.phtml');
exit();
break;
//italienisch
case 'it': header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'it_start.phtml');
exit();
break;
//polnisch
case 'pl': header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'pl_start.phtml');
exit();
break;
//spanisch
case 'es': header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'es_start.phtml');
exit();
break;
//russisch
case 'ru': header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'ru_start.phtml');
exit();
break;
//default -> englisch
default: header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'en_start.phtml');
exit();
}
}
?>
Make a new article in the home category and write in the summary:
Code: Select all
{PHP:scripts/lang_redirect.php}
This is working here.
Heiko...
Re: Language Redirection according to visitator country
I'm sending en_US and I'm getting the german page - so the set of cases has to be extended?
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Re: Language Redirection according to visitator country
If I send en_US, I'm getting the english page.claus wrote:I'm sending en_US and I'm getting the german page - so the set of cases has to be extended?
Browser restartet after language change? Is en_US set as first in the priority?
Heiko
[EDIT]
I can see in phpmyvisites -> entrypages that it works...
[/EDIT]
Re: Language Redirection according to visitator country
my fault - a simple reload of the kangaruuuh doesn't do it - you have to visit the page and it's working (because otherwise this start page with the script cannot be triggered anymore)
Wouldn't it be better then to push it into a frontend render script?
Wouldn't it be better then to push it into a frontend render script?
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Re: Language Redirection according to visitator country
May be, but this is not soooo easy.claus wrote:my fault - a simple reload of the kangaruuuh doesn't do it - you have to visit the page and it's working (because otherwise this start page with the script cannot be triggered anymore)
Wouldn't it be better then to push it into a frontend render script?
If the user is redirectet because of the language settings of the browser but this language is different to his native language (eg. in a internetcafe) he can't switch the language "by hand".
A frontend_render script should only run at the first access per client or should only work in the home-category - too much work .
Hey, this function is only a gimmick, or not?
I know my script is not 100%... too
Heiko...
Re: Language Redirection according to visitator country
is this script working also if I have the link like this:
index.php?en_home
do I have to put it like this in the script:
is that corect?
index.php?en_home
do I have to put it like this in the script:
Code: Select all
break;
//default -> englisch
default: header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'en_home');
exit();
is that corect?
Packging design,labels, catalogs,postcards,
Re: Language Redirection according to visitator country
No!culda_a wrote:is that corect?
That's it:
Code: Select all
//default -> englisch
default: header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'index.php?en_home');
exit();
Re: Language Redirection according to visitator country
thanks... and I can add how many languges i want no restriction?
Packging design,labels, catalogs,postcards,
Re: Language Redirection according to visitator country
No.culda_a wrote:no restriction?
Yes, as long you use the correct syntax...culda_a wrote:thanks... and I can add how many languges i want
Re: Language Redirection according to visitator country
what do you mean by that? in the part where I add the text?and write in the summary:
Packging design,labels, catalogs,postcards,