diff options
author | wei <> | 2007-01-11 05:06:31 +0000 |
---|---|---|
committer | wei <> | 2007-01-11 05:06:31 +0000 |
commit | 65731b050199ab7ecdd4027fa2d65f2175fe561e (patch) | |
tree | 45998ad5dec4d3caec932d663acc9fed9522f09f /demos/quickstart/protected/QuickStartGlobalization.php | |
parent | 03f362a40a8dd39f8c8b4bf816334922b7b264e4 (diff) |
Add structure for localized quickstart.
Diffstat (limited to 'demos/quickstart/protected/QuickStartGlobalization.php')
-rw-r--r-- | demos/quickstart/protected/QuickStartGlobalization.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/demos/quickstart/protected/QuickStartGlobalization.php b/demos/quickstart/protected/QuickStartGlobalization.php new file mode 100644 index 00000000..6a0b0fb2 --- /dev/null +++ b/demos/quickstart/protected/QuickStartGlobalization.php @@ -0,0 +1,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);
+ }
+ }
+ }
+}
+
+?>
\ No newline at end of file |