Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n duplicated fields are not actually duplicated but removed #6978

Open
Billybobbonnet opened this issue Nov 16, 2023 · 0 comments
Open

i18n duplicated fields are not actually duplicated but removed #6978

Billybobbonnet opened this issue Nov 16, 2023 · 0 comments
Labels
area: i18n type: bug code to address defects in shipped code

Comments

@Billybobbonnet
Copy link

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:

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,
              },
            ],
        },
      ]
@Billybobbonnet Billybobbonnet added the type: bug code to address defects in shipped code label Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: i18n type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants