On file: entity_translation_upgrade.admin.inc
On function : entity_translation_upgrade_do($types, &$context)

On part of the code:

         // Copy field data.
          if ($field['translatable']) {
            $langcode = isset($node->{$field_name}[$node->language]) ? $node->language : LANGUAGE_NONE;
            if (isset($node->{$field_name}[$langcode])) {
              $original->{$field_name}[$node->language] = $node->{$field_name}[$langcode];
            }
          }

On situation
I am upgrading from node based translation with en and es languages

This line :
$langcode = isset($node->{$field_name}[$node->language]) ? $node->language : LANGUAGE_NONE;
Does not completely handle the use case of entity translation upgrades.

Here's more context :
I have current site with 2 languages english and spanish; with english as the default language.

Most field data contains this pattern
entity id, language, body_value
1, 'und','hello world'

I propose to @
2, 'es','mundo como estas'

After the entity translation upgrade the result is:
entity id, language, body_value
1, 'und','hello world'
1, 'es','mundo como estas'

But -- Drupal does not like this on specific configuration builds?? (havent profiled why)
But would work on this:
entity id, language, body_value
1, 'en','hello world'
1, 'es','mundo como estas'

I propose to improve the section copy field data by:

whatever is inside LANGUAGE_NONE put that into the default language of the site.
unset that language_none-- although its prolly useless cause i dont think field_attach_update does deletion??

Comments

chriscalip’s picture

Title: Bug sigthing : Immediate use of default language on field data contents breaks on certain conditions. » Bug sigthing : Use of default language LANGUAGE_NONE on field data contents breaks on certain conditions.
chriscalip’s picture

Issue summary: View changes

html error fix.