Given that I have a node in English as default language and Danish as a translation, is it possible to set the Danish translation as default language for the node?

2 Answers 2


Of course.

I would do it this way:

1) Install of module devel. Drupal7

2) go to drupal/devel/php Of course.


  1. in the textarea add:

//please, change the nid of your node

use Drupal\node\Entity\Node;    

$nid = 1;
$node = Node::load($nid);
$node->get('langcode')->value = 'da';

In Drupal7

  • 2
    A slight variant for Drupal 8 is $node->set('langcode', 'da'); or whatever your code is. I've used this, and it feels a little more proper.
    – beltouche
    Commented Jul 21, 2020 at 0:41

After some looking around, I discovered that you can change the language, as long as there are no other translations on that language.

Therefore, what you can do is

  • Backup your content
  • Delete the non-default translation
  • Edit your node, now under "Language" you should be able to choose the other language as well
  • Select the language you want and then Save

Now your node should have the other language as a default for your node and you can swap the two translations.

This solution is a bit of a hassle since you need to keep a backup for each translation in order to swap them afterwards, but at least there is no code involved.

Finally just to add that even if you try and alter the langcode of the node, it will not allow you to do so if there is an existing translation for that language so still you do not avoid deleting it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.