diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-08-06 23:37:55 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-08-06 23:37:55 +0200 |
commit | 964bf0b9f511e454700d549f22c736e451c9a58c (patch) | |
tree | 67cdd2e7cd1c1a115fdf313853bc8f794206477b /phpBB/includes/functions_module.php | |
parent | ca110187605d6a651487d95e303bbc3627712d6d (diff) | |
parent | 591d04157e7a346c0021855aff36fa6d061cabff (diff) | |
download | forums-964bf0b9f511e454700d549f22c736e451c9a58c.tar forums-964bf0b9f511e454700d549f22c736e451c9a58c.tar.gz forums-964bf0b9f511e454700d549f22c736e451c9a58c.tar.bz2 forums-964bf0b9f511e454700d549f22c736e451c9a58c.tar.xz forums-964bf0b9f511e454700d549f22c736e451c9a58c.zip |
Merge pull request #2807 from nickvergessen/ticket/12875
[ticket/12875] Find language files in the default and english language
Diffstat (limited to 'phpBB/includes/functions_module.php')
-rw-r--r-- | phpBB/includes/functions_module.php | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 86439ea03f..f17333edda 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -1040,19 +1040,45 @@ class p_master */ function add_mod_info($module_class) { - global $user, $phpEx; - - global $phpbb_extension_manager; + global $config, $user, $phpEx, $phpbb_extension_manager; $finder = $phpbb_extension_manager->get_finder(); - $lang_files = $finder + // We grab the language files from the default, English and user's language. + // So we can fall back to the other files like we do when using add_lang() + $default_lang_files = $english_lang_files = $user_lang_files = array(); + + // Search for board default language if it's not the user language + if ($config['default_lang'] != $user->lang_name) + { + $default_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/' . basename($config['default_lang'])) + ->core_path('language/' . basename($config['default_lang']) . '/mods/') + ->find(); + } + + // Search for english, if its not the default or user language + if ($config['default_lang'] != 'en' && $user->lang_name != 'en') + { + $english_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/en') + ->core_path('language/en/mods/') + ->find(); + } + + // Find files in the user's language + $user_lang_files = $finder ->prefix('info_' . strtolower($module_class) . '_') ->suffix(".$phpEx") ->extension_directory('/language/' . $user->lang_name) ->core_path('language/' . $user->lang_name . '/mods/') ->find(); + $lang_files = array_unique(array_merge($user_lang_files, $english_lang_files, $default_lang_files)); foreach ($lang_files as $lang_file => $ext_name) { $user->add_lang_ext($ext_name, $lang_file); |