Forums / General / Default language

Default language

Author Message

Carlos Revillo

Tuesday 06 June 2006 9:33:34 am

Hi. I'm working in a site with three languages. I have three siteacces. site_sp, site_fr, site_en

What i want is redirect visitor to one of these siteaccess by the language his browser is.

I mean. If the browser has default language is Spanish, i would like visitor goes to site_sp.
...
And in other cases, visitor goes to site_en.

Sorry for my english, by the way :).

Is there any quick way to do that?.

Thanks.

Kristof Coomans

Tuesday 06 June 2006 10:01:36 am

Hi Carlos

I would make an index page outside of eZ publish, that reads the needed HTTP request header ( Accept-Language I guess ) and let that page redirect to the right site access.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Marc Boon

Wednesday 07 June 2006 2:25:00 pm

You could also use siteaccess based on a server variable directly.
In site.ini.append.php:

[SiteAccessSettings]
AvailableSiteAccessList[]=admin
AvailableSiteAccessList[]=en
AvailableSiteAccessList[]=es
AvailableSiteAccessList[]=fr
MatchOrder=servervar;host
HostMatchType=map
HostMatchMapItems[]=admin.example.com;admin
ServerVariableName=HTTP_ACCEPT_LANGUAGE

In this example you use host access for your admin site, using a subdomain.