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: Interface shows the wrong language - cookie problem?  (Read 8078 times)

0 Members and 1 Guest are viewing this topic.

smantscheff

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Interface shows the wrong language - cookie problem?
« on: November 06, 2010, 04:53:03 pm »

After a successful test installation on my private server I just installed Coppermine on the production server.
First I copied the test installation to which I had applied some minor changes. Then I recognized that the interface does not show the configured interface language (formal german) but the standard english.
So I dropped this installation and installed a fresh SVN checkout (revision 8014). Same problem.
But: This problem occured only in Google Chrome, not in IE and not in FF. So I deleted all Chrome cookies, and voilá: the desired language showed up. So there seems to be a cookie handling problem somewhere either in Coppermine or in Chrome or both.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Interface shows the wrong language - cookie problem?
« Reply #1 on: November 07, 2010, 08:55:07 pm »

Coppermine has a language detection. It uses the browser's language by default. If you want to overwrite that, you have to add the parameter ?lang=german_formal to e.g. index.php.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Logged

smantscheff

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Interface shows the wrong language - cookie problem?
« Reply #3 on: November 08, 2010, 11:52:30 am »

I had "Automatic language detection" disabled in all my installations. So the expected behaviour was that any language detection automatism was disabled. The implementation is a little bit confusing, especially with a browser like Chrome which does not have a cookie viewing or editing interface.
I also wonder why the "preferred language" cookie seems to have stored standard english. I do not see any language prefererence settings in Chrome. How do you detect the "preferred language" from Chrome?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Interface shows the wrong language - cookie problem?
« Reply #4 on: November 09, 2010, 11:38:39 am »

You can find the language processing in include/init.inc.php:
Code: [Select]
// ********************************************************
// * Language processing --- start
// ********************************************************

require('lang/english.php');                    // Load the default language file: 'english.php'
$CONFIG['lang_config'] = DEFAULT_LANGUAGE;      // Save the gallery-configured setting
$CONFIG['default_lang'] = $CONFIG['lang'];      // Save default language

$enabled_languages_array = array();

$result = cpg_db_query("SELECT lang_id FROM {$CONFIG['TABLE_LANGUAGE']} WHERE enabled='YES'");
while ($row = mysql_fetch_assoc($result)) {
    $enabled_languages_array[] = $row['lang_id'];
}
mysql_free_result($result);

// Process language selection if present in URI or in user profile or try
// autodetection if default charset is utf-8
if ($matches = $superCage->get->getMatched('lang', '/^[a-z0-9_-]+$/')) {
    $USER['lang'] = $matches[0];
}

// Set the user preference to the language submit by URL parameter or by auto-detection
// Only set the preference if a corresponding file language file exists.
if (isset($USER['lang']) && !strstr($USER['lang'], '/') && file_exists('lang/' . $USER['lang'] . '.php')) {
    $CONFIG['lang'] = strtr($USER['lang'], '$/\\:*?"\'<>|`', '____________');
} elseif ($CONFIG['charset'] == 'utf-8' && $CONFIG['language_autodetect'] != 0) {
    include('include/select_lang.inc.php');
    if (file_exists('lang/' . $USER['lang'] . '.php') == TRUE) {
        if (in_array($USER['lang'], $enabled_languages_array)) {
            $CONFIG['lang'] = $USER['lang'];
        }
    }
} else {
    unset($USER['lang']);
}

if (!file_exists("lang/{$CONFIG['lang']}.php")) {
    $CONFIG['lang'] = 'english';
}

// We finally load the chosen language file if it differs from English
if ($CONFIG['lang'] != 'english') {
    require('lang/' . $CONFIG['lang'] . '.php');
}
set_js_var('lang_close', $lang_common['close']);
if (defined('THEME_HAS_MENU_ICONS')) {
    set_js_var('icon_close_path', $THEME_DIR . 'images/icons/close.png');
} else {
    set_js_var('icon_close_path', 'images/icons/close.png');
}

// ********************************************************
// * Language processing --- end
// ********************************************************

It may be that you (as admin) have stored a different language in the cookie, from a time before you changed the default language and disabled language auto detection. Does everything work as expected after the deletion of the cookie? You always can reset the language by adding the lang parameter, e.g.
Code: [Select]
index.php?lang=xxx
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Interface shows the wrong language - cookie problem?
« Reply #5 on: November 11, 2010, 07:27:41 am »

How do you detect the "preferred language" from Chrome?
We can not support you on the usage of a particular browser, but my guess is that one of the following does the trick (found by googling for "Chrome configuration"):
  • about:network
  • about:histograms
  • about:histograms/Loop
  • about:objects
  • about:crash
  • about:hang
  • about:shorthang
  • about:dns
  • about:memory
  • about:cache
  • about:version
  • about:internets
  • about:ipc
Can't say for sure, as I don't have Chrome available for my OS. Anyway, your question is clearly beyond scope on this forum. Both Αndré as well as I have answered your initial question, so what's the actual issue you have? Leave "auto" on for everyone else, it works just fine.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 21 queries.