Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can i change language from PHP code?


sultanos

Recommended Posts

I need to change the language , by non traditional method, my idea is to check a variable and if that variable is set , then change the language from english to spanish.

 

I just need to know what will be the code to to be placed at aplication_top.php to perform that change.

 

Thanks for the replys

If you are not part of the solution, you are part of the problem

Link to comment
Share on other sites

// 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'];
 }

switch($idiomadireccion){
case 'esp':

HERE IS WHERE I NEED YOUR HELP WHAT SHALL I PUT HERE TO CHANGE LANGUAGE TO SPANISH???

break;
case 'eng':
HERE IS WHERE I NEED YOUR HELP WHAT SHALL I PUT HERE TO CHANGE LANGUAGE TO ENGLISH
break;
case 'ger':
HERE IS WHERE I NEED YOUR HELP WHAT SHALL I PUT HERE TO CHANGE LANGUAGE TO GERMAN
break;
} 


 require(DIR_WS_LANGUAGES . $language . '.php');

 

I have tried with:

 

$language = $lng->english;

$languages_id = $lng->en;

also with

$lng->en;

 

but i get no results or errors

Please i just need the "order" to change the language , this code is found at includes/aplication top.php

If you are not part of the solution, you are part of the problem

Link to comment
Share on other sites

Try this in google

 

site:www.oscommerce.com/forums set language

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

switch($idiomadireccion){

case 'esp':

 

$language = "espanol"

$language_id=2; // verify from database

 

break;

case 'eng':

$language = "english"

$language_id= 1 ;

break;

case 'ger':

$language = "german"

$language_id= 3; // verify from database

break;

}

Best Regards,
Gaurav

Link to comment
Share on other sites

Thanks works fine i updated to my code

 

switch($idiomadireccion[1]){
case 'esp':
$language = 'espanol';
$languages_id = 3;	 
break;
case 'eng':
$language = 'english';
$languages_id = 1;
break;
case 'ger':
$language = 'german';
$languages_id = 2;
break;
}

 

THanks for your help

If you are not part of the solution, you are part of the problem

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...