Hi Alby
After asking a few dumb questions I now have 2 sites running using mle and think it's great. However this morning I find I have the exact problem described in this thread.
My error messages are as follows:
Notice: Undefined index: locale_cms in /home/gwaenysg/public_html/include.php on line 229
Notice: Undefined index: locale in /home/gwaenysg/public_html/include.php on line 230
I have checked the include.php file for the relelvant lines and find:
// Start MLE
$hl = '';
$mleblock = '';
$mlelocale = '';
$mlelocale_cms = '';
if(file_exists(cms_join_path($dirname,'config_lang.php'))) require_once(cms_join_path($dirname,'config_lang.php'));
if(isset($hls))
{
require_once(cms_join_path($dirname,'mle','function.mle.php'));
$mle = '';
if($config['internal_pretty_urls']) $mle = check_mle_pretty_urls($hls);
if(!empty($_POST['hl'])) $mle = $_POST['hl'];
if(!empty($_GET['hl'])) $mle = $_GET['hl'];
if( (! empty($mle)) && in_array($mle, array_keys($hls)) )
{
$hl = $mle;
if(isset($CMS_ADMIN_PAGE)) setcookie('mle_admin', $hl, time()+3600, '/');
elseif( (empty($_COOKIE['mle'])) || ($hl != $_COOKIE['mle']) ) setcookie('mle', $hl, time()+86400, '/');
}
elseif( (isset($CMS_ADMIN_PAGE)) && (isset($_COOKIE['mle_admin'])) ) $hl = $_COOKIE['mle_admin'];
elseif( (! isset($CMS_ADMIN_PAGE)) && (isset($_COOKIE['mle'])) ) $hl = $_COOKIE['mle'];
else
{
if(isset($CMS_ADMIN_PAGE))
{
$mlelocale_cms = get_preference($gCms->variables['user_id'], 'default_cms_language');
if(! empty($mlelocale_cms))
{
if(in_array($mlelocale_cms, array_keys($hls))) $hl = $mlelocale_cms;
else
{
$t_hls = transform_language_arr($hls);
if(in_array($mlelocale_cms, array_keys($t_hls['locale']))) $hl = $t_hls['locale']["$mlelocale_cms"];
}
}
elseif(in_array(DEFAULT_LANG, array_keys($hls))) $hl = DEFAULT_LANG;
else die('Check DEFAULT_LANG and language array sintax in config_lang.php!');
setcookie('mle_admin', $hl, time()+3600, '/');
}
else
{
if( (! isset($force_mle_default)) || (! $force_mle_default) ) $hl = language_user_setting($hls);
else $hl = DEFAULT_LANG;
setcookie('mle', $hl, time()+86400, '/');
}
}
$mleblock = '_'. $hls[$hl]['block'];
$mlelocale_cms = ($hls[$hl]['locale_cms'])?$hls[$hl]['locale_cms']:$hl;
$mlelocale = ($hls[$hl]['locale'])?$hls[$hl]['locale']:$mlelocale_cms;
$mleparent = ($hls[$hl]['parent'])?$hls[$hl]['parent']:$hls[$hl]['block'];
$mle_translation = cms_join_path($dirname,'mle','lang',$mlelocale_cms.'.php');
if(@is_file($mle_translation))
{
require_once($mle_translation);
$smarty->assign_by_ref('mle_translation', $arr_mlelang);
}
$config['locale'] = $mlelocale_cms;
$gCms->config['locale'] = $mlelocale_cms;
$gCms->current_language = $mlelocale_cms;
$smarty->assign('locale', $mlelocale_cms);
$smarty->assign('currlang', $mleparent); //DEPRECATED
$smarty->assign('parent_lang', $mleparent);
$smarty->compile_id = $hl;
}
// End MLE
and config_lang.php reads:
array(
'block'=> 'DATABASE KEY', //MANDATORY for transform CMSMS in MLE. If there isn't 'parent' then is the PARENT LANGUAGE also
'flag' => 'HTML IMG TAG FOR LOCALE FLAG', //MANDATORY for compatibility
'text' => 'TEXTUAL LANGUAGE', //OPTIONAL use for lang plugin if you don't use flags icon
'parent' => 'PARENT LANGUAGE', //OPTIONAL set for avoid problem with many parent language locale (if you cannot use 'block')
'locale_cms' => 'LOCALE LANGUAGE IN CMSMS', //MANDATORY ONLY if you don't use 'KEY' for locale (ex: 'KEY' is a label)
'locale' => 'SERVER LOCALE', //OPTIONAL set for specific locale server if different from 'KEY' or 'locale_cms'
),
1. Change DEFAULT_LANG to your default language (one of 'KEY' lang) if check browser lang failed
2. OPTIONAL $force_mle_default, switch to true for force initial DEFAULT_LANG
2. Edit following array with your languages
3. Rename to config_lang.php
4. Read README.FIRST file for add languages in database
* ********************************************************************* */
define('DEFAULT_LANG', 'en_GB');
$force_mle_default = true;
$hls = array(
'en_GB' => array(
'block'=>'en',
'flag'=>'',
'text'=>'English',
'parent'=>'en',
),
'cy' => array(
'block'=>'cy',
'flag'=>'',
'text'=>'Cymraeg',
),
);
?>
I don't quite understand how I can fix this from the first question in the thread -
I resolved them, by adding locale and locale_cms assignation in config_lang.php
All was working very well until this morning and I can't think what I may have done to cause this.
Currently using version 1.2 mle - perhaps an upgrade would help? However if there is a way of fixing it first that would be good.
Many thanks in advance
Regards
Lynne