Example #1
0
 /**
  * Sets the locale according to the current language
  *
  * @param string|boolean $locale A language string to use
  *
  * @return string
  */
 public function setInternalLocale($locale = false)
 {
     // If nothing was given, just use current language
     if (!$locale) {
         $locale = $this->getLocale();
     }
     // Base table of locales
     $this->locale = $locale;
     if (method_exists($this->app, 'setLocale')) {
         $this->app->setLocale($locale);
     }
     $locale = $this->shortToLongLocale($locale) . '.' . $this->getEncoding(true);
     // Set locale
     putenv('LC_ALL=' . $locale);
     setlocale(LC_ALL, $locale);
     // Specify the location of the translation tables
     bindtextdomain($this->domain, $this->getTranslationsFolder());
     textdomain($this->domain);
     return $this->getInternalLocale();
 }