Jump to content

problem with language file


pwesthead

Recommended Posts

Hi

can anyone see the problem with this language file, i want my index page to load in portuguese and not english i have set the default to portuguese but keeps loading the index page in english.

here is my code.

session_start();

header('Cache-control: private'); // IE 6 FIX

 

if(isSet($_GET['lang']))

{

$lang = $_GET['lang'];

 

// register the session and set the cookie

$_SESSION['lang'] = $lang;

 

setcookie("lang", $lang, time() + (3600 * 24 * 30));

}

else if(isSet($_SESSION['lang']))

{

$lang = $_SESSION['lang'];

}

else if(isSet($_COOKIE['lang']))

{

$lang = $_COOKIE['lang'];

}

else

{

$lang = 'pg';

}

 

switch ($lang) {

   

  case 'pg':

  $lang_file = 'lang.pg.php';

  break;

 

  case 'en':

  $lang_file = 'lang.en.php';

  break;

 

  case 'fr':

  $lang_file = 'lang.fr.php';

  break;

 

case 'de':

  $lang_file = 'lang.de.php';

  break;

 

  default:

  $lang_file = 'lang.pg.php';

break;

}

 

include_once 'languages/'.$lang_file;

 

Link to comment
https://forums.phpfreaks.com/topic/262980-problem-with-language-file/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.