decaporg / decaporg/decap-cms

i18n duplicated fields are not actually duplicated but removed

Open
#6,978 0 comments 0 reactions 0 assignees View on GitHub
area: i18n type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

I have a collection with some fields to be translated (i.e. `i18n:true` ), and some that should not. It turns out that when the document is saved, all the duplicated fields are stripped from the translated document.

I assume this is not the intended behaviour and it makes this function unuseable.

FYI my provider is Github. Files are markdown.

Here is the actual example of collection config that triggers this behaviour:
```yaml
collections:
- name: 'jury'
label: 'Jury'
label_singular: 'Jury member'
i18n: true
view_filters:
- label: '2021 Edition'
field: edition
pattern: '2021'
- label: '2024 Edition'
field: edition
pattern: '2024'
nested:
depth: 2
summary: '{{lastname}} {{firstname}}'
folder: 'content/jury' # The path to the folder where the documents are stored
create: true
summary: '{{lastname}} {{firstname}}'
slug: '{{lastname}}-{{firstname}}'
fields:
[
{
label: Firstname,
name: firstname,
widget: string,
default: '',
required: true,
i18n: duplicate,
},
{
label: 'Edition(s)',
name: 'editions',
widget: 'select',
default: ['2024'],
multiple: true,
options: ['2021', '2024'],
i18n: duplicate,
min: 1,
},
{
label: Lastname,
name: lastname,
widget: string,
default: '',
required: true,
i18n: duplicate,
},
{
label: 'Body',
i18n: true,
name: 'body',
widget: 'markdown',
required: false,
hint: 'Use it to store the bibliography',
},

{
label: Title and institution,
name: title_and_institution,
widget: string,
default: '',
required: false,
i18n: true,
},
{
label: Presentation,
name: presentation,
widget: text,
default: '',
required: true,
i18n: true,
},
{
label: 'Image',
name: 'image',
widget: 'image',
required: false,
i18n: duplicate,
},
{
label: 'Picture Copyright',
name: 'copyright',
widget: 'string',
required: false,
i18n: duplicate,
},
{
widget: 'object',
default: [],
collapsed: true,
label: 'Social channels',
name: 'social_channels',
i18n: true,
fields:
[
{
label: 'Website',
name: 'website',
widget: 'string',
default: '',
required: false,
i18n: duplicate,
},
{
label: 'Wikipedia',
name: 'wikipedia',
widget: 'string',
default: '',
required: false,
i18n: duplicate,
},
],
},
]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.