title: Configuring ASP.NET MVC Attribute Routing for multi language site
body: <p>I'm creating a MVC5 web site that should support multiple languages. The structure of the app is complex so I'm using Attribute Routing only. <code>RouteConfig.cs</code> is very simple:</p>
  
  <pre><code>public static void RegisterRoutes(RouteCollection routes)
  {
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
      routes.MapMvcAttributeRoutes();
  }
  </code></pre>
  
  <p>I want to keep language information in URL by adding language identifier after site name. For English, which is default language, URL should remain "clean". Here are an example:</p>
  
  <pre><code>http://test.com/foo/1/bar/2
  http://test.com/de/foo/1/bar/2
  </code></pre>
  
  <p>My first attempt was to use two <code>RoutePrefix</code> attributes for each controller:</p>
  
  <pre><code>[RoutePrefix("foo")]
  [RoutePrefix("{lang}/foo")]
  </code></pre>
  
  <p>But MVC doesn't allow to use more than one <code>RoutePrefix</code> attribute for a controller.</p>
  
  <p>So now I'm not using <code>RoutePrefix</code> attributes at all, and specify full route for each controller action:</p>
  
  <pre><code>[Route("foo/{a}/bar/{b}")]
  [Route("{lang}/foo/{a}/bar/{b}")]
  </code></pre>
  
  <p>Is there any better way to handle <code>lang</code> route? Ideally I would like to specify in one place only, not for every controller.</p>
  
  <p>PS. I'm setting current thread culture by parsing language route in custom filter.</p>