diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 748581f..47e7040 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -26,11 +26,23 @@ function content_translation_help($route_name, Request $request) { case 'help.page.content_translation': $output = ''; $output .= '

' . t('About') . '

'; - $output .= '

' . t('The Content Translation module allows you to translate content, comments, custom blocks, taxonomy terms, users and other content entities. Together with the modules Language, Configuration Translation, and Interface Translation, it allows you to build multilingual websites. For more information, see the online documentation for the Content Translation module.', array('!locale' => (\Drupal::moduleHandler()->moduleExists('locale')) ? \Drupal::url('help.page', array('name' => 'locale')) : '#', '!config-trans' => (\Drupal::moduleHandler()->moduleExists('config_translation')) ? \Drupal::url('help.page', array('name' => 'config_translation')) : '#', '!language' => \Drupal::url('help.page', array('name' => 'language')), '!translation-entity' => 'https://drupal.org/documentation/modules/translation', '!entity_help' => \Drupal::url('help.page', array('name' => 'entity')))) . '

'; + $output .= '

' . t('The Content Translation module allows you to translate content, comments, custom blocks, taxonomy terms, users and other content entities. Together with the modules Language, Configuration Translation, and Interface Translation, it allows you to build multilingual websites. For more information, see the online documentation for the Content Translation module.', array( + '!locale' => (\Drupal::moduleHandler() + ->moduleExists('locale')) ? \Drupal::url('help.page', array('name' => 'locale')) : '#', + '!config-trans' => (\Drupal::moduleHandler() + ->moduleExists('config_translation')) ? \Drupal::url('help.page', array('name' => 'config_translation')) : '#', + '!language' => \Drupal::url('help.page', array('name' => 'language')), + '!translation-entity' => 'https://drupal.org/documentation/modules/translation', + '!entity_help' => \Drupal::url('help.page', array('name' => 'entity')) + )) . '

'; $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Enabling translation') . '
'; - $output .= '
' . t('In order to translate content, the website must have at least two languages. When that is the case, you can enable translation for the desired content entities on the Content Translation page. When enabling translation you can choose the default language for content and decide whether to show the language selection field on the content editing forms.' , array('!url' => \Drupal::url('language.admin_overview'), '!translation-entity' => \Drupal::url('language.content_settings_page'), '!language-help' => \Drupal::url('help.page', array('name' => 'language')))) . '
'; + $output .= '
' . t('In order to translate content, the website must have at least two languages. When that is the case, you can enable translation for the desired content entities on the Content Translation page. When enabling translation you can choose the default language for content and decide whether to show the language selection field on the content editing forms.', array( + '!url' => \Drupal::url('language.admin_overview'), + '!translation-entity' => \Drupal::url('language.content_settings_page'), + '!language-help' => \Drupal::url('help.page', array('name' => 'language')) + )) . '
'; $output .= '
' . t('Enabling field translation') . '
'; $output .= '
' . t('You can define which fields of a content entity can be translated. For example, you might want to translate the title and body field while leaving the image field untranslated. If you exclude a field from being translated, it will still show up in the content editing form, but any changes made to that field will be applied to all translations of that content.') . '
'; $output .= '
' . t('Translating content') . '
'; @@ -177,7 +189,7 @@ function content_translation_entity_base_field_info_alter(&$fields, EntityTypeIn * "alt" and "title" textual elements of an image field, while keeping the * same image on every translation. * - * @see Drupal\image\Plugin\Field\FieldType\imageItem. + * @see Drupal\image\Plugin\Field\FieldType\imageItem. */ function content_translation_field_info_alter(&$info) { foreach ($info as $key => $settings) { @@ -195,8 +207,8 @@ function content_translation_entity_operation_alter(array &$operations, \Drupal\ // @todo Use an access permission. if ($entity instanceof NodeInterface && $entity->isTranslatable()) { $operations['translate'] = array( - 'title' => t('Translate'), - ) + $entity->urlInfo('drupal:content-translation-overview')->toArray(); + 'title' => t('Translate'), + ) + $entity->urlInfo('drupal:content-translation-overview')->toArray(); } } @@ -247,8 +259,9 @@ function _content_translation_menu_strip_loaders($path) { * The entity whose translation overview should be displayed. */ function content_translation_translate_access(EntityInterface $entity) { - return $entity instanceof ContentEntityInterface && empty($entity->getUntranslated()->language()->locked) && \Drupal::languageManager()->isMultilingual() && $entity->isTranslatable() && - (user_access('create content translations') || user_access('update content translations') || user_access('delete content translations')); + return $entity instanceof ContentEntityInterface && empty($entity->getUntranslated() + ->language()->locked) && \Drupal::languageManager()->isMultilingual() && $entity->isTranslatable() && + (user_access('create content translations') || user_access('update content translations') || user_access('delete content translations')); } /** @@ -394,7 +407,7 @@ function content_translation_form_controller(array $form_state) { * @todo Move to \Drupal\content_translation\ContentTranslationManager. */ function content_translation_access(EntityInterface $entity, $op) { - return content_translation_controller($entity->getEntityTypeId())->getTranslationAccess($entity, $op) ; + return content_translation_controller($entity->getEntityTypeId())->getTranslationAccess($entity, $op); } /** @@ -652,7 +665,7 @@ function content_translation_form_field_ui_field_edit_form_alter(array &$form, a $form['#submit'][] = 'content_translation_form_field_ui_field_edit_form_submit'; // Provide helpful pointers for administrators. - if (\Drupal::currentUser()->hasPermission('administer content translation') && !$bundle_is_translatable) { + if (\Drupal::currentUser()->hasPermission('administer content translation') && !$bundle_is_translatable) { $toggle_url = url('admin/config/regional/content-language', array( 'query' => drupal_get_destination(), )); @@ -710,7 +723,8 @@ function content_translation_entity_presave(EntityInterface $entity) { // @todo Avoid using request attributes once translation metadata become // regular fields. $attributes = \Drupal::request()->attributes; - \Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->id, $attributes->get('source_langcode')); + \Drupal::service('content_translation.synchronizer') + ->synchronizeFields($entity, $entity->language()->id, $attributes->get('source_langcode')); } } @@ -790,7 +804,9 @@ function content_translation_language_configuration_element_process(array $eleme function content_translation_language_configuration_element_validate($element, array &$form_state, array $form) { $key = $form_state['content_translation']['key']; $values = $form_state['values'][$key]; - if (!$values['language_show'] && $values['content_translation'] && \Drupal::languageManager()->isLanguageLocked($values['langcode'])) { + if (!$values['language_show'] && $values['content_translation'] && \Drupal::languageManager() + ->isLanguageLocked($values['langcode']) + ) { foreach (\Drupal::languageManager()->getLanguages(Language::STATE_LOCKED) as $language) { $locked_languages[] = $language->name; }