get('_locale')) { return $this; } $i18n = $this->get('_translations'); $created = false; if (empty($i18n)) { $i18n = []; $created = true; } if ($created || empty($i18n[$language]) || !($i18n[$language] instanceof Entity)) { $i18n[$language] = new Entity(); $created = true; } if ($created) { $this->set('_translations', $i18n); } // Assume the user will modify any of the internal translations, helps with saving $this->dirty('_translations', true); return $i18n[$language]; } }