summaryrefslogtreecommitdiff
path: root/framework/I18N/TGlobalizationAutoDetect.php
diff options
context:
space:
mode:
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