diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-13 10:57:29 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-13 10:57:29 +0000 |
commit | 3f79316c49f73b3c9f2d48a0554c72ded32fdba7 (patch) | |
tree | dd9545c9f17279ed5291f490253cf37af135fa3a /engine/lib | |
parent | 4cb4257d59975a3a8d31513f283589f145fefb19 (diff) | |
download | elgg-3f79316c49f73b3c9f2d48a0554c72ded32fdba7.tar.gz elgg-3f79316c49f73b3c9f2d48a0554c72ded32fdba7.tar.bz2 |
Introducing get_current_language(). Refs #235
git-svn-id: https://code.elgg.org/elgg/trunk@2236 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/languages.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/engine/lib/languages.php b/engine/lib/languages.php index 528ed90e9..acca80c6c 100644 --- a/engine/lib/languages.php +++ b/engine/lib/languages.php @@ -45,7 +45,27 @@ }
return false;
- }
+ } + + /** + * Detect the current language being used by the current site or logged in user. + * + */ + function get_current_language() + { + global $CONFIG; + + if ((isset($_SESSION['user'])) && ($_SESSION['user']->language)) + $language = $_SESSION['user']->language; + + if ((empty($language)) && (isset($CONFIG->language))) + $language = $CONFIG->language; + + if (empty($language)) + $language = 'en'; + + return $language; + }
/**
* Given a message shortcode, returns an appropriately translated full-text string
|