Skip to content

Commit

Permalink
bug:2939 switch_lang_to() must reload plugins files
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@23823 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Jul 7, 2013
1 parent 92134bc commit b131654
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion include/functions.inc.php
Expand Up @@ -1209,7 +1209,15 @@ function get_pwg_charset()
function load_language($filename, $dirname = '',
$options = array() )
{
global $user;
global $user, $language_files;

if ( !empty($dirname) and !empty($filename) )
{
if ( empty($language_files[$dirname]) or !in_array($filename,$language_files[$dirname]) )
{
$language_files[$dirname][] = $filename;
}
}

if (! @$options['return'] )
{
Expand Down
10 changes: 9 additions & 1 deletion include/functions_mail.inc.php
Expand Up @@ -192,7 +192,7 @@ function get_str_email_format($is_html)
*/
function switch_lang_to($language)
{
global $switch_lang, $user, $lang, $lang_info;
global $switch_lang, $user, $lang, $lang_info, $language_files;

// explanation of switch_lang
// $switch_lang['language'] contains data of language
Expand Down Expand Up @@ -224,6 +224,14 @@ function switch_lang_to($language)
// No test admin because script is checked admin (user selected no)
// Translations are in admin file too
load_language('admin.lang', '', array('language'=>$language) );

if (!empty($language_files))
{
foreach ($language_files as $dirname => $files)
foreach ($files as $filename)
load_language($filename, $dirname, array('language'=>$language) );
}

trigger_action('loading_lang');
load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR,
array('language'=>$language, 'no_fallback'=>true, 'local'=>true)
Expand Down

0 comments on commit b131654

Please sign in to comment.