Hi,

Similar to the issue http://drupal.org/node/993328 , when creating a new feed item and using the "Set current language as default for new content" option in multilingual settings, the node populates as it should and even the language is set as it should, but the node edit form returns a complete blank. The display of the node fields is fine.

/7

Comments

7wonders’s picture

(shameless bump)

Does anyone know of a workaround to be able to enter the language of the node other than neutral without losing all the node edit fields? Preferably in the way that I describe above using i18n?

Andrey Zakharov’s picture

subscribing

something needs to be done with
mappers/field.inc: 113

  $field = isset($entity->$target) ? $entity->$target : array();
  foreach ($value as $v) {
    if (!is_array($v) && !is_object($v)) {
      $field['und'][$i]['value'] = $v;
    }
    if ($input_format) {
      if (isset($format)) {
        $field['und'][$i]['format'] = $format;
      }
    }

note 'und' here.

marcjpb’s picture

I am pretty new to drupal but after trying different thing related to this and the problem when a imported node is set in english for example, all the field still remains in the undefine language. This cause, when you edit your imported node, to not see anything since your editing an english node with empty english field.

I really needed to be all my stuff in english due to another module bug and all I did was search and replace all the 'und' with 'en' in all the files of the feeds module and it seems to work. Be careful though, I only use feeds to import my D6 content, I dont use any other feature of this module so this "ghetto" fix may have broken stuff outside the importing feature.

7wonders’s picture

Thx marcjpb. It works for getting everything in as english nodes as you say but then trying to change to another language using rules or similar results in the same problem :(

cpelham’s picture

Subcribing.

dgastudio’s picture

same here

tricasse’s picture

Wouldn't this be fixed by using http://drupal.org/project/feeds_et? AFAIK the Feeds module only supports node_translation.

unkn0wn’s picture

Entity Translation have some limitations: for example, XML Sitemap wouldn't work with ET-translated nodes (only with default language), also i had some problems with Tokens - it have no integration with ET (so you cannt fetch ET-translated fields). Entity Translation is a good idea, but now it have poor integration with another modules.

About issue: Feeds import nodes with body language 'und', so you can see body on node page, but cannt edit because of lang differences (curr.lang and "und"). As temporary solution you can made SQL query
UPDATE field_data_body SET language="<lang>" WHERE lang="und";
on database after each import. It was a faster solution for me when i import nodes in 13 languages (each import with different language).

FiNeX’s picture

I'm afraid that the solution proposed by @unkn0wn is still valid: entity translation is on a very incomplete state and it lacks of integration with other modules so we have to play with the content translation.

Anyway it looks that a solution is being worked on http://drupal.org/node/1183440

dawnbuie’s picture

As temporary solution you can made SQL query
UPDATE field_data_body SET language="" WHERE lang="und";
on database after each import. It was a faster solution for me when i import nodes in 13 languages (each import with different language).

unkn0wn - this is the most straight forward answer to this problem I've found.

I'm moving content from a multilingual Drupal 6 install using feeds and XML parser to a new Drupal 7 install. I ofund it bewildering that the language and translation ID could be set properly but my node body could no longer be edited (although it views properly).

Anyway - I don't see why the default setting for feeds is to assume all fields are also of the same language as the node language (en,fr,es etc).

I know we have entities now in D7, which can be of different language translations in one node - but I do't think that should be the default Feeds module assumption. Instead you should need to turn on Entities module and or add a new Feeds plugin to get the per entity language option.

Nodz’s picture

Another workaround I've found is using Feeds Tamper https://drupal.org/project/feeds_tamper. I was doing a csv import (without headers). What I did was add a non existing mapping for language:
Source: 'static' (any non existing string should do)
Mapping: 'Language'

Then in the Tamper tab I added Set Default Value and entered en or de depending on my import.
If you can manually set your language and you know what it is this can work.

I don't have a solution for the Translation ID yet, I might make a Tamper Plugin for it.

travismark’s picture

Issue summary: View changes

Unfortunately feeds tamper still did not worked for me, Even though I have a Language column with values like 'en' on my csv and added a 'Language' mapping to it. I can import but all fields still have a 'und' value on the database. So when editing the node I still got empty values.
Workaround that I did is to implement hook_feeds_presave (). Basically all it does is replace all 'und' on the $entity and put the language get from the csv. Just make sure you have Language mapping with Language codes as values (en,de,zh-hant,zh-hans)

function modulename_feeds_presave(FeedsSource $source, $entity, $item) {
$new_entity = array();
foreach($entity as $key => $val){
if(is_array($val)){
$key2 = array_keys($val);
$val2 = array_values($val);
if($key2[0] == 'und'){
$new_entity[$key][$entity->language] = $val2[0];
$entity->$key = $new_entity[$key];
}
}
}
}

MegaChriz’s picture

Status: Active » Closed (works as designed)

Now that #1183440: Multilingual Feeds - Make field import language-aware is committed, I think this is no longer an issue. Please reopen this issue if I'm wrong.