public function display($thiss) {
$this->setThis($thiss);
$this->getBookId();
Yii::app()->language = 'en_us';
$result = self::model()->findAll(array(
'select'=>'verse_v, number',
'condition'=>'bid=:bid AND chapter=:chapter',
'params'=>array(':bid'=>$this->bid,':chapter'=>$this->chapter),
));
$results = array(
'bid'=>$this->bid,
'bookName'=>Yii::t('BibleBooks','fulltTitles'.$this->bid), //$this->bid = book ID
'chapter'=>$this->chapter);
foreach ($result AS $row) {
$results[] = array(
'number'=>$row['attributes']['number'],
'vowelled_verse'=>$row['attributes']['verse_v']);
}
return $results;
}
and I have a file called BibleBooks.php under protected/messages/en_us/BibleBooks.php
and the file contains:
return array(
'bibleBooks'=>'Bible books',
'theoldTestament'=>'The old testament',
'oldTestament'=>'Old Testament',
'OT'=>'OT',
'thenewTestament'=>'The new testament',
'newTestament'=>'New Testament',
'NT'=>'NT',
'apocrypha'=>'Apocrypha',
// Bible books full title
'fullTitles1'=>'The book of Genesis',
'fullTitles2'=>'The book of Exodus',
'fullTitles3'=>'The book of Leviticus',
'fullTitles4'=>'The book of Numbers',
'fullTitles5'=>'The book of Deuteronomy',
'fullTitles6'=>'The book of Joshua',
'fullTitles7'=>'The book of Judges',
....
My controller calls the model’s results:
public function _display(){
$model = new Bible();
$displayResults = $model->display((object)$this->options);
if(empty($displayResults)) {
throw new Exception('NO RESULTS');
return false;
}
echo $displayResults['bookName'];
foreach($displayResults AS $Res){
$Res['number']." ".$Res['vowelled_verse']."<br />";
}
}
So, echo $displayResults[‘bookName’]; prints: ‘fullTitles2’ instead ‘The book of Exodus’
I feel like this should be a piece of cake, but I’ve been trying for hours!
I noticed that when I set sourceLanguage and I get Exception errors in Russian, so that part works.
I digged a little into core files, nothing seems to be wrong! and I don’t think there should be any bug with the core just with a normal functionality such as Yii::t()! I really like this framework. But it bugs me a lot to get stuck at a silly issue like that