* @link http://www.pradosoft.com/ * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ * @package Prado\I18N */ namespace Prado\I18N; /** * TGlobalizationAutoDetect class will automatically try to resolve the default * culture using the user browser language settings. * * @author Wei Zhuo * @package Prado\I18N */ class TGlobalizationAutoDetect extends TGlobalization { private $_detectedLanguage; public function init($xml) { parent::init($xml); //set the culture according to browser language settings $http = new core\HTTPNegotiator(); $languages = $http->getLanguages(); if(count($languages) > 0) { $this->_detectedLanguage=$languages[0]; $this->setCulture($languages[0]); } } public function getDetectedLanguage() { return $this->_detectedLanguage; } }