aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--start.php49
1 files changed, 28 insertions, 21 deletions
diff --git a/start.php b/start.php
index a481c8877..1b392dd49 100644
--- a/start.php
+++ b/start.php
@@ -4,6 +4,34 @@
*
*/
+elgg_register_event_handler('init', 'system', 'languages_init');
+
+function languages_init() {
+
+ register_translations(elgg_get_plugins_path() . "languages/languages/es");
+ register_translations(elgg_get_plugins_path() . "languages/languages/nl");
+ register_translations(elgg_get_plugins_path() . "languages/languages/de");
+ register_translations(elgg_get_plugins_path() . "languages/languages/pt");
+ register_translations(elgg_get_plugins_path() . "languages/languages/fr");
+ register_translations(elgg_get_plugins_path() . "languages/languages/ca");
+ register_translations(elgg_get_plugins_path() . "languages/languages/da");
+ register_translations(elgg_get_plugins_path() . "languages/languages/eu");
+ register_translations(elgg_get_plugins_path() . "languages/languages/gl");
+ register_translations(elgg_get_plugins_path() . "languages/languages/it");
+ register_translations(elgg_get_plugins_path() . "languages/languages/ja");
+ register_translations(elgg_get_plugins_path() . "languages/languages/sr");
+ register_translations(elgg_get_plugins_path() . "languages/languages/th");
+ register_translations(elgg_get_plugins_path() . "languages/languages/zh");
+
+ if (!elgg_is_logged_in()) {
+ global $CONFIG;
+ if ($useragent_language = languages_get_useragent_language()) {
+ $CONFIG->language = $useragent_language;
+ }
+ }
+
+}
+
function languages_get_useragent_language() {
global $CONFIG;
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
@@ -25,24 +53,3 @@ function languages_get_useragent_language() {
}
}
-register_translations(elgg_get_plugins_path() . "languages/languages/es", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/nl", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/de", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/pt", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/fr", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/ca", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/da", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/eu", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/gl", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/it", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/ja", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/sr", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/th", true);
-register_translations(elgg_get_plugins_path() . "languages/languages/zh", true);
-
-if (!elgg_is_logged_in()) {
- global $CONFIG;
- if ($useragent_language = languages_get_useragent_language()) {
- $CONFIG->language = $useragent_language;
- }
-} \ No newline at end of file