blob: 8fc42e8d051112f04cc63b727e7dff2e0bba9687 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
class QuickStartGlobalization extends TGlobalizationAutoDetect
{
public function init($xml)
{
parent::init($xml);
$this->Application->OnBeginRequest[] = array($this, 'beginRequest');
}
public function beginRequest($sender, $param)
{
if(null == ($culture=$this->Request['lang']))
{
if(null !== ($cookie=$this->Request->Cookies['lang']))
$culture = $cookie->getValue();
}
if(is_string($culture))
{
$info = new CultureInfo();
if($info->validCulture($culture))
{
$this->setCulture($culture);
$this->Response->Cookies[] = new THttpCookie('lang',$culture);
}
}
}
}
?>
|