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: fall back to english when lang not support  (Read 4307 times)

0 Members and 1 Guest are viewing this topic.

alanlai

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 53
    • Goddess
fall back to english when lang not support
« on: April 08, 2009, 09:20:14 pm »

thanks for this great modpack


i would like to know, how to fall back into english if lang file not find?

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: fall back to english when lang not support
« Reply #1 on: April 08, 2009, 10:21:54 pm »

except for the config lang fallback should work

alanlai

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 53
    • Goddess
Re: fall back to english when lang not support
« Reply #2 on: April 09, 2009, 05:02:29 am »

my default language is japanese, but when open PM, nothing can show, it doesn't fall back into english.
i tried the fall back checkbox @ admin config, but it doesn't work.


Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: fall back to english when lang not support
« Reply #3 on: April 09, 2009, 09:58:31 am »

You're right, the language fallback only works if at least the specific array is defined in the language file. If it is not existent at all, no fallback happens. To change this behaviour open include/langfallback.inc.php and replace the code between
Code: [Select]
//Stramm mod
and the final ?>

with

Code: [Select]
//lang loginform
$lang_loginform_en = cpg_get_default_lang_var('lang_loginform','english');
$lang_loginform = check_array_exists('lang_loginform', $lang_loginform_en);


if (defined('AVATAR_PHP')) {
  $lang_avatar_en = cpg_get_default_lang_var('lang_avatar','english');
  $lang_avatar = check_array_exists('lang_avatar', $lang_avatar_en);
}
if (defined('SUBSCRIBE_PHP')) {
  $lang_subscribe_en = cpg_get_default_lang_var('lang_subscribe','english');
  $lang_subscribe = check_array_exists('lang_subscribe', $lang_subscribe_en);
}
if (defined('BUDDY_PHP')) {
  $lang_buddy_en = cpg_get_default_lang_var('lang_buddy','english');
  $lang_buddy = check_array_exists('lang_buddy', $lang_buddy_en);
}
if (defined('PMS_PHP')) {
  $lang_pms_en = cpg_get_default_lang_var('lang_pms','english');
  $lang_pms = check_array_exists('lang_pms', $lang_pms_en);

}
if (defined('CHANGETHUMB_PHP')) {
  $lang_cThumb_en = cpg_get_default_lang_var('lang_cThumb','english');
  $lang_cThumb = check_array_exists('lang_cThumb', $lang_cThumb_en);
}

function check_array_exists($array_name, $array_en){
  if (isset($$array_name)) {
  $$array_name = array_merge($array_en, $$array_name);
  } else {
  $$array_name = $array_en;
  }
  return $$array_name;
}
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 21 queries.