blob: 70435e34483d82b64d0c1e1a3ff2abe68bd692d0 (
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 BlogTutorialGlobalization 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);
}
}
}
}
?>
|