function template_preprocess_locale_translation_last_check

template_preprocess_locale_translation_last_check(array &$variables)

Prepares variables for most recent translation update templates.

Displays the last time we checked for locale update data. In addition to properly formatting the given timestamp, this function also provides a "Check manually" link that refreshes the available update and redirects back to the same page.

Default template: locale-translation-last-check.html.twig.

Parameters

array $variables: An associative array containing:

  • last: The timestamp when the site last checked for available updates.

See also

\Drupal\locale\Form\TranslationStatusForm

File

core/modules/locale/locale.pages.inc, line 71
Interface translation summary, editing and deletion user interfaces.

Code

function template_preprocess_locale_translation_last_check(array &$variables) {
  $last = $variables['last'];
  $variables['last_checked'] = ($last != NULL);
  $variables['time'] = \Drupal::service('date.formatter')->formatTimeDiffSince($last);
  $variables['link'] = \Drupal::l(t('Check manually'), new Url('locale.check_translation', array(), array('query' => \Drupal::destination()->getAsArray())));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!locale!locale.pages.inc/function/template_preprocess_locale_translation_last_check/8.1.x