aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2012-12-04 21:33:29 -0300
committerhellekin <hellekin@cepheide.org>2012-12-04 21:33:29 -0300
commit9a97bb727e382bcec0d6ba153511fc5065d8a648 (patch)
treebf79bad3310038301941cb93f814e5714be9baf7 /start.php
parentb26651029c05fcc82cd9e1d7f9cde09054307788 (diff)
downloadelgg-9a97bb727e382bcec0d6ba153511fc5065d8a648.tar.gz
elgg-9a97bb727e382bcec0d6ba153511fc5065d8a648.tar.bz2
Be nice to other plugins (fixes #1534102)
The plugin *must* now come *after* other plugins it should update translation strings for. - Add an init,system handler - Do not force reloading all strings all the time
Diffstat (limited to 'start.php')
-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