Using Orchard {culture} routes

#orchard #culture

Posted by admin on September 01, 2019

As part of the upcoming Orchard CMS 1.9 release, a new feature crept in as part of the localization work that has happened on the 1.x branch, and that is the ability to specify the culture in the route and Orchard will as if by magic use the localized version of that page if its available.

So.. What do I need to do?

There are two ways to use this new feature,

  1. Query parameter ?culture=en-GB

  2. Use Orchard routes.

    new Route("{culture}/foo"

Wonder how it all works? Take a look in to the file DefaultFrontEndCultureSelector.cs

Also note that Orchard will also try to determine the culture if it is a POST, so if you have a generic route with no culture, it will try to determine it from the referer or request path.