Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Language selection and flags not working.  (Read 6454 times)

0 Members and 1 Guest are viewing this topic.

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Language selection and flags not working.
« on: January 08, 2005, 05:47:47 pm »

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.
« Last Edit: January 13, 2005, 10:49:11 am by Casper »
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Nibbler

  • Guest
Re: Language selection and flags not working.
« Reply #1 on: January 09, 2005, 05:21:04 pm »

Working fine for me.
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Language selection and flags not working.
« Reply #2 on: January 09, 2005, 07:11:45 pm »

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.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Language selection and flags not working.
« Reply #3 on: January 09, 2005, 08:59:07 pm »

I see basically the same thing on my normal devel install

Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Language selection and flags not working.
« Reply #4 on: January 09, 2005, 09:12:23 pm »

me too
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Language selection and flags not working.
« Reply #5 on: January 09, 2005, 09:28:00 pm »

OK, I got it.  It's the code in functions.inc.php to check for charset when doing the select box.

Find this;

Code: [Select]
// 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;

Code: [Select]
// 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
« Last Edit: January 09, 2005, 09:33:41 pm by Casper »
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Nibbler

  • Guest
Re: Language selection and flags not working.
« Reply #6 on: January 10, 2005, 02:03:35 pm »

Your fix gives me 3 blank entries in the language dropdown box.
Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: Language selection and flags not working.
« Reply #7 on: January 10, 2005, 03:51:41 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.
Logged

Nibbler

  • Guest
Re: Language selection and flags not working.
« Reply #8 on: January 10, 2005, 04:24:50 pm »

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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Language selection and flags not working.
« Reply #9 on: January 10, 2005, 08:33:15 pm »

so
Code: [Select]
// 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
Code: [Select]
// 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
Code: [Select]
// 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Language selection and flags not working.
« Reply #10 on: January 13, 2005, 08:37:46 am »

works as expected for me. Can this be marked as "fixed"?

Joachim
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Language selection and flags not working.
« Reply #11 on: January 13, 2005, 10:48:55 am »

And me, marking as fixed.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Nibbler

  • Guest
Re: Language selection and flags not working.
« Reply #12 on: January 17, 2005, 03:04:32 pm »

Anyone actually commited this ?
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Language selection and flags not working.
« Reply #13 on: January 17, 2005, 10:46:47 pm »

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
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Nibbler

  • Guest
Re: Language selection and flags not working.
« Reply #14 on: January 19, 2005, 03:03:38 pm »

Thanks Casper, it's now working properly.
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 20 queries.