shaheer Posted August 22, 2011 Posted August 22, 2011 Dear Users! I have a multilingual website that is causing some problem. When i try to switch the language to Arabic it takes me back to the home page of the website. I want to change it such that if im in some category or some product when i switch the language it remains at the same page and change its language. Can Someone please tell me what should i do. Here is the link: www.glocalizationbiz.com
goldoi Posted August 22, 2011 Posted August 22, 2011 try this in application_top.php, just put // before the lines Code MS1: include(DIR_WS_CLASSES . 'language.php'); $lng = new language($HTTP_GET_VARS['language']); // if (!isset($HTTP_GET_VARS['language'])) $lng->get_browser_language(); $language = $lng->language['directory']; $languages_id = $lng->language['id']; } or this (i think this on) Code 2.x: 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(); } it will disable the automatic language detection.
Guest Posted August 22, 2011 Posted August 22, 2011 That old code is no longer in more recent versions. I think it is safe to say the OP is using v2.3.1 and NOT MS1 Chris
Guest Posted August 22, 2011 Posted August 22, 2011 Shaheer, Being redirected back to the index.php is necessary to refresh the language file. Your customers would normally change language on the index.php anyway so they can read the site in the preferred language from the beginning. Chris
goldoi Posted August 22, 2011 Posted August 22, 2011 for 2.3.1, edit lines 258-276: // 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']; }
germ Posted August 22, 2011 Posted August 22, 2011 Shaheer, Being redirected back to the index.php is necessary to refresh the language file. Your customers would normally change language on the index.php anyway so they can read the site in the preferred language from the beginning. Chris That's not true. The 2.2MS, RC, and 2.3.1 versions of osC don't work that way and a properly coded template shouldn't either. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
shaheer Posted August 24, 2011 Author Posted August 24, 2011 the problem is probably the way it is called in the header.php <!--header starts here--> <script> function selectLang(val) { if(val=='ar') { document.location.href='http://www.glocalizationbiz.com/arabic/index.php?language=ar'; } } </script> <div class="header"> <div class="toplinksBg"><a href="login.php">Sign In</a> | <a href="create_account.php">Register</a> | <a href="shopping_cart.php">Shopping Cart</a> <br class="clear" /> <div align="left" style="padding-left:10px; float:left"><select class="language" onchange="selectLang(this.value)"> <option>Select Language</option> <option value="ar">Arabic</option> <option value="en">English</option> </select></div> how should one make it to follow the url trail? or is their any other code to perform language switch in the drop down menu?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.