I'm importing menu items from CSV using migrate
, migrate_tools
, migrate_plus
and migrate_source_csv
.
This is an example of how I'm doing it for the original language:
source:
plugin: csv
path: 'private://init/links_gl.csv'
delimiter: ','
enclosure: '"'
header_row_count: 1
keys:
- id
column_names:
0:
id: id
1:
source_id: source_id
2:
parent_id: parent_id
3:
menu_name: menu_name
4:
weight: weight
5:
title: title
constants:
path: 'entity:node/'
ids:
id:
type: string
process:
title: title
menu_name: menu_name
nid:
plugin: bbaa_migration_lookup
migration: init_contents_gl
source: source_id
'link/uri':
plugin: bbaa_concat
source:
- constants/path
- '@nid'
parent:
plugin: menu_link_parent
source:
- parent_id
- '@menu_name'
external:
plugin: default_value
default_value: 0
expanded:
plugin: default_value
default_value: 1
enabled:
plugin: default_value
default_value: 1
langcode:
plugin: default_value
default_value: 'gl'
weight: weight
destination:
plugin: entity:menu_link_content
bundle: menu_link_content
no_stub: true
It's working but now I need to import another CSV file with translated menu items.
I created another migration configuration for the translated language and I tried adding this code:
id:
plugin: migration
source: id
migration: init_links_gl
content_translation_source:
plugin: default_value
default_value: 'gl'
langcode:
plugin: default_value
default_value: 'es'
destination:
plugin: entity:menu_link_content
translations: true
no_stub: true
But it doesn't work.
How can I translate menu items with migrate?