Hello,

I have noticed that translations for menu items are not currently supported.

I am aware that the work for this is important.

I have developed a solution but of course I would like your opinion.

Thanks

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

daniel.delaiglesia created an issue. See original summary.

daniel.delaiglesia’s picture

My proposed solution.

Thanks!

fidovdbos’s picture

@daniel.delaiglesia thnx for the patch i wil take a look at it right a way.

daniel.delaiglesia’s picture

Hi again,

I've updated patch. It solve small problem into MenuSyncForm.php file

Thanks.
Regards

steveoriol’s picture

Hello daniel.delaiglesia,
When I use patch # 4, I get a lot of "Warning" like this:

Warning: Illegal string offset 'menu_name' in Drupal\structure_sync\Form\MenuSyncForm->buildForm() (line 143 of modules/contrib/structure_sync/src/Form/MenuSyncForm.php).
Drupal\structure_sync\Form\MenuSyncForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 518)
Drupal\Core\Form\FormBuilder->retrieveForm('structure_sync_menus', Object) (Line: 275)
Drupal\Core\Form\FormBuilder->buildForm('structure_sync_menus', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 666)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
colan’s picture

Version: 8.x-1.12 » 8.x-1.x-dev

New features go into HEAD, which may turn out to be a 2.x branch if we have one.

fmb’s picture

When I use patch # 4, I get a lot of "Warning" like this:

@steveoriol that's because you need to export your menu links before as the structure of data changes to take languages into account.

fmb’s picture

Status: Active » Needs review
StatusFileSize
new18.27 KB

Re-rolled patch, updated and fixed some parts of it. Works for me™.

Status: Needs review » Needs work
tostinni’s picture

Status: Needs work » Needs review
StatusFileSize
new18.79 KB
new988 bytes

I had also some problems with the previous patch using the UI (Warning: Illegal string offset 'menu_name') and the safe import, so here is an updated patch that Works for me™ ^^

Thank you for the work on this.

BTW in this patch, previous contributors have added the support for additional fields, see #2980893: New fields added to the menu cannot be exported.

tostinni’s picture

StatusFileSize
new18.99 KB
new1.68 KB

A small change to support Translatable menu link uri module through the link_override field.

This way you can translate the URI and it will be exported to.

elkaro’s picture

Having this feature for the 2.0.x version of the module would be a blessing. I have a large menu that needs translating and this would be a tremendous help.

oily made their first commit to this issue’s fork.

mparker17 made their first commit to this issue’s fork.

mparker17’s picture

To make this easier to review, I've created a merge request. The patch didn't apply properly, so I tried to re-create it, but I may have made a mistake in doing so: please ensure that the changes in the merge request fixes the problem and report back here.

Note that this is a patch to an unsupported branch (8.x-1.x). I haven't yet had a chance to determine if this issue is still present in the 2.x branch, nor if this patch would also apply there; @elkaro, do you know if it is still an issue in the 2.x branch?

mparker17’s picture

Status: Needs review » Postponed (maintainer needs more info)

Marking as "Maintainer Needs More Info", awaiting a response to the question in #16.

ressa’s picture

Version: 8.x-1.x-dev » 2.x-dev
Status: Postponed (maintainer needs more info) » Needs work

Thanks @mparker17, this is still relevant for version 2, and since last 1.x release was January 2019, maybe we should target version 2?

ressa’s picture

Just a tip: Until Structure Sync gets support for translating menus, Menu migration (Import & Export) (https://www.drupal.org/project/menu_migration) supports this -- both via the GUI, and Drush commands, for export and import:

drush menu_migration:quick-export main