By editor, 28 November, 2015 Question How to translate a node programmatically and how to get a field translated in Drupal 8 Exemples: $translation = $entity->getTranslation('de'); $translation = \Drupal::entityManager()->getTranslationFromContext($entity); $node_es = $node->addTranslation('es'); $node_es->title = 'Mi prueba!'; $node_es->body->value = '<p>El cuerpo de mi nodo.</p>'; $node_es->body->format = 'full_html'; $node_es->save(); Tags Drupal 8 Code Translation Node Comments You must have JavaScript enabled to use this form. Your name Subject Comment About text formats Text format Plain textBasic_html Plain text No HTML tags allowed. Lines and paragraphs break automatically. Web page addresses and email addresses turn into links automatically.
Comments