2011-08-02 00:37:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2011-08-07 13:10:57 +00:00
|
|
|
* @file
|
|
|
|
* Interface translation summary, editing and deletion user interfaces.
|
2011-08-02 00:37:34 +00:00
|
|
|
*/
|
|
|
|
|
2019-07-24 15:48:42 +00:00
|
|
|
use Drupal\Core\Link;
|
2014-09-29 13:41:29 +00:00
|
|
|
use Drupal\Core\Url;
|
2011-08-02 00:37:34 +00:00
|
|
|
|
2012-12-19 22:11:34 +00:00
|
|
|
/**
|
2013-06-16 23:54:01 +00:00
|
|
|
* Prepares variables for translation status information templates.
|
|
|
|
*
|
|
|
|
* Translation status information is displayed per language.
|
|
|
|
*
|
|
|
|
* Default template: locale-translate-edit-form-strings.html.twig.
|
2012-12-19 22:11:34 +00:00
|
|
|
*
|
|
|
|
* @param array $variables
|
|
|
|
* An associative array containing:
|
|
|
|
* - updates: The projects which have updates.
|
|
|
|
* - not_found: The projects which updates are not found.
|
|
|
|
*
|
2014-07-15 11:13:13 +00:00
|
|
|
* @see \Drupal\locale\Form\TranslationStatusForm
|
2012-12-19 22:11:34 +00:00
|
|
|
*/
|
2014-10-22 09:58:00 +00:00
|
|
|
function template_preprocess_locale_translation_update_info(array &$variables) {
|
2015-09-27 12:06:27 +00:00
|
|
|
foreach ($variables['updates'] as $update) {
|
|
|
|
$variables['modules'][] = $update['name'];
|
2012-12-19 22:11:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-06-16 23:54:01 +00:00
|
|
|
* 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.
|
2012-12-19 22:11:34 +00:00
|
|
|
*
|
2013-06-16 23:54:01 +00:00
|
|
|
* Default template: locale-translation-last-check.html.twig.
|
2012-12-19 22:11:34 +00:00
|
|
|
*
|
2014-10-22 09:58:00 +00:00
|
|
|
* @param array $variables
|
2012-12-19 22:11:34 +00:00
|
|
|
* An associative array containing:
|
|
|
|
* - last: The timestamp when the site last checked for available updates.
|
|
|
|
*
|
2014-07-15 11:13:13 +00:00
|
|
|
* @see \Drupal\locale\Form\TranslationStatusForm
|
2012-12-19 22:11:34 +00:00
|
|
|
*/
|
2014-10-22 09:58:00 +00:00
|
|
|
function template_preprocess_locale_translation_last_check(array &$variables) {
|
2012-12-19 22:11:34 +00:00
|
|
|
$last = $variables['last'];
|
2013-06-16 23:54:01 +00:00
|
|
|
$variables['last_checked'] = ($last != NULL);
|
2021-10-06 12:31:49 +00:00
|
|
|
$variables['time'] = $variables['last_checked'] ? \Drupal::service('date.formatter')->formatTimeDiffSince($last) : NULL;
|
2019-07-24 15:48:42 +00:00
|
|
|
$variables['link'] = Link::fromTextAndUrl(t('Check manually'), Url::fromRoute('locale.check_translation', [], ['query' => \Drupal::destination()->getAsArray()]))->toString();
|
2012-12-19 22:11:34 +00:00
|
|
|
}
|