aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/languages.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/engine/lib/languages.php b/engine/lib/languages.php
index 7aacf5ac5..14692eeb4 100644
--- a/engine/lib/languages.php
+++ b/engine/lib/languages.php
@@ -80,13 +80,12 @@
if ((empty($language)) && ($user) && ($user->language))
$language = $user->language;
- if ((empty($language)) && (isset($CONFIG->language)))
- $language = $CONFIG->language;
-
- if (!empty($language)) {
+ if ((!$language) && ($CONFIG->language))
+ $language = $CONFIG->language;
+
+ if ($language) {
return $language;
- }
-
+ }
return false;
}
@@ -129,7 +128,7 @@
// Get the current language based on site defaults and user preference
$current_language = get_current_language();
-
+
if (isset($CONFIG->debug) && $CONFIG->debug == true) error_log("Translations loaded from : $path");
if ($handle = opendir($path)) {
@@ -242,7 +241,15 @@
return false;
}
-
- register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
-
+
+ /**
+ * Initialise and register language translations.
+ *
+ */
+ function languages_init()
+ {
+ register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
+ }
+
+ register_elgg_event_handler('boot','system','languages_init',11); // Load languages after config.
?> \ No newline at end of file