multilingual-behavior issue

I am new to Yii.

And I am trying to get multilingual-behavior work for my website.

I am able to make it work for view/edit pages of model by modifying loadModel() method.

But I am not able to make it work for Index/Manage (list) pages pages.

Following is my code in index() method. It is loading default contents only.


$aboutus = new Aboutus();

		$criteria=new CDbCriteria;

		$criteria->condition='deleted=0';

		$localizedCriteria = $aboutus->ml->modifySearchCriteria($criteria);

		$dataProvider=new CActiveDataProvider('Aboutus', array(

		    'criteria'=>$localizedCriteria));

		$this->render('index',array(

			'dataProvider'=>$dataProvider,

		));

Any guidance/ pointer or solution are welcome. Thanks.

Hi,

Never used this extension, but looked through its docs a bit and I’d start with these questions:

  1. do you use defaultScope() as it is stated in docs?

  2. what is your working code?

  3. Regarding notice in docs:

I’d debug extension code to understand what’s going on when you apply criteria modification.

Regards,

Yuga

Hi Yuga,

  1. yes, I have it.

  2. working code? what do you mean? a full project?

  3. okay, will try that.

Thanks,

Nachiket

Hi,

working code:

So I meant working implementation in loadModel().

But I think the best is to start with extension code debugging (relevant method(s)), especially having this vague notice at docs.

Hi, I think you don’t have to use “$localizedCriteria = $aboutus->ml->modifySearchCriteria($criteria);” to localize criteria cause the “deleted” attribute doesn’t seem to be translated.

You can directly use your $criteria object.

If this doesn’t work, maybe the way you define the condition is not right.

Try: “$criteria->compare(‘deleted’,0);”

Hope this helps.

Regards,

Fred

Hi Fred,

What do you mean? can you please provide example?

Thanks