Node content lost after removing initial language

Created on 8 September 2015, over 9 years ago
Updated 24 March 2024, 9 months ago

Problem/Motivation

When a language is removed the content that was created in that language loses it's field content.

Steps to reproduce

  1. Install Drupal in English
  2. Create an English article with some body text.
  3. Enable the Language module
  4. Add a language, make it the default language (admin/config/regional/language).
  5. Remove the English language.
  6. Go to the English article and notice that the body text is gone.
  7. Edit the English article and notice that the body field is empty.

A quick investigation showed that the language code in the field__body and the node tables are, after deleting English, still at 'en'. The confirmation message in step 5 says "Deleting a language will ... and content in this language will be set to be language neutral." But apparently this does not happen.

The English content can be restored by adding English as language (admin/config/regional/language) and rebuilding the cache (drush cr).

Proposed resolution

  • Set the content language to Neutral when removing a language.

Remaining tasks

t.b.d.

User interface changes

None

API changes

t.b.d.

Data model changes

None

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Language system 

Last updated about 14 hours ago

  • Maintained by
  • 🇩🇪Germany @sun
Created by

🇳🇱Netherlands sutharsan

Live updates comments and jobs are added and updated live.
  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand luke.stewart

    Given the elapsed time. Just reconfirming that this seems stlll to be an issue. I have done the following (on 10.2.4)

    Enabled: Content Translation, Language, Interface Translation. Configure related permissions.
    Added the first language that showed up in select here: admin/config/regional/language
    Enabled Content -> Content types Basic Page and Article to be translatable here: admin/config/regional/content-language

    Added a new node of type Basic Page English with something in the body.
    Added a translation for language 2

    Set Language two to default here: /af/admin/config/regional/language
    Deleted Language En here: /af/admin/config/regional/language

    Refresh the node.
    For the default language get the english version not language 2 as might be expected?
    For the previous language 2 page get content not found.

    I want to do more digging to replicate the steps in the original post. However It seems like comments 6 and 8 would perhaps agree that a good solution here is to better inform the user of what is actually occurring rather than add additional behaviour.

Production build 0.71.5 2024