private function checkLocaleSet() {
		
		if (!$this->defaultLocale) {
			
			$locale = Locale::getDefault();
			$this->defaultLocale = $locale;
			
			// server variable
			setlocale(LC_ALL, $locale->getRepresentation());
			
		}
		
		if (!$this->currentLocale) {
			
			// temporary sets default locale as current
			$this->currentLocale = $this->defaultLocale;
			
			// gets favorite language from browser settings
			if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
			
				preg_match_all('/([[:alpha:]]{1,8})(-([[:alpha:]|-]{1,8}))?' .
						'(\s*;\s*q\s*=\s*(1\.0{0,3}|0\.\d{0,3}))?\s*(,|$)/i',
						$_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches, PREG_SET_ORDER);
			
				// if browser’s lang matches and it’s different by current, will set as current
				if (!isset($matches[0][1]) or $this->currentLocale->getLanguage()->code == $matches[0][1]) {
					return;
				}
				
				$locale = Locale::getDefaultByLanguage($matches[0][1]);
				if (!$locale) {
					return;
				}
				
				$this->setLocale($locale);
					
			}

		}
		
	}
private function checkLocaleSet() {
		
		if (!$this->defaultLocale) {
			
			$locale = Locale::getDefault();
			$this->defaultLocale = $locale;
			
			// server variable
			setlocale(LC_ALL, $locale->getRepresentation());
			
		}
		
		if (!$this->currentLocale) {
			
			// temporary sets default locale as current
			$this->currentLocale = $this->defaultLocale;
			
			// gets favorite language from browser settings
			if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
			
				preg_match_all('/([[:alpha:]]{1,8})(-([[:alpha:]|-]{1,8}))?' .
						'(\s*;\s*q\s*=\s*(1\.0{0,3}|0\.\d{0,3}))?\s*(,|$)/i',
						$_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches, PREG_SET_ORDER);
			
				// if browser’s lang matches and it’s different by current, will set as current
				if (!isset($matches[0][1]) or $this->currentLocale->getLanguage()->code == $matches[0][1]) {
					return;
				}
				
				$locale = Locale::getDefaultByLanguage($matches[0][1]);
				if (!$locale) {
					return;
				}
				
				$this->setLocale($locale);
					
			}

		}
		
	}
private function checkLocaleSet ( ) { if ( ! $ this -> defaultLocale ) { $ locale = Locale :: getDefault ( ) ; $ this -> defaultLocale = $ locale ; // server variable setlocale ( LC_ALL , $ locale -> getRepresentation ( ) ) ; } if ( ! $ this -> currentLocale ) { // temporary sets default locale as current $ this -> currentLocale = $ this -> defaultLocale ; // gets favorite language from browser settings if ( isset ( $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] ) ) { preg_match_all ( '/([[:alpha:]]{1,8})(-([[:alpha:]|-]{1,8}))?' . '(\s*;\s*q\s*=\s*(1\.0{0,3}|0\.\d{0,3}))?\s*(,|$)/i' , $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] , $ matches , PREG_SET_ORDER ) ; // if browser’s lang matches and it’s different by current, will set as current if ( ! isset ( $ matches [ 0 ] [ 1 ] ) or $ this -> currentLocale -> getLanguage ( ) -> code == $ matches [ 0 ] [ 1 ] ) { return ; } $ locale = Locale :: getDefaultByLanguage ( $ matches [ 0 ] [ 1 ] ) ; if ( ! $ locale ) { return ; } $ this -> setLocale ( $ locale ) ; } } }
Check that both default and current locales are set.
Check that both default and current locales are set .