Loading l10n_community/src/Controller/L10nCommunityLanguagesController.php +19 −16 Original line number Diff line number Diff line Loading @@ -208,6 +208,7 @@ class L10nCommunityLanguagesController extends ControllerBase { * @throws \Drupal\Core\TypedData\Exception\MissingDataException */ public function translate(Group $group): array { $translator = \Drupal::service('l10n_community.translator'); $langcode = $group->get('field_translation_language')->first()->getValue()['target_id']; $language = \Drupal::languageManager()->getLanguage($langcode); Loading @@ -215,31 +216,33 @@ class L10nCommunityLanguagesController extends ControllerBase { $drupal_settings = [ 'l10nServerURLs' => $this->addUrlModifiers($langcode, $filters), ]; // $strings = l10n_community_get_strings($langcode, $filters, $filters['limit']); // $strings = $translator->getStrings($langcode, $filters, $filters['limit']); // Add RTL style if the current language's direction is RTL if ($language->getDirection() == LANGUAGE::DIRECTION_RTL) { $build['#attached']['library'][] = 'l10n_community/editor-rtl'; } // // Set the most appropriate title. // if ($filters['project']) { // drupal_set_title(t('Translate %project to @language', array('%project' => $filters['project']->title, '@language' => t($language->name))), PASS_THROUGH); // } // else { // drupal_set_title(t('Translate to @language', array('@language' => t($language->name))), PASS_THROUGH); // } // Set the most appropriate title. if ($filters['project']) { $build['#title'] = $this->t('Translate %project to @language', [ '%project' => $filters['project']->label(), '@language' => $this->t($language->getName()), ]); } else { $build['#title'] = $this->t('Translate to @language', [ '@language' => $this->t($language->getName()), ]); } // Add the filter form. $build['filter'] = \Drupal::formBuilder()->getForm('Drupal\l10n_community\Form\FilterForm'); // $output = array( // drupal_get_form('l10n_community_filter_form', $langcode, $filters) // ); // // Output the actual strings. // if (!count($strings)) { // drupal_set_message(t('No strings found with this filter. Try adjusting the filter options.')); // } // Output the actual strings. if (!count($strings)) { drupal_set_message(t('No strings found with this filter. Try adjusting the filter options.')); } // else { // $output[] = drupal_get_form('l10n_community_translate_form', $language, $filters, $strings); // } Loading Loading
l10n_community/src/Controller/L10nCommunityLanguagesController.php +19 −16 Original line number Diff line number Diff line Loading @@ -208,6 +208,7 @@ class L10nCommunityLanguagesController extends ControllerBase { * @throws \Drupal\Core\TypedData\Exception\MissingDataException */ public function translate(Group $group): array { $translator = \Drupal::service('l10n_community.translator'); $langcode = $group->get('field_translation_language')->first()->getValue()['target_id']; $language = \Drupal::languageManager()->getLanguage($langcode); Loading @@ -215,31 +216,33 @@ class L10nCommunityLanguagesController extends ControllerBase { $drupal_settings = [ 'l10nServerURLs' => $this->addUrlModifiers($langcode, $filters), ]; // $strings = l10n_community_get_strings($langcode, $filters, $filters['limit']); // $strings = $translator->getStrings($langcode, $filters, $filters['limit']); // Add RTL style if the current language's direction is RTL if ($language->getDirection() == LANGUAGE::DIRECTION_RTL) { $build['#attached']['library'][] = 'l10n_community/editor-rtl'; } // // Set the most appropriate title. // if ($filters['project']) { // drupal_set_title(t('Translate %project to @language', array('%project' => $filters['project']->title, '@language' => t($language->name))), PASS_THROUGH); // } // else { // drupal_set_title(t('Translate to @language', array('@language' => t($language->name))), PASS_THROUGH); // } // Set the most appropriate title. if ($filters['project']) { $build['#title'] = $this->t('Translate %project to @language', [ '%project' => $filters['project']->label(), '@language' => $this->t($language->getName()), ]); } else { $build['#title'] = $this->t('Translate to @language', [ '@language' => $this->t($language->getName()), ]); } // Add the filter form. $build['filter'] = \Drupal::formBuilder()->getForm('Drupal\l10n_community\Form\FilterForm'); // $output = array( // drupal_get_form('l10n_community_filter_form', $langcode, $filters) // ); // // Output the actual strings. // if (!count($strings)) { // drupal_set_message(t('No strings found with this filter. Try adjusting the filter options.')); // } // Output the actual strings. if (!count($strings)) { drupal_set_message(t('No strings found with this filter. Try adjusting the filter options.')); } // else { // $output[] = drupal_get_form('l10n_community_translate_form', $language, $filters, $strings); // } Loading