I have just realised the language selection from the select box or flags is not working, with none of the languages being shown.
So selection can only be done from config, or using the '?lang= ' method.
Working fine for me.
Well I have just re-checked, ran a cvs update, and although the only file updated was in the docs folder, I deleted then re-uploaded every file, so the only modified file in this install is the english_uk.php. I only uploaded a few of the language files, but it illustrates the problem.
See the screenshots below, the one taken in config shows the languages are available, and changing them here works, but the one taken in index.php shows that the only choice given is the reset to default.
I see basically the same thing on my normal devel install
me too
OK, I got it. It's the code in functions.inc.php to check for charset when doing the select box.
Find this;
// get list of available languages
$value = strtolower($CONFIG['lang']);
/*
// is utf-8 selected?
if ($CONFIG['charset'] == 'utf-8') {
$cpg_charset = 'utf-8';
} else {
$cpg_charset = '';
}
*/
$cpg_charset = $CONFIG['charset'];
// extension for the custom encoding files: language-charset.php
$charset_extension = '-'.$cpg_charset;
$lang_dir = 'lang/';
$dir = opendir($lang_dir);
while ($file = readdir($dir)) {
if (is_file($lang_dir . $file) && strtolower(substr($file, -4)) == '.php') {
if (($cpg_charset != 'utf-8' && strstr($file,$charset_extension) == true) || ($cpg_charset == 'utf-8' && strstr($file,$charset_extension) == false))
{
$lang_array[] = strtolower(substr($file, 0 , -4));
}
}
}
closedir($dir);
natcasesort($lang_array);
And cahnge to this;
// get list of available languages
$value = strtolower($CONFIG['lang']);
$lang_dir = 'lang/';
$dir = opendir($lang_dir);
while ($file = readdir($dir)) {
$lang_array[] = strtolower(substr($file, 0 , -4));
}
closedir($dir);
natcasesort($lang_array);
Will commit shortly.
Committed to cvs
Your fix gives me 3 blank entries in the language dropdown box.
Quote from: Nibbler on January 10, 2005, 02:03:35 PM
Your fix gives me 3 blank entries in the language dropdown box.
I presume it's caused by the CVS directory. Since there are 3 files in there, it makes sense... But that files won't there in the final release so I think it's not a problem.
There's also a CVS line in the Theme dropdown box for the same reason.
That accounts for one of the blank entries, the other 2 are caused by '.' and '..' which are not taken care of in the new version.
so// get list of available languages
$value = strtolower($CONFIG['lang']);
$lang_dir = 'lang/';
$dir = opendir($lang_dir);
while ($file = readdir($dir)) {
$lang_array[] = strtolower(substr($file, 0 , -4));
}
closedir($dir);
natcasesort($lang_array);
should be changed to// get list of available languages
$value = strtolower($CONFIG['lang']);
$lang_dir = 'lang/';
$dir = opendir($lang_dir);
while ($file = readdir($dir)) {
if ($file != '.' && $file != '..') {
$lang_array[] = strtolower(substr($file, 0 , -4));
}
}
closedir($dir);
natcasesort($lang_array);
. As there probably won't be a language file named "cvs", we could as well change it to // get list of available languages
$value = strtolower($CONFIG['lang']);
$lang_dir = 'lang/';
$dir = opendir($lang_dir);
while ($file = readdir($dir)) {
if ($file != '.' && $file != '..' && $file !='CVS') {
$lang_array[] = strtolower(substr($file, 0 , -4));
}
}
closedir($dir);
natcasesort($lang_array);
Joachim
works as expected for me. Can this be marked as "fixed"?
Joachim
And me, marking as fixed.
Anyone actually commited this ?
Hmmm,
Well I didn't, but I thought as it was working as expected someone had.
Have just committed the code as suggested by Joachim
Thanks Casper, it's now working properly.