How to set and handle language in react-router from?
<p>I have been trying to resolve this all day and finally i come to you all.</p>

<p>The task is simple, I need to set language type in the URL, so it looks something like this: domain.com/{langVar}/other/paths</p>

<p>And be able to change it by clicking/selecting language in my apps header or any other component.</p>

<p>Important: the language variable should always remain in the URL.</p>

<p>I am using "react-router": "^2.7.0", "react": "^15.3.1".</p>

<p>This is how my router config looks like:</p>

<pre><code>export default (
  &lt;Router history={browserHistory}&gt;
    &lt;Route path="/:lang" component={MainApp}&gt;
      &lt;IndexRoute component={Home} /&gt;
      &lt;Route component={OtherPage} /&gt;
    &lt;/Route&gt;
    &lt;Route path='*' component={NotFound} /&gt;
  &lt;/Router&gt;
);
</code></pre>

<p>I hope this makes, sense if not i will update my question. But to me this seems a pretty normal use case of sites URL.</p>

<p>Thank you</p>