You put the static infos in *.links.menu.yml where you also define dynamic menu link plugins, which provide the infos you can't put in a static yml. And the deriver to produce a plugin for each language. The local task example was just an example for the translation stuff.
A working static example:
mymodule.links.menu.yml
mymodule.language.top:
title: 'EN'
menu_name: main
route_name: '<none>'
expanded: true
# Plugin class to override the title dynamically:
# class: Drupal\mymodule\Plugin\Menu\TranslatedNodeTop
mymodule.language.item:
title: 'Node 8 spanish'
parent: mymodule.language.top
route_name: entity.node.canonical
route_parameters: { node: '8' }
menu_name: main
options:
attributes:
class:
- foo-class
- bar-class
# deriver for installed languages
deriver: Drupal\mymodule\Plugin\Derivative\TranslatedNodeTabDeriver
# Plugin class extending MenuLinkDefault overriding static properties dynamically,
# the route parameter from the current route match, the language from the deriver
# the title from both and link attributes added for the current language:
# class: Drupal\mymodule\Plugin\Menu\TranslatedNodeItem
You need to add the two dynamic plugins extending MenuLinkDefault. I've recycled the TranslatedNodeTabDeriver from How to get links of translated node edit page in the secondary tabs.