Score:0

How to import content with multiple taxonomy terms with translations?

kr flag

I have a CSV file like this.

id,Title,body,tags,dutch title,dutch body,dutch tags
1,Content1,Description,tag1;tag2,Dutch Content1,Dutch Description,dutch tag1;dutch tag2

I have the migration file for English like this:

id: my_migration
label: My migration
migration_tags:
  - my_migration
  - node
  - company_guide_import
source:
  plugin: csv
  delimiter: ','
  enclosure: '"'
  escape: '`'
  header_offset: 0
  ids: ['id']
  path: 'modules/custom/mymodule/mycontent.csv'
destination:
  plugin: 'entity:node'
  default_bundle: my_bundle
process:
  title: Title
  type:
    plugin: default_value
    default_value: my_bundle
  'body/value': Body
  'body/format':
    - plugin: default_value
      default_value: wysiwyg
  langcode:
    plugin: default_value
    default_value: 'en'
  tags:
    - plugin: explode
      delimiter: ';'
      source: tags
    - plugin: entity_generate
      ignore_case: true

This works fine. But now I have added another migration file for the dutch language.

I know I can match title and body with the dutch title and the dutch body. But how can I translate the taxonomy terms here? and map the translated version of taxonomy to the translated version of the node?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.