Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Failed to change language


Proenski

Recommended Posts

Posted

I've upgraded my shop from 2.2 MS2 to RC2a using the contribution and had some problems getting to the admin section. This is now solved.

 

But for some reason the default language is and remains English no matter what language I select as default from the admin section. Any ideas how to fix this?

Posted

osC uses your browser's language setting to override whatever language setting you have. Just for fun, configure your browser to be the other language, and see if it works now. If it does, that's what someone else should see, so long as their browser isn't configured to use English.

Posted

osC uses your browser's language setting to override whatever language setting you have. Just for fun, configure your browser to be the other language, and see if it works now. If it does, that's what someone else should see, so long as their browser isn't configured to use English.

 

Well I'll be d*... :o

 

You are right! To be honest I find this a bit weird though. Is there anyway I can prevent this from happening? My shop is default set to Dutch and most information isn't even available in other languages...

Posted

I don't know of any way already built into osC. I suspect you would have to modify the language section of application_top.php to not override your default language selection, but to force Dutch. The applicable section of code is this:

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
   if (!tep_session_is_registered('language')) {
     tep_session_register('language');
     tep_session_register('languages_id');
   }

   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language();

   if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
     $lng->set_language($HTTP_GET_VARS['language']);
   } else {
     $lng->get_browser_language();
   }

   $language = $lng->language['directory'];
   $languages_id = $lng->language['id'];
 }

// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');

For some reason, the get_browser_language() method seems to always be invoked. I haven't actually played with this, but perhaps the language element of $HTTP_GET_VARS isn't set for some reason? Anyway, you may be able to force Dutch usage in that section. If you want to allow other languages, I'm not sure how to proceed.

 

If anyone wants to explore this further, they might be able to account for why the variable $language seems to be not getting set on so many systems (i.e., complaints about .../catalog/includes/language/.php not being opened).

Posted

I just turned off the part where it is asks for the browser language and that seems to work fine. My browser language is English but it shows now the Dutch (=default) language:

 

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
   if (!tep_session_is_registered('language')) {
     tep_session_register('language');
     tep_session_register('languages_id');
   }

   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language();

//   if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
//     $lng->set_language($HTTP_GET_VARS['language']);
//   } else {
//     $lng->get_browser_language();
//   }

   $language = $lng->language['directory'];
   $languages_id = $lng->language['id'];
 }

// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...