title: Laravel URL Language Prefix
body: <p>I am trying to set up two languages for my site. I have read around (<a href="http://forumsarchive.laravel.io/viewtopic.php?id=7458" rel="nofollow">http://forumsarchive.laravel.io/viewtopic.php?id=7458</a>, <a href="http://laravel.io/forum/02-20-2014-how-to-make-switching-language-button" rel="nofollow">http://laravel.io/forum/02-20-2014-how-to-make-switching-language-button</a>) and I can't seem to get the prefix part of it working.</p>
  
  <p>The default language if set or selected:</p>
  
  <pre><code>/news
  </code></pre>
  
  <p>If Chinese is selected:</p>
  
  <pre><code>/zh/news
  </code></pre>
  
  <p>My filters.php:</p>
  
  <pre><code>App::before(function($request) {
      // default browser language
      $language = substr($request-&gt;server-&gt;get('HTTP_ACCEPT_LANGUAGE'), 0, 2);
  
      // language set from route
      if (null !== $request-&gt;segment(1)) {
          $routeLanguage = $request-&gt;segment(1);
          if (in_array($routeLanguage, Config::get('app.languages'))) {
              $language = $routeLanguage;
          }
      }
      //return $language;
      // set the language
      Config::set('app.locale', $language);
      App::setLocale($language);
  });
  </code></pre>
  
  <p>The language selector:</p>
  
  <pre><code>class LanguageController extends BaseController {
  
      public function select($lang) {
          Session::put('lang', $lang);
  
          return Redirect::route('home');
      }
  
  }
  </code></pre>
  
  <p>And my routes.php:</p>
  
  <pre><code>Route::get('/', array('uses' =&gt; 'HomeController@home', 'as' =&gt; 'home'));
  
  Route::get('language/{lang}', array(
      'as' =&gt; 'language.select',
      'uses' =&gt; 'LanguageController@select'
          )
  );
  </code></pre>
  
  <p>My two language links are setting the variable correctly, but I don't know how to finish it off the way I want (I want the language slug in the URL for SEO reasons).</p>
  
  <p>How can I achieve this?</p>