decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

i18n - single_file error

Open michael-proulx opened this issue 2 years ago • 5 comments

Describe the bug I have setup i18n in a single_file, need to test some feature, but I'll need a specific setup, but I encounter an issue while testing that. Folder collection does work very good, but when I'm trying to save a single_file, I got the following error.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'get')

Screenshots https://user-images.githubusercontent.com/23478544/160468575-5aa9e718-b27c-4a9f-8f1c-e74785a7fe5f.mp4

Applicable Versions: I'm using the unpkg link and 11ty as SSG

  • Netlify CMS version: https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js
  • Git provider: GitHub and local_backend

CMS configuration

backend:
  ...
  squash_merges: true

local_backend:
  url: http://localhost:8089/api/v1

publish_mode: editorial_workflow

media_folder: 'packages/_data/images'

i18n:
  structure: single_file
  locales: [en, fr, de]
  default_locale: en

collections:
  - name: 'pages'
    label: 'Pages'
    i18n:
      structure: single_file
    files:
      - name: 'about'
        label: 'About Page'
        file: packages/_data/pages/about.yml
        i18n: true
        fields:
          - { label: 'Title', name: 'title', widget: 'string', i18n: true }

michael-proulx avatar Mar 28 '22 19:03 michael-proulx

Same here

solidevolution avatar Mar 30 '22 19:03 solidevolution

Same issue as https://github.com/netlify/netlify-cms/issues/5122 and https://github.com/netlify/netlify-cms/issues/4480.

The main problem is that right now the code is trying to update all translations, so if there is no data in some of the translations this will create the error.

As mentioned in this issue https://github.com/netlify/netlify-cms/issues/4480#issuecomment-947546677 I think that having to fill all translation doesn't have a lot of sense making this a limitation of i18n.

Right now I'm working on my fork to fix this issue

dfdez avatar Apr 19 '22 08:04 dfdez

is there a fix? or is it that i18n just won't work with files for now?

preetamslot avatar Jul 23 '22 06:07 preetamslot