I have an application done with cakephp, and I have i18n done on the databse, following the instructions on the cakephp book. The thing is that on the table at the index view, I can’t sort by the fields that are translated. The field’s don’t actually exist on the database, so here is where I suppose the problem comes, but I can insert data on the field, so the i18n is working properly.
I’ve tried several ways of setting the paginator, but none work.
For example, I’ve tried:
Paginator->sort('Name','name');
Paginator->sort('Name','I18n__name');
Paginator->sort('Name','I18n__name.content');
As I see, on the queries, it fetches the field refering to it as I18n__name.content’, so I thought this would work, but it doesn’t.
Any suggestions?
I’ve finally found it. I think this should to work out of the box in cakephp. But until they add this, there is a way to make it work.
On the paginatro use the form:
And then, the only thing that needs to be done is add the following function in the model.
And that’s it, now the fields that are translated can be ordered in a paginated table.