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

Relation widget does not work with i18n file collection #6264

Closed
martinjagodic opened this issue Mar 4, 2022 · 3 comments
Closed

Relation widget does not work with i18n file collection #6264

martinjagodic opened this issue Mar 4, 2022 · 3 comments
Labels
area: i18n type: bug code to address defects in shipped code

Comments

@martinjagodic
Copy link
Member

Describe the bug
The relation widget does not work with i18n file collection. When you click on it, you can see a loading indicator, but the options list is empty. If you have a predefined value it will also not work.

To Reproduce

  1. Configure a file collection with i18n
  2. try to add a file from it as a relation widget on another collection.
  3. click on the relation dropdown

Expected behavior
There should be an options list like on a working relation widget

Applicable Versions:

  • Netlify CMS version: 2.10.187
  • Git provider: GitHub
  • OS: MacOS
  • Browser version Brave Version 1.35.104 Chromium: 98.0.4758.109 (Official Build) (x86_64)

CMS configuration

backend:
  name: git-gateway
  branch: main

i18n:
  structure: multiple_files
  locales: [en, hr, de]

collections:
  - name: taxonomies
    label: Taxonomies
    format: json
    i18n:
      structure: single_file
      locales: [en, hr, de]
    files: [
      {label: Travel type ideas, name: travelTypes, file: data/travelTypes.json, 18n: true, fields: [
        {name: title, label: Title, widget: string, 18n: true},
        {name: id, label: ID, widget: string, 18n: true},
      ]},
    ]

  - name: travel-ideas
    label: Travel Ideas
    folder: content/travel-ideas
    i18n: true
    fields: [
      {name: title, label: Title, widget: string, 18n: true},
      {name: travelType, label: Travel type, widget: relation, collection: taxonomies, file: data/travelTypes.json, search_fields: ["items.*.title"], display_fields: ["items.*.title"], value_field: "items.*.id", i18n: duplicate},
      ]},
    ]
@martinjagodic martinjagodic added the type: bug code to address defects in shipped code label Mar 4, 2022
@erezrokah
Copy link
Contributor

Thanks @martinjagodic, somehow related to #4491

@demshy
Copy link
Member

demshy commented Mar 15, 2022

We have figured out, that the main issue was caused by a configuration misunderstanding. After changing file: data/travelTypes.json to file: travelTypes in relation widget, the options appear as they shoud.

The other issue (the one that you referred as related #4491) still remains (also in our use case) and we will open a PR with the fix soon.

As far as me and @martinjagodic are concerned this one can be closed.

@erezrokah
Copy link
Contributor

Thanks for following up @demshy 👍

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

3 participants