/**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     // Swap facades if need be
     if ($this->app['config']->get('polyglot::facades')) {
         Facades\Lang::swap($this->app['polyglot.translator']);
         Facades\Route::swap($this->app['polyglot.router']);
         Facades\URL::swap($this->app['polyglot.url']);
     }
     // Configure gettext
     $locale = $this->app['polyglot.url']->locale();
     if ($locale) {
         $this->app['polyglot.translator']->setInternalLocale($locale);
     }
     // Add i18n Twig extension
     if ($this->app->bound('twig')) {
         $this->app['twig']->addExtension(new Twig_Extensions_Extension_I18n());
     }
 }