Problem/Motivation
I cannot find documentation about configuring a Feed type to import a multilingual entity. For example, in the JSON source I have, there are translations with same NID (same content, different languages). I tried the mapping of the attached screenshot but after import, only the first translation is imported (the first translation with same NID).
Moreover, If I uncheck the unique checkbox, all node translations get imported. However, they are created as separated nodes (without having the same NID they had on original source).
Proposed resolution
Document how to proceed with multilingual imports in the official docs:
https://www.drupal.org/docs/contributed-modules/feeds
The docs would need to say what workflows for importing multilingual content are supported and then provide a step by step guide on how to implement each workflow.
One workflow is that the source looks like this, where the columns specify the language:
id,title_en,title_nl
1,Hello World,Hallo Wereld
An other workflow where the language is specified in a particular column:
id,title,langcode
1,Hello World,en
1,Hallo Wereld,nl
And a third workflow is that the content is in separate files:
content_en.csv:
id,title
1,Hello World
content_nl.csv:
id,title
1,Hallo Wereld
And this guide should then explain how one can become a translation of the other.
| Comment | File | Size | Author |
|---|
Comments
Comment #2
rcodinaComment #3
rcodinaComment #4
rcodinaComment #5
rcodinaComment #6
jmee commentedI got this working based on hints in comment #2 in this issue: A translation already exists for the specified language
I was originally trying to import translations as separate items (thinking that the block would be created in one language and updated with a translation via a second feed item), but it seems as though they need to be grouped together and the language should be set in the field mapping.
I can provide an example of a block import via csv, but it should be similar for other types of entities and importers. Custom blocks are very simple, with just two fields on the default 'Basic block' block type (info and body).
I've attached a screenshot of the mapping settings. The site has english and french installed, with english configured as the 'default' language.
csv (successfully imported!):
I'm not actually mapping anything to langcode or the default language values, it seems like that is meant for a different context (when we're not importing content that already has a translation ?).
And here is the config for my feed type:
Comment #7
megachrizTagging issue with "multilanguage", so I can find this issue back as soon as I plan to focus on Feeds multilingual issues again.
I also updated the issue summary, specifying three workflows that should be documented.
Comment #8
megachrizComment #9
ptmkenny commentedSome additional documentation in comments #8 and #9 on this issue.
Comment #10
baikho commentedComment #11
wheelercreek commentedI also had do this and it was tricky to figure out. I wrote up a blog post to capture my process. Feel free to use anything I wrote here in the official documentation. https://www.wheelercreek.com/blog/use-feeds-module-multilingual-data-imp...
Comment #12
sandeshyadav commentedThank you @wheelercreek. Your blog saved my day :)