Created
May 3, 2024 10:06
-
-
Save johnny-aroza/9da181a25d27971ef34b5bf775cd8b1e to your computer and use it in GitHub Desktop.
Drupal add Translation through code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $language = \Drupal::languageManager()->getLanguage('es-ar'); | |
| $translatedNode = $entity->addTranslation($language->getId()); | |
| $translatedNode->setTitle('ec-er Title'); | |
| $translatedNode->save(); | |
| dump($translatedNode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment