Sub menu items are not translated

Created on 3 July 2019, about 6 years ago
Updated 19 April 2023, over 2 years ago

In a hierarchical menu, the sub menu items are not translated. When I look at how _i18n_menu_link_process($link) works, for one menu item (of the first level) it is called twice:

- First, via _menu_link_translate() => i18n_menu_translated_menu_link_alter() => _i18n_menu_link_process()
- Then, via i18n_menu_localize_tree() => _i18n_menu_link_process()

The first one only translate the menu item and marks it as $link['i18n_menu'] = TRUE;. It does not translate sub menu items. So the second one, when it sees that this menu item marked as "translated", it won't process.

My code to reproduce bug (in a hook_block_view callback):

      $menu_data = menu_tree_page_data($menu_name);
      if (function_exists('i18n_menu_localize_tree')) {
        $menu_data = i18n_menu_localize_tree($menu_data);
      }
      return menu_tree_output($menu_data);

The above code only translates the first level menu items. It's a bug.

🐛 Bug report
Status

Needs review

Version

1.26

Component

Menus

Created by

🇫🇷France jcisio Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024