decaporg / decaporg/decap-cms

Changing writing locale cause uncaught type error

Open
#6,307 1 comment 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

When writing a new post, changing locale will cause an uncaught type error and the editing form of the post content isn't show up.

**To Reproduce**

1. Setup Netify CMS with i18n enabled.
2. Click New button in the index page.
3. Change writing locale dropdown from `Writing in EN` to another locale, for example, `Writing in FR`
4. The editing form will disappear, and you will see an uncaught type error in the debug console.

**Expected behavior**

- No error will be thrown.
- The editing form won't disappear after changing the writing locale.

**Screenshots**

![netify-cms-i18n](https://user-images.githubusercontent.com/11836570/158923169-b81a70a7-6c5c-4417-9bd4-ebe17c7c3d9a.gif)

**Applicable Versions:**

- Netlify CMS version: `2.*.*`
- Git provider: Self-hosted Gitlab
- OS: MacOS
- Browser version: chrome 99

**CMS configuration**

config.yaml

```yaml
backend:
name: gitlab
repo: alvin/static-api-testbed # Path to your GitLab repository
auth_type: pkce # Required for pkce
app_id: #masked
api_root: #masked
base_url: #masked
auth_endpoint: oauth/authorize
publish_mode: editorial_workflow
media_folder: "static/images/uploads"
public_folder: "static/images/uploads"
i18n:
locales:
- en
- fr
structure: "multiple_files"
default_locale: en
collections:
- name: "announcement" # Used in routes, e.g., /admin/collections/blog
label: "Announcement" # Used in the UI
i18n: true
folder: "content/announcement" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
slug: "{{year}}{{month}}{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Title", name: "title", widget: "string"}
- {label: "Publish Date", name: "date", widget: "datetime"}
- {label: "Featured Image", name: "thumbnail", widget: "image"}
- {label: "Rating (scale of 1-5)", name: "rating", widget: "number"}
- {label: "Body", name: "body", widget: "markdown"}
```

index.html

```html



Content Manager


```

**Additional context**

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.