fall back to english when lang not support fall back to english when lang not support
 

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]

Main Menu

fall back to english when lang not support

Started by alanlai, April 08, 2009, 09:20:14 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

alanlai

thanks for this great modpack


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

Stramm

except for the config lang fallback should work

alanlai

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

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
//Stramm mod

and the final ?>

with

//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;
}