Problem/Motivation

Noticed while manually testing #2301317: MenuLinkNG part4: Conversion

Steps to reproduce:

  1. Install 8.x
  2. set always show errors (admin/config/development/logging)
  3. enable custom menu links, language and content translation modules.
  4. Enable content translation for Custom menu links.
  5. Create a custom menu link.
  6. Add a new language.
  7. Go to the translate page for that menu link.
  8. Click add to add a translation for that new language.
  9. Error is "invalidArgumentException: Invalid translation language (fi) specified".
InvalidArgumentException: Invalid translation language (fi) specified. in Drupal\Core\Entity\ContentEntityBase->addTranslation() (line 746 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Drupal\Core\Entity\ContentEntityBase->addTranslation(fi, [Array])
content_translation_prepare_translation(Drupal\menu_link_content\Entity\MenuLinkContent, Drupal\Core\Language\Language, Drupal\Core\Language\Language)
content_translation_add_page(Drupal\menu_link_content\Entity\MenuLinkContent, Drupal\Core\Language\Language, Drupal\Core\Language\Language)
Drupal\content_translation\Controller\ContentTranslationController->add(Symfony\Component\HttpFoundation\Request, af, fi)
call_user_func_array([Array], [Array])
Drupal\Core\Controller\HtmlPageController->getContentResult(Symfony\Component\HttpFoundation\Request, \Drupal\content_translation\Controller\ContentTranslationController::add)
Drupal\Core\Controller\HtmlPageController->content(Symfony\Component\HttpFoundation\Request, \Drupal\content_translation\Controller\ContentTranslationController::add)
call_user_func_array([Array], [Array])
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Symfony\Component\HttpFoundation\Request, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Symfony\Component\HttpFoundation\Request, 1, TRUE)
Drupal\Core\DrupalKernel->handle(Symfony\Component\HttpFoundation\Request)

Proposed resolution

  • ?
  • clear caches after adding a language
  • do something to menu links so it notices new languages

Remaining tasks

Discuss problem and possible solutions

User interface changes

No.

API changes

No?

Comments

YesCT’s picture

Title: Allowed language langcode argument cached for Custom menu links cause Error » Allowed language langcode argument cached cause Error

happens with nodes also.

YesCT’s picture

Component: menu system » content_translation.module
dawehner’s picture

Issue summary: View changes

.

dawehner’s picture

I do get the follow error mesage:

Warning: Invalid argument supplied for foreach() in Drupal\content_translation\ContentTranslationHandler->entityFormAlter() (line 203 of core/modules/content_translation/src/ContentTranslationHandler.php).
Drupal\content_translation\ContentTranslationHandler->entityFormAlter(Array, Array, Object)
content_translation_form_alter(Array, Array, 'menu_link_content_form')
Drupal\Core\Extension\ModuleHandler->alter(Array, Array, Array, 'menu_link_content_form')
Drupal\Core\Form\FormBuilder->prepareForm('menu_link_content_form', Array, Array)
Drupal\Core\Form\FormBuilder->buildForm(Object, Array)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'default', Array)
content_translation_add_page(Object, Object, Object)
Drupal\content_translation\Controller\ContentTranslationController->add(Object, 'en', 'fr')
call_user_func_array(Array, Array)
Drupal\Core\Controller\HtmlPageController->getContentResult(Object, '\Drupal\content_translation\Controller\ContentTranslationController::add')
Drupal\Core\Controller\HtmlPageController->content(Object, '\Drupal\content_translation\Controller\ContentTranslationController::add')
call_user_func_array(Array, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Status: Active » Closed (cannot reproduce)
Issue tags: +Bug Smash Initiative

@YesCT, thank you for reporting this problem with translating menu links.

I tested this on 8.8.x, following the instructions in the IS, and was not able to reproduce the error. I was able to complete the creation of a translation of a menu link with out error.

Closing this as cannot reproduce.