diff --git a/lib/Drupal/config_translation/Form/ConfigTranslationManageForm.php b/lib/Drupal/config_translation/Form/ConfigTranslationManageForm.php
index f2b5f8c..3cf2e44 100644
--- a/lib/Drupal/config_translation/Form/ConfigTranslationManageForm.php
+++ b/lib/Drupal/config_translation/Form/ConfigTranslationManageForm.php
@@ -32,6 +32,13 @@ class ConfigTranslationManageForm implements FormInterface {
protected $language;
/**
+ * The language of config translation source.
+ *
+ * @var \Drupal\Core\Language\Language
+ */
+ protected $source_language;
+
+ /**
* An array of base language configuration data keyed by configuration names.
*
* @var array
@@ -51,6 +58,7 @@ class ConfigTranslationManageForm implements FormInterface {
public function buildForm(array $form, array &$form_state, ConfigMapperInterface $group = NULL, Language $language = NULL, array $base_config = NULL) {
$this->group = $group;
$this->language = $language;
+ $this->source_language = $this->group->getConfigGroup()->getLanguageWithFallback();
$this->base_config = $base_config;
foreach ($this->group->getNames() as $id => $name) {
@@ -138,9 +146,16 @@ class ConfigTranslationManageForm implements FormInterface {
// if there are any translatable elements there.
$sub_build = $this->buildConfigForm($element, $config[$key], $base_config[$key], TRUE, $element_key);
if (!empty($sub_build)) {
+ $title = ' ';
+ foreach (array_keys($sub_build) as $title_key) {
+ if (strpos($title_key, 'title') !== FALSE) {
+ $title .= strip_tags($sub_build[$title_key]['source']['#markup']);
+ break;
+ }
+ }
$build[$key] = array(
'#type' => 'details',
- '#title' => t($definition['label']),
+ '#title' => t($definition['label']) . $title,
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
) + $sub_build;
@@ -164,8 +179,8 @@ class ConfigTranslationManageForm implements FormInterface {
'#theme' => 'config_translation_manage_form_element',
);
$build[$element_key]['source'] = array(
- '#markup' => nl2br($base_config[$key]) ?: t('(Empty)'),
- '#title' => t($definition['label']),
+ '#markup' => $base_config[$key] ? ('' . nl2br($base_config[$key] . '')) : t('(Empty)'),
+ '#title' => t($definition['label']) . ' ('. $this->source_language->name . ')',
'#type' => 'item',
);
$rows_words = ceil(str_word_count($value) / 5);
@@ -174,8 +189,9 @@ class ConfigTranslationManageForm implements FormInterface {
$build[$element_key]['translation'] = array(
'#type' => $type,
'#default_value' => $value,
- '#title' => t($definition['label']),
+ '#title' => t($definition['label']) . ' (' . $this->language->name . ')',
'#rows' => $rows,
+ '#attributes' => array('lang' => $this->language->langcode),
);
}
}