Search code examples
c#.netepiserver

Setting default language in EPiServer?


I'm looking for a way to set the default language for visitors comming to a site built in EPiServer for the first time. Not just administrators/editors in the backend, people comming to the public site.


Solution

  • Depends on your setup.

    If the site languages is to change under different domains you can do this. Add to configuration -> configSections nodes in web.config:

    <sectionGroup name="episerver">
      <section name="domainLanguageMappings" allowDefinition="MachineToApplication" allowLocation="false" type="EPiServer.Util.DomainLanguageConfigurationHandler,EPiServer" />
    

    ..and add this to episerver node in web.config:

      <domainLanguageMappings>
        <map domain="site.com" language="EN" />
        <map domain="site.se" language="SV" />
      </domainLanguageMappings>
    

    Otherwhise you can do something like this. Add to appSettings in web.config:

    <add name="EPsDefaultLanguageBranch" key="EN"/>