diff options
author | xue <> | 2005-11-19 02:42:35 +0000 |
---|---|---|
committer | xue <> | 2005-11-19 02:42:35 +0000 |
commit | bc1a7e1e3a67537189d30013ea6d5fa4bf98e8e4 (patch) | |
tree | cf4505fc457292ed5499b16d2412bd00ab14a0bd /framework/core.php | |
parent | c2b0b3123d351e1ec96203eb099e35c6d5c6bdc9 (diff) |
Diffstat (limited to 'framework/core.php')
-rw-r--r-- | framework/core.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/framework/core.php b/framework/core.php index 4abba7a9..efaf7f86 100644 --- a/framework/core.php +++ b/framework/core.php @@ -553,7 +553,7 @@ class PradoBase * The languages are returned as an array. Each array element
* represents a single language preference. The languages are ordered
* according to user preferences. The first language is the most preferred.
- * @return array list of user preferred languages.
+ * @return array list of user preferred languages.
*/
public static function getUserLanguages()
{
@@ -573,6 +573,21 @@ class PradoBase }
return $languages;
}
+
+ public static function getPreferredLanguage()
+ {
+ static $language=null;
+ if($language===null)
+ {
+ $langs=Prado::getUserLanguages();
+ $lang=explode('-',$langs[0]);
+ if(empty($lang[0]) || !ctype_alpha($lang[0]))
+ $language='en';
+ else
+ $language=$lang[0];
+ }
+ return $language;
+ }
}
?>
\ No newline at end of file |