Previously, Feeds didn't support multilingual fields in imports. Now for every field target that can be set as multilingual using the Entity Translation module, a language can be configured on the Feeds target.
Modules that provide targets that can be multilingual, should now respect the mapping option "language". This option is passed to all mapping target callbacks on the $mapping array. The option is always set and defaults to LANGUAGE_NONE, so checking for existence of the option should not be necessary.
Mapping target callbacks should thus no longer set $entity->{$target}[LANGUAGE_NONE] or $entity->{$target}['und'], but instead $entity->{$target}[$mapping['language']].
Automated test example
If you want to have an automated test for this behaviour in your module, you could take the test from the patch for the email field module as an example: #2672732: Feeds integration: support mapping option "language".
Before
/**
* Mapping target callback.
*/
function mymodule_feeds_set_target(FeedsSource $source, $entity, $target, array $values, array $mapping) {
$field = isset($entity->$target) ? $entity->$target : array(LANGUAGE_NONE => array());
foreach ($values as $value) {
if ($value instanceof FeedsElement) {
$value = $value->getValue();
}
$field[LANGUAGE_NONE][] = array('value' => $value);
}
$entity->$target = $field;
}
After
/**
* Mapping target callback.
*/
function mymodule_feeds_set_target(FeedsSource $source, $entity, $target, array $values, array $mapping) {
$language = $mapping['language'];
$field = isset($entity->$target) ? $entity->$target : array($language => array());
foreach ($values as $value) {
if ($value instanceof FeedsElement) {
$value = $value->getValue();
}
$field[$language][] = array('value' => $value);
}
$entity->$target = $field;
}