예제 #1
0
파일: RouteListener.php 프로젝트: reliv/rcm
 /**
  * Set the system locale to Site Requirements
  *
  * NOTE: We do NOT set LC_ALL because it causes "n tilde"
  * chars to be not json encodable after they have been strtolower'd
  *
  * @return null
  */
 public function addLocale()
 {
     $locale = $this->currentSite->getLocale();
     /* Conversion for Ubuntu and Mac local settings. */
     if (!setlocale(LC_MONETARY, $locale . '.utf8')) {
         if (!setlocale(LC_MONETARY, $locale . '.UTF-8')) {
             setlocale(LC_MONETARY, 'en_US.UTF-8');
         }
     }
     /* Conversion for Ubuntu and Mac local settings. */
     if (!setlocale(LC_NUMERIC, $locale . '.utf8')) {
         if (!setlocale(LC_NUMERIC, $locale . '.UTF-8')) {
             setlocale(LC_NUMERIC, 'en_US.UTF-8');
         }
     }
     /* Conversion for Ubuntu and Mac local settings. */
     if (!setlocale(LC_TIME, $locale . '.utf8')) {
         if (!setlocale(LC_TIME, $locale . '.UTF-8')) {
             setlocale(LC_TIME, 'en_US.UTF-8');
         }
     }
     \Locale::setDefault($locale);
     return null;
 }