I18n store values in source table and i18n table

Hey there
We have a table called AppointmentServices were services are stored with name and description. Now we try to make these services multilingual. This works fine with i18n behavior (TranslateBehavior).
After implementing this behavior “name” and “description” in the AppointmentServices are NULL. The values are only stored in i18n table. Which looks very strange. What is the correct way of also store the default values for “name” and “description” in the source table AppointmentServices?

We have found out that using the statement $this->AppointmentServices->locale(‘de_CH’); before saving a service entity does also store the values in the source table.
But this only works on our local servers (MAMP) the ->locale() is ignored on our server (Ubuntu 16.04.5 LTS)

Version: CakePHP 3.5.x

Thanks in advance for the feedback.

What you experince is not the correct behaviour. That means you are missing something. Please read again the cookbook and find out what you are missing.

I think we followed the exact steps from cookbook, using the following code for table, entity and controller

namespace App\Model\Table;
class AppointmentServicesTable extends Table

    public function initialize(array $config)

        $this->addBehavior('Translate', ['fields' => ['name', 'category', 'description']]);


namespace App\Model\Entity;
class AppointmentService extends Entity
    use TranslateTrait;

    protected $_accessible = [
        '*' => true,
        'id' => false

namespace App\Controller;
class AppointmentServicesController extends AppController
    public function add()

        $appointmentService = $this->AppointmentServices->newEntity();
        if ($this->request->is('post')) {


            $appointmentService = $this->AppointmentServices->patchEntity($appointmentService, $this->request->data);
            $appointmentService->partner_id = $this->Auth->user('partner_id');
            if ($this->AppointmentServices->save($appointmentService)) {

                $this->Flash->success(__('Die Dienstleistung wurde erfolgreich hinzugefügt.'));
                return $this->redirect(['controller' => 'partners', 'action' => 'config', '#' => 'services']);
            } else {
                $this->Flash->error(__('Die Dienstleistung konnte leider nicht hinzugefügt werden. Schau dir die Validierungsfehler an und versuche es erneut!'));


        $currentSite = "appointmentServices/add";
        $this->set(compact('appointmentService', 'currentSite'));
        $this->set('_serialize', ['appointmentService']);

I would suggest using ShadowTranslate behavior https://github.com/AD7six/cakephp-shadow-translate instead of the core TranlateBehavior.

1 Like

We have found a solution! In bootstrap.php there is also a setting for default_locale. This was set to App.defaultLocale. If we change it to de_CH the behavior is correct also on server.


Instead of modifying that ini_set() call you should set proper value for App.defaultLocale config in your app.php.

Thanks a lot @ADmad you were absolutely right! Just found out that on local env the App.defaultLocale is set to de_CH and on server it was on en_US.