diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc index e277791..09b8e48 100644 --- a/core/modules/content_translation/content_translation.pages.inc +++ b/core/modules/content_translation/content_translation.pages.inc @@ -27,9 +27,6 @@ function content_translation_overview(EntityInterface $entity) { $base_path = $controller->getBasePath($entity); $edit_path = $controller->getEditPath($entity); - $header = array(t('Language'), t('Translation'), t('Source language'), t('Status'), t('Operations')); - $rows = array(); - if (language_multilingual()) { // If we have a view path defined for the current entity get the switch // links based on it. @@ -48,6 +45,35 @@ function content_translation_overview(EntityInterface $entity) { } } + // Determine which languages have been used as a source for other + // translations. + $language_as_source = array(); + foreach ($languages as $language) { + $langcode = $language->langcode; + + $is_original = $langcode == $original; + // Original has no source. + if (!$is_original && isset($translations[$langcode])) { + // Non-original existing translation in the translation set: keep track + // of the source language. + $source = isset($entity->translation[$langcode]['source']) ? $entity->translation[$langcode]['source'] : ''; + // Note the source language has been used as a source. + $language_as_source[$source] = TRUE; + } + } + + // Only show the translations column if there is more than one source value. + $show_shource_column = count($language_as_source) > 1; + + // Set up the translations table. + if ($show_source_column) { + $header = array(t('Language'), t('Translation'), t('Source language'), t('Status'), t('Operations')); + } + else { + $header = array(t('Language'), t('Translation'), t('Status'), t('Operations')); + } + $rows = array(); + foreach ($languages as $language) { $language_name = $language->name; $langcode = $language->id; @@ -136,7 +162,12 @@ function content_translation_overview(EntityInterface $entity) { $status = t('Not translated'); } - $rows[] = array($language_name, $row_title, $source_name, $status, $operations); + if ($show_source_column) { + $rows[] = array($language_name, $row_title, $source_name, $status, $operations); + } + else { + $rows[] = array($language_name, $row_title, $status, $operations); + } } }