Chris@0: TRUE])->toString()); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Prepares variables for translation status information templates. Chris@0: * Chris@0: * Translation status information is displayed per language. Chris@0: * Chris@0: * Default template: locale-translate-edit-form-strings.html.twig. Chris@0: * Chris@0: * @param array $variables Chris@0: * An associative array containing: Chris@0: * - updates: The projects which have updates. Chris@0: * - not_found: The projects which updates are not found. Chris@0: * Chris@0: * @see \Drupal\locale\Form\TranslationStatusForm Chris@0: */ Chris@0: function template_preprocess_locale_translation_update_info(array &$variables) { Chris@0: foreach ($variables['updates'] as $update) { Chris@0: $variables['modules'][] = $update['name']; Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Prepares variables for most recent translation update templates. Chris@0: * Chris@0: * Displays the last time we checked for locale update data. In addition to Chris@0: * properly formatting the given timestamp, this function also provides a "Check Chris@0: * manually" link that refreshes the available update and redirects back to the Chris@0: * same page. Chris@0: * Chris@0: * Default template: locale-translation-last-check.html.twig. Chris@0: * Chris@0: * @param array $variables Chris@0: * An associative array containing: Chris@0: * - last: The timestamp when the site last checked for available updates. Chris@0: * Chris@0: * @see \Drupal\locale\Form\TranslationStatusForm Chris@0: */ Chris@0: function template_preprocess_locale_translation_last_check(array &$variables) { Chris@0: $last = $variables['last']; Chris@0: $variables['last_checked'] = ($last != NULL); Chris@0: $variables['time'] = \Drupal::service('date.formatter')->formatTimeDiffSince($last); Chris@0: $variables['link'] = \Drupal::l(t('Check manually'), new Url('locale.check_translation', [], ['query' => \Drupal::destination()->getAsArray()])); Chris@0: }