1.
Code: Select all
$smarty->lang_dir = ROOT_DIR . "languages"; within file called smarty.inc.php
2. I have created folder called languages in root
in my root file I have config file with defined name path LANG_DIR
Code: Select all
define('DS', DIRECTORY_SEPARATOR);
define('LANG_DIR', ROOT_DIR . 'languages' . DS);
<?
$language = $_GET['lang'];
if($language == 'en-GB')
{
include(ROOT_PATH .'languages/en-GB/index.php');
} elseif ($language == 'de-DE'){
include(ROOT_PATH .'languages/de-DE/index.php');
}
$smarty->assign("title", $lang['Main_title']);
$smarty->dispaly("index.tpl");
?>
include(ROOT_PATH .'languages/'. $language .'/index.php');
$smarty->assign( 'language', $language ); // $language taken from GET ID
Is this correct working code to detect languages with Smarty templates?
Need help.