/**
  * Switchs the locale from default to the current SS locale and back.
  * This method is called in constructor and destructor.
  * 
  * @param bool $doRestore Should this call restore the locale to the default value?
  * 
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 18.05.2011
  */
 public static function switchLocale($doRestore = true)
 {
     if (!$doRestore && !is_null(self::$localeToRestore)) {
         return;
     }
     if (is_null(self::$localeToRestore)) {
         self::$localeToRestore = setlocale(LC_ALL, null);
         $currentLocale = i18n::get_locale();
     } else {
         $currentLocale = self::$localeToRestore;
         self::$localeToRestore = null;
     }
     // it's a kind of dirty, because this will not match every possible
     // system locale... It works for plain and utf8 locales.
     setlocale(LC_ALL, $currentLocale . '.utf8', $currentLocale . '.UTF-8', $currentLocale);
 }