Find records depdnds on transalte behaviour

I have two languages and I save the data depends on I 18n.
the English saved in a table and the transition saved in I 18n
when I search for a specific word in the translate table,
there is no any result
I see this code

if ($this->request->is([‘post’, ‘put’])) {

        I18n::setLocale('eng');

        $data = $this->request->getData();

        $products =  $this->Products->find('all')

        ->Where(['Products.name LIKE' =>'%'.$data['product'].'%'])->limit(10)

        ->toArray();
        $this->set('products', $products);

        $this->set('data', $data);

        $this->set('title', __('Search For :').$data['product']);

    }

There are data end every thing ok ,

Get the exact string your query builder is making, and check that it is what you expect it to be.
Type that into MyPhpAdmin or Adminer, or whatever DB tool your using to see if a result actually comes out.
Its possible also that the Collation of that table [eg. utf8_general_ci, latin1_swedish_ci] isn’t correct, perhaps not supporting the unicode / diacritics in use.

1 Like