diff options
author | hellekin <hellekin@cepheide.org> | 2012-12-04 21:33:29 -0300 |
---|---|---|
committer | hellekin <hellekin@cepheide.org> | 2012-12-04 21:33:29 -0300 |
commit | 9a97bb727e382bcec0d6ba153511fc5065d8a648 (patch) | |
tree | bf79bad3310038301941cb93f814e5714be9baf7 /start.php | |
parent | b26651029c05fcc82cd9e1d7f9cde09054307788 (diff) | |
download | elgg-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.php | 49 |
1 files changed, 28 insertions, 21 deletions
@@ -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 |