aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/languages.php22
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