Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How is OSC choosing the right language from OS settings?


arbocenc

Recommended Posts

Hello,

 

I wonder how is OScommerce selecting the right language (if your shop has two or more languages) from each customers'operative system settings? In my shop I've got two languages: Catalan and Spanish and OSC is showing the shop in the right customer's language. How is it doing it?

 

Regards,

 

Joan

[email protected]

www.delaterra.net

organic food in Catalonia

Link to comment
Share on other sites

I have understood that you set one language as default in your admin page. Like I have Japanese and English, and Japanese is set as default language, so the catalog always loads in Japanese.

Link to comment
Share on other sites

In application_top.php

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();

So, if you set your default language to french but your browser in english, when you open the store the language will be english unless you comment out the above code

 

HTH

The_Bear

Link to comment
Share on other sites

Hi Bear,

 

I've seen this code too. It uses a class file (classes/language.php).

 

I want to do the same with my previous web files (outside the shop), and I get it with this code:

<?php

$pos = eregi ("ca", $HTTP_ACCEPT_LANGUAGE);

if ($pos == true) {

   include('index.htm');

}

else{



   $pos2 = eregi ("es", $HTTP_ACCEPT_LANGUAGE);

   if ($pos2 == true) {

       include('castellano/index.htm');

   }

   else{

   include('index.htm');

   }

}

?>

 

I work with two languages:

 

ca: Catalan (the main language)

es: Spanish (the second one)

[email protected]

www.delaterra.net

organic food in Catalonia

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...