2617c61cffecfb6bfcc73be20838d07d7fea8818
[yaffs-website] / Controller / LocaleController.php
1 <?php
2
3 namespace Drupal\locale\Controller;
4
5 use Drupal\Core\Controller\ControllerBase;
6
7 /**
8  * Return response for manual check translations.
9  */
10 class LocaleController extends ControllerBase {
11
12   /**
13    * Checks for translation updates and displays the translations status.
14    *
15    * Manually checks the translation status without the use of cron.
16    *
17    * @return \Symfony\Component\HttpFoundation\RedirectResponse
18    *   A redirection to translations reports page.
19    */
20   public function checkTranslation() {
21     $this->moduleHandler()->loadInclude('locale', 'inc', 'locale.compare');
22
23     // Check translation status of all translatable project in all languages.
24     // First we clear the cached list of projects. Although not strictly
25     // necessary, this is helpful in case the project list is out of sync.
26     locale_translation_flush_projects();
27     locale_translation_check_projects();
28
29     // Execute a batch if required. A batch is only used when remote files
30     // are checked.
31     if (batch_get()) {
32       return batch_process('admin/reports/translations');
33     }
34
35     return $this->redirect('locale.translate_status');
36   }
37
38   /**
39    * Shows the string search screen.
40    *
41    * @return array
42    *   The render array for the string search screen.
43    */
44   public function translatePage() {
45     return [
46       'filter' => $this->formBuilder()->getForm('Drupal\locale\Form\TranslateFilterForm'),
47       'form' => $this->formBuilder()->getForm('Drupal\locale\Form\TranslateEditForm'),
48     ];
49   }
50
51 }