diff --git a/mappers/entity_translation.inc b/mappers/entity_translation.inc index eec9e5e..cd6051b 100644 --- a/mappers/entity_translation.inc +++ b/mappers/entity_translation.inc @@ -45,7 +45,7 @@ function entity_translation_feeds_presave(FeedsSource $source, $entity, $item, $ // Avoid invalid user configuration. Entity translation does this when // loading the translation overview page. - if (count($entity->$field_name) === 1 && key($entity->$field_name) === LANGUAGE_NONE) { + if (count($entity->$field_name) === 1 && key($entity->$field_name) === LANGUAGE_NONE && $handler->getLanguage() !== LANGUAGE_NONE) { $entity->{$field_name}[$handler->getLanguage()] = $entity->{$field_name}[LANGUAGE_NONE]; $entity->{$field_name}[LANGUAGE_NONE] = array(); } diff --git a/mappers/locale.inc b/mappers/locale.inc index bc0799b..f1aef3a 100644 --- a/mappers/locale.inc +++ b/mappers/locale.inc @@ -47,7 +47,7 @@ function locale_feeds_summary_callback(array $mapping, array $target, array $for if (!isset($language_options[$mapping['field_language']])) { // This is an invalid configuration that can be caused by disabling or // removing the language in question. - $error = t('Language @lang not available', array('@lang' => $mapping['field_language'])); + $error = t('Language \'@lang\' not available', array('@lang' => $mapping['field_language'])); } // Nothing to see here. diff --git a/tests/feeds_mapper_multilingual_fields.test b/tests/feeds_mapper_multilingual_fields.test index a109f72..a54e979 100644 --- a/tests/feeds_mapper_multilingual_fields.test +++ b/tests/feeds_mapper_multilingual_fields.test @@ -495,6 +495,8 @@ class FeedsMapperMultilingualFieldsTestCase extends FeedsMapperTestCase { 'enabled[fr]' => FALSE, ); $this->drupalPost($path, $edit, t('Save configuration')); + // Reset static cache to update the available languages. + drupal_static_reset(); // Ensure no error messages are shown on the mappings page. $this->drupalGet('admin/structure/feeds/node/mapping'); @@ -530,6 +532,8 @@ class FeedsMapperMultilingualFieldsTestCase extends FeedsMapperTestCase { // Now remove the French language. $path = 'admin/config/regional/language/delete/fr'; $this->drupalPost($path, array(), t('Delete')); + // Reset static cache to update the available languages. + drupal_static_reset(); // Import content. $this->importFile('node', $this->absolutePath() . '/tests/feeds/multilingual_fr.csv');