Hi there,
I have been been all over the forum and although I can get the translation to work with language files. I would prefer to use a database. I have the following code
array(‘label’=>Yii::t(‘lang’, ‘MENU_LOGIN’), ‘url’=>array(’/site/login’), ‘visible’=>Yii::app()->user->isGuest)
// English
return array (
'MENU_HOME' => 'Home',
'MENU_ABOUT' => 'About',
'MENU_CONTACT' => 'Contact',
'MENU_LOGIN' => 'Login',
'MENU_CUSTOMERS' => 'Customers',
'MENU_USERS' => 'Users',
'MENU_WORKFLOW' => 'Workflow',
'MENU_LANG' => 'Language',
'MENU_LOGOUT' => 'Logout',
);
and also in messages/fr/lang.php
// French
return array (
'MENU_HOME' => 'Acceuil',
'MENU_ABOUT' => 'au sujet de nous',
'MENU_CONTACT' => 'Contact',
'MENU_LOGIN' => 'Login',
'MENU_CUSTOMERS' => 'clients',
'MENU_USERS' => 'utilisateurs',
'MENU_WORKFLOW' => 'opérations',
'MENU_LANG' => 'Language',
'MENU_LOGOUT' => 'Logout',
);
code in a view file
Yii::t(‘lang’, ‘MENU_HOME’);
All the above works but I need to get this working with a database but I can’t get this working. does anyone have a code example please
Cheers
Clive