protected function getLanguage()
 {
     $conf = new Config($this->webos);
     if ($this->webos->managers()->get('File')->exists('~/.config/locale.xml')) {
         $conf->load('~/.config/locale.xml');
     }
     if ($conf->exist('language')) {
         $lang = $conf->get('language');
     } else {
         $lang = $this->webos->managers()->get('Translation')->detectLanguage();
         if ($this->webos->getUser()->isConnected()) {
             $conf->set('language', $lang);
             $conf->save('~/.config/locale.xml');
         }
     }
     if ($conf->exist('locale')) {
         $locale = $conf->get('locale');
     } else {
         $locale = $lang;
         if ($this->webos->getUser()->isConnected()) {
             $conf->set('locale', $locale);
             $conf->save('~/.config/locale.xml');
         }
     }
     return array('language' => $lang, 'locale' => $locale);
 }
 /**
  * Afficher l'interface utilisateur (via JavaScript).
  */
 public function run()
 {
     //On detecte la langue du visiteur si elle ne l'est pas
     $conf = new Config($this);
     if ($this->managers()->get('File')->exists('~/.config/locale.xml')) {
         $conf->load('~/.config/locale.xml');
     }
     if ($conf->exist('language')) {
         $this->managers()->get('Translation')->setLanguage($conf->get('language'));
     } else {
         $lang = $this->managers()->get('Translation')->detectLanguage();
         if ($this->user->isConnected()) {
             $conf->set('language', $lang);
             $conf->save('~/.config/locale.xml');
         }
     }
     //On recupere les fichiers JavaScript de base a inclure
     $jsIncludes = $this->_getJsBootFiles();
     ob_start();
     //On inclut le layout (structure HTMl de base)
     require 'boot/includes/layout.php';
     $out = ob_get_contents();
     ob_end_clean();
     //On ajoute le HTML genere a la reponse HTTP
     $this->getHTTPResponse()->addContent($out);
     //On envoie la reponse HTTP
     $this->getHTTPResponse()->send();
 }
 /**
  * Recuperer un parametre de configuration.
  * @param string $path Le chemin vers le fichier de configuration.
  * @param string $index Le parametre de configuration a recuperer.
  * @throws InvalidArgumentException
  */
 protected function get($path, $index)
 {
     $config = new Config($this->webos);
     $config->load($path);
     if (!$config->exist($index)) {
         throw new InvalidArgumentException('Le parametre de configuration "' . $index . '" est introuvable dans "' . $path . '"');
     }
     return array('value' => $config->get($index));
 }