Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Problem with language fallback in admin.php  (Read 10427 times)

0 Members and 1 Guest are viewing this topic.

Andi

  • VIP
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
  • Join the Future
    • www.pragmamx.org
Problem with language fallback in admin.php
« on: December 14, 2004, 07:14:06 pm »

Hello Team :)

when i change to another language than english, the configuration menue is completely empty. No options are available.

I think there is a conflict between the constants ADMIN_PHP and CONFIG_PHP.
CONFIG_PHP is used for the fallback function, but only ADMIN_PHP is defined in admin.php.

I've write additionaly this line in admin.php:
define('CONFIG_PHP', true);

Not shure if it's the correct solution, but it works for me ;)


admin.php,v 1.15 2004/12/12 10:24:05 gaugau
langfallback.inc.php,v 1.12 2004/12/12 10:24:13 gaugau
« Last Edit: December 28, 2004, 06:54:30 am by GauGau »
Logged
hope, I could help you... :)

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Problem with language fallback in admin.php
« Reply #1 on: December 14, 2004, 08:43:00 pm »

Well spotted.  This was overlooked when I changed the names of the old admin.php (now mode.php) and config.php (now admin.php)

The correct fix is to change it in langfallback.inc.php

Find;
Code: [Select]
// ------------------------------------------------------------------------- //
// File admin.php
// ------------------------------------------------------------------------- //

if (defined('ADMIN_PHP')) {
  $lang_admin_php_en = cpg_get_default_lang_var('lang_admin_php','english');
  $lang_admin_php = array_merge($lang_admin_php_en, $lang_admin_php);
}

if (defined('CONFIG_PHP')) {
  $lang_admin_data_en = cpg_get_default_lang_var('lang_admin_data','english');
  $lang_admin_data = array_merge($lang_admin_data_en, $lang_admin_data);
}

and change it to;
Code: [Select]
// ------------------------------------------------------------------------- //
// File admin.php
// ------------------------------------------------------------------------- //

// ------------------------------------------------------------------------- //
// File admin.php
// ------------------------------------------------------------------------- //

if (defined('ADMIN_PHP')) {
  $lang_admin_php_en = cpg_get_default_lang_var('lang_admin_php','english');
  $lang_admin_php = array_merge($lang_admin_php_en, $lang_admin_php);
}

if (defined('ADMIN_PHP')) {
  $lang_admin_data_en = cpg_get_default_lang_var('lang_admin_data','english');
  $lang_admin_data = array_merge($lang_admin_data_en, $lang_admin_data);
}

Can you please test this works for you.
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

Andi

  • VIP
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
  • Join the Future
    • www.pragmamx.org
Re: Problem with language fallback in admin.php
« Reply #2 on: December 15, 2004, 12:40:02 am »

Yes, it works fine  :D
Logged
hope, I could help you... :)

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Re: Problem with language fallback in admin.php
« Reply #3 on: December 15, 2004, 05:39:54 am »

@Casper - please commit if not already done :)
Logged
SANIsoft PHP applications for E Biz

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Problem with language fallback in admin.php
« Reply #4 on: December 15, 2004, 10:21:33 am »

Fixed and committed.  Version 1.13  ;)
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

Andi

  • VIP
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
  • Join the Future
    • www.pragmamx.org
Re: Problem with language fallback in admin.php
« Reply #5 on: December 24, 2004, 12:47:09 am »

Hello :)

Embarrassingly, but it does not work yet correctly.

here are the error-messages:
Quote
\include\langfallback.inc.php
    * Notice line 152: Undefined variable: lang_admin_data
    * Warning line 152: array_merge() [function.array-merge]: Argument #2 is not an array
    * Warning line 308: array_merge() [function.array-merge]: Argument #2 is not an array
For sample, in german language file the variable  lang_admin_data doesn't exist. This causes that the function array_merge() fails and the variable lang_admin_data is totaly empty.
Similar errors happen also at other opportunities.

I studied myself the file 'langfallback.inc.php' and converted it very extensively.
I added the result here as attachment.

Look at it, maybe it is the better solution?
Logged
hope, I could help you... :)

Andi

  • VIP
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
  • Join the Future
    • www.pragmamx.org
Re: Problem with language fallback in admin.php
« Reply #6 on: December 24, 2004, 02:33:35 am »

updated file...
Logged
hope, I could help you... :)

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Problem with language fallback in admin.php
« Reply #7 on: December 24, 2004, 10:38:53 am »

Andi,

the only correct language file in the 1.4 version is English, none of the others have been brought up to the changes in 1.4 yet, so it will not work, because the other language files are actually 1.3 version files.

Changes such as the move from config.php to admin.php are not in the german.php file, so it will not work.  Once the feature freeze is in place, and the correct new translations are done, it will work.

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Problem with language fallback in admin.php
« Reply #8 on: December 28, 2004, 06:53:36 am »

applied the fix suggested by Andi to admin.php - won't hurt to have
Code: [Select]
define('CONFIG_PHP', true);in the code for a while...
Marking this thread as "fixed".

Joachim
Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: Problem with language fallback in admin.php
« Reply #9 on: May 10, 2005, 11:27:10 pm »

That problem is back :-\\
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Problem with language fallback in admin.php
« Reply #10 on: May 11, 2005, 09:46:39 am »

elaborate, please.
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Problem with language fallback in admin.php
« Reply #11 on: May 11, 2005, 11:39:13 am »

I suspect that Titooy has been affected by the changes made following the problem encountered on this thread;

http://forum.coppermine-gallery.net/index.php?topic=17169.0

I have copied the main post here, as that thread is devs only;

I have found the following problem in langfallback, that will affect all language files.

When the array for admin.php, '$lang_admin_data = array(' is added in the language, you end up with an admin section for each in both english and your language.

I hope the attached screenshot will make it clearer what I mean.

This is caused by this section of code in langfallback;

Code: [Select]
if (defined('ADMIN_PHP')) {
  $lang_admin_data_en = cpg_get_default_lang_var('lang_admin_data','english');
  $lang_admin_data = array_merge($lang_admin_data_en, $lang_admin_data);
}


Obviously, each language will have different array, so langfallback see these as different, and puts in both.

Removing the above code works, but it does mean that this section of code for admin.php will have to be present in every language file.


Please note that every language file must have the relevant section of code to work, as langfallback cannot be used for this without duplicating the output of the entire section.


(http://forum.coppermine-gallery.net/index.php?action=dlattach;topic=17169.0;id=1330;image)
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

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: Problem with language fallback in admin.php
« Reply #12 on: May 11, 2005, 11:27:07 pm »

I presume this is the reason why for now the config options aren't available in any other language than english... (elaboration of the problem ;-) )
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Problem with language fallback in admin.php
« Reply #13 on: May 12, 2005, 11:46:25 am »

Yes, the othe languages are still actually 1.3x versions, and are not 1.4 ready.  The change from config.php to admin.php is the one that affects this particular area, but there are many others that will not work correctly with 1.4.

If you want to use one of these files in the meantime, you can make the following changes;

Find;

Code: [Select]
// ------------------------------------------------------------------------- //
// File admin.php
// ------------------------------------------------------------------------- //

if (defined('ADMIN_PHP')) $lang_admin_php = array(

change it to;

Code: [Select]
// ------------------------------------------------------------------------- //
// File mode.php
// ------------------------------------------------------------------------- //

if (defined('MODE_PHP')) $lang_mode_php = array(


Find;

Code: [Select]
// ------------------------------------------------------------------------- //
// File config.php
// ------------------------------------------------------------------------- //

if (defined('CONFIG_PHP')) $lang_config_php = array(

change it to;

Code: [Select]
// ------------------------------------------------------------------------- //
// File admin.php
// ------------------------------------------------------------------------- //

if (defined('ADMIN_PHP')) $lang_admin_php = array(

Now find;

Code: [Select]
if (defined('CONFIG_PHP')) $lang_config_data = array(
change it to;

Code: [Select]
if (defined('ADMIN_PHP')) $lang_admin_data = array(


Note, these are not all the changes required to these areas by a long way, but will give you the same functions as available in version 1.3x.
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
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 20 queries.