- 🇳🇿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-languageAdded a new node of type Basic Page English with something in the body.
Added a translation for language 2Set Language two to default here: /af/admin/config/regional/language
Deleted Language En here: /af/admin/config/regional/languageRefresh 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.
- 🇷🇴Romania dianaprecup
I had the same issue on Drupal 10.3.10. I had the default language of a website in Danish, I installed the Norwegian one, selected as default language. When I deleted the Danish one, even if I had a confirmation popup which said that all the Danish content will be updated to the default language, this doesn't happens. The lang code become empty.
My solution to fix this issue was to run the following code in a hook_update_N:$database = \Drupal::database(); $schema = $database->schema()->findTables('%'); foreach ($schema as $table) { if ($database->schema()->fieldExists($table, 'langcode') && $table!='locale_file') { $resultsFound = $database->query("select * from ". $table." where langcode='da'")->fetchAll(); if(count($resultsFound) > 0) { $database->query("update ". $table." set langcode='nb' where langcode='da'")->execute(); } } } and than delete the original default language (Danish). So basically, I am getting all the DB tables, check if there is a langcode field, get all the records form that table and update the value to the new language