summaryrefslogtreecommitdiff
path: root/framework/I18N/TGlobalizationAutoDetect.php
diff options
context:
space:
mode:
authorwei <>2006-01-06 04:42:44 +0000
committerwei <>2006-01-06 04:42:44 +0000
commit4835704a04cf5aa5ec71a8aef902d54b9c6cae82 (patch)
tree39623c082a78db1b3569a12ab54aa751d376af21 /framework/I18N/TGlobalizationAutoDetect.php
parent673d5c08a4d27906864659def27c7783fe45c04f (diff)
Adding I18N support.
Diffstat (limited to 'framework/I18N/TGlobalizationAutoDetect.php')
-rw-r--r--framework/I18N/TGlobalizationAutoDetect.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/framework/I18N/TGlobalizationAutoDetect.php b/framework/I18N/TGlobalizationAutoDetect.php
new file mode 100644
index 00000000..6cf17bcb
--- /dev/null
+++ b/framework/I18N/TGlobalizationAutoDetect.php
@@ -0,0 +1,28 @@
+<?php
+
+Prado::using('System.I18N.core.HTTPNegotiator');
+
+/**
+ * ${classname}
+ *
+ * ${description}
+ *
+ * @author Wei Zhuo<weizhuo[at]gmail[dot]com>
+ * @version $Revision: 1.66 $ $Date: ${DATE} ${TIME} $
+ * @package ${package}
+ */
+class TGlobalizationAutoDetect extends TGlobalization
+{
+ public function init($xml)
+ {
+ parent::init($xml);
+
+ //set the culture according to browser language settings
+ $http = new HTTPNegotiator();
+ $languages = $http->getLanguages();
+ if(count($languages) > 0)
+ $this->Culture = $languages[0];
+ }
+}
+
+?> \ No newline at end of file