diff options
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 |