How to set Smarty languages folder?

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
toplisek
Forum Commoner
Posts: 31
Joined: Tue Apr 11, 2006 1:23 pm

How to set Smarty languages folder?

Post by toplisek »

I have set the following for languages:

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); 
3. In controller index PHP file I like to detect languages for german, english etc.:
<?
$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.
Post Reply