[ic] Setting the locale while coming from another domain
Stefan Hornburg
racke at linuxia.de
Thu Jun 28 04:33:48 EDT 2007
Ton Verhagen wrote:
> Dear All,
>
> I am using a .com domain (e.g. www.mydomain.com) with default locale set
> to en_US.
>
> The catalog running on this domain can be accessed by:
> www.mydomain.com/cgi-bin/shop .
> The DirectoryIndex for this domain has been set to:
> /cgi-bin/shop/index.html
>
>
> Now I would like to access this catalog from different domains while
> setting the
> locale for those domains at first entry.
>
> E.g.
> www.mydomain.de ---->
> www.mydomain.com/cgi-bin/shop/process/locale/de_DE/page/index.html
> www.mydomain.fr ---->
> www.mydomain.com/cgi-bin/shop/process/locale/fr_FR/page/index.html
>
> Thus accessing e.g. www.mydomain.de should set the de_DE locale on the
> main domain.
>
>
> I tried the following in Apache's virtual host section for the '.de' and
> '.fr' domains:
>
> Redirect /
> http://www.trendy-jewels.com/tj/eshop/process/locale/de_DE/page/index.html
>
> or
>
> RewriteEngine On
> RewriteRule ^/(.*)
> http://www.domain.com/cgi-bin/shop/process/locale/de_DE/page/index.html [p]
>
>
> Both settings do redirect the user from e.g. www.mydomain.de to the main
> domain www.mydomain.com
> however, the locale will not be set.
>
> When I past the redirect URL in my browser, the locale will be set to
> the one provided in the URL.
>
> Any ideas what I might be missing here?
You could also do the locale initializations in Autoload, example
from http://www.materialboerse.de/:
# check if we enter from an English or a German site
# and set locale accordingly
unless ($Scratch->{locale_initialized}) {
$Scratch->{locale_initialized} = 1;
my $locale = 'de_DE';
my $vhost = $Tag->env('VIRTUAL_HOST') || $Tag->env('SERVER_NAME');
for (split (/\s/, $Variable->{ENGLISH_SITES})) {
if ($_ eq $vhost) {
# need English
$locale = 'en_US';
$Config->{VendURL} = "http://${vhost}$Variable->{CGI_URL}";
last;
}
}
$Tag->setlocale({locale=>$locale,persist=>1});
}
Regards
Racke
--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team
More information about the interchange-users
mailing list