diff --git a/core/modules/locale/css/locale.admin.css b/core/modules/locale/css/locale.admin.css index 741ab9b..0d1e42e 100644 --- a/core/modules/locale/css/locale.admin.css +++ b/core/modules/locale/css/locale.admin.css @@ -123,6 +123,14 @@ font-size: 0.9em; color: #666; } +.locale-translation-update__details ul { + margin: 0; + padding: 0; +} +.locale-translation-update__details li { + margin: 0 0 0.25em 1.5em; + padding: 0; +} @media screen and (max-width: 40em) { #locale-translation-status-form th.title { width: 20%; diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index c1b61c6..c0e2b65 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -52,52 +52,19 @@ function locale_translation_manual_status() { * @see \Drupal\locale\Form\TranslationStatusForm */ function template_preprocess_locale_translation_update_info(array &$variables) { - $details = array(); - // Build output for available updates. if (isset($variables['updates'])) { - $releases = array(); + $variables['available_updates'] = []; if ($variables['updates']) { foreach ($variables['updates'] as $update) { - $modules[] = $update['name']; - $releases[] = SafeMarkup::format('@module (@date)', array( - '@module' => $update['name'], - '@date' => format_date($update['timestamp'], 'html_date'), - )); - } - $variables['modules'] = $modules; - } - $details['available_updates_list'] = array( - '#theme' => 'item_list', - '#items' => $releases, - ); - } - - // Build output for updates not found. - if (isset($variables['not_found'])) { - $releases = array(); - $variables['missing_updates_status'] = \Drupal::translation()->formatPlural(count($variables['not_found']), 'Missing translations for one project', 'Missing translations for @count projects'); - if ($variables['not_found']) { - foreach ($variables['not_found'] as $update) { - $version = $update['version'] ? $update['version'] : t('no version'); - $releases[] = SafeMarkup::format('@module (@version). @info', array( - '@module' => $update['name'], - '@version' => $version, - '@info' => $update['info'], - )); + $variables['modules'][] = $update['name']; + // Format date for Twig template. + $release = $update; + $release['date'] = \Drupal::service('date.formatter')->format($update['timestamp'], 'html_date'); + $variables['available_updates'][] = $release; } } - $details['missing_updates_list'] = array( - '#theme' => 'item_list', - '#items' => $releases, - ); - // Prefix the missing updates list if there is an available updates lists - // before it. - if (!empty($details['available_updates_list']['#items'])) { - $details['missing_updates_list']['#prefix'] = t('Missing translations for:'); - } } - $variables['details'] = $details; } /** diff --git a/core/modules/locale/templates/locale-translation-update-info.html.twig b/core/modules/locale/templates/locale-translation-update-info.html.twig index 6c53434..b3f81e1 100644 --- a/core/modules/locale/templates/locale-translation-update-info.html.twig +++ b/core/modules/locale/templates/locale-translation-update-info.html.twig @@ -6,12 +6,9 @@ * Displays translation status information per language. * * Available variables: - * - modules: A list of names of modules that have available translation - * updates. - * - details: Rendered list of the translation details. - * - missing_updates_status: If there are any modules that are missing - * translation updates, this variable will contain text indicating how many - * modules are missing translations. + * - modules: A list of modules names that have available translation updates. + * - available_updates: A list of available translation updates. + * - not_found: A list of modules missing translation updates. * * @see template_preprocess_locale_translation_update_info() * @@ -23,10 +20,40 @@ {% if modules %} {% set module_list = modules|safe_join(', ') %} {% trans %}Updates for: {{ module_list }}{% endtrans %} - {% elseif missing_updates_status %} - {{ missing_updates_status }} + {% elseif not_found %} + + {%- trans -%} + Missing translations for one project + {%- plural not_found|length -%} + Missing translations for @count projects + {%- endtrans -%} + {% endif %} - {% if details %} -
{{ details }}
+ {% if available_updates or not_found %} +
+ {% if available_updates %} + + {% endif %} + {% if not_found %} + {# + Prefix the missing updates list if there is an available updates lists + before it. + #} + {% if available_updates %} + {{ 'Missing translations for:'|t }} + {% endif %} + {% if not_found %} + + {% endif %} + {% endif %} +
{% endif %}